title: Difference between cv2.findNonZero and Numpy.NonZero
body: <p>Silly question here.</p>
  
  <p>I want to find the locations of the pixels from some black and white images and found this two functions from Numpy library and OpenCV.</p>
  
  <p>The example I found on the internet (<a href="http://docs.opencv.org/trunk/d1/d32/tutorial_py_contour_properties.html" rel="noreferrer">http://docs.opencv.org/trunk/d1/d32/tutorial_py_contour_properties.html</a>):</p>
  
  <pre><code>    mask = np.zeros(imgray.shape,np.uint8)
      cv2.drawContours(mask,[cnt],0,255,-1)
      pixelpoints = np.transpose(np.nonzero(mask))
      pixelpointsCV2 = cv2.findNonZero(mask)
  </code></pre>
  
  <p>Which states </p>
  
  <blockquote>
    <p>Numpy gives coordinates in <strong>(row, column)</strong> format, while OpenCV gives coordinates in <strong>(x,y)</strong> format. So basically the answers will be interchanged. Note that, row = x and column = y.</p>
  </blockquote>
  
  <p>Based on my understanding of english, isn't their explanation wrong? Shouldn't it be:</p>
  
  <blockquote>
    <p>Numpy gives coordinates in (row, column) format, while OpenCV gives coordinates in <strong>(y,x)</strong> or <strong>(column, row)</strong> format.</p>
  </blockquote>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Does numpy return <strong>(row,col)</strong>/<strong>(x,y)</strong> and OpenCV <strong>(y,x)</strong> where row=x, col=y? Although IMHO it should be row=y, col=x?</p></li>
  <li><p>Which one is more computation efficient? In terms of time &amp; resources.</p></li>
  </ol>
  
  <p>Maybe I am not getting this simple thing right due to not being a non-native English speaker.</p>