title: why should I use (y,x) instead of (x,y) to access a pixel in opencv?
body: <p>I had to access a pixel into an image, using openCV but at first I wasn't able since python was telling me that the value I wanted to access was out of bound.</p>
  
  <p>Then I searched for this error and I discovered that I should access a pixel using <code>image[y, x]</code> instead of <code>image[x, y]</code>.</p>
  
  <p>I found this piece of information in the comments of this page, but there is no explanation:
  <a href="https://www.pyimagesearch.com/2016/02/01/opencv-center-of-contour/" rel="nofollow noreferrer">https://www.pyimagesearch.com/2016/02/01/opencv-center-of-contour/</a></p>
  
  <blockquote>
    <p>Adrian Rosebrock February 12, 2016 at 3:19 pm #:
    When accessing pixel values in OpenCV + NumPy, you actually specify them in (y, x) order rather than (x, y) order. Thus, you need to use: image[cY, cX]</p>
  </blockquote>
  
  <p>So, the question is...why should I invert the coordinates while trying to access a pixel?</p>