title: Python OpenCV: Reading an image along x and y axis
body: <p><strong>Aim:</strong> I am trying to read the first point (non-zero) here in this image (shown as the red arrow)</p>
  
  <p><a href="https://i.stack.imgur.com/nxs0i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nxs0i.png" alt="enter image description here"></a></p>
  
  <pre><code>from __future__ import division
  import numpy as np
  
  import cv2
  im1 = cv2.imread('C:/Users/Desktop/Line.png', 0)
  for x in range(0, im1.shape[0], 1):
      for y in range(0, im1.shape[1], 1):
          cpt = im1[x][y]
          if 0 &lt; cpt &lt;= 255 :
             print("This is the value", x,y)
  </code></pre>
  
  <p>But, the point being printed is this (a zero point):</p>
  
  <p><a href="https://i.stack.imgur.com/M9oGx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M9oGx.png" alt="enter image description here"></a></p>
  
  <p>How is this so? </p>
  
  <p>The <strong>original</strong> image:</p>
  
  <p><a href="https://i.stack.imgur.com/JKNp9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JKNp9.png" alt="enter image description here"></a></p>