title: OpenCV 3, python 3 'Image step is wrong' error
body: <p>It's possible that my problem is simply a Python 3 OpenCV bug, but I don't know. I have 32 bit Python version 3.4.3 installed in Windows 10. I have OpenCV 3.0.0 32 bit installed from this website <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/" rel="nofollow">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a> (opencv_python‑3.0.0‑cp34‑none‑win32.whl).</p>
  
  <p>I also have numpy 1.10.0b1 beta installed from that site.</p>
  
  <p>I've tested out the same basic program flow below using OpenCV with Java and it works. For that reason I figure this may just be a Python bug issue. What happens is that the call to drawContours in the code below produces this error: </p>
  
  <blockquote>
    <p>OpenCV Error: Image step is wrong (Step must be a multiple of esz1) in cv::setSize, file ......\opencv-3.0.0\modules\core\src\matrix.cpp, line 300</p>
  </blockquote>
  
  <p>The test image I am using is 1168 x 1400 pixels.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import cv2
  import numpy as np
  img = cv2.imread('test.jpg')
  imgray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
  ret, threshImg = cv2.threshold(imgray,127, 255,cv2.THRESH_BINARY)  
  can = cv2.Canny(threshImg,100,200)
  contImg, contours, hierarchy = cv2.findContours(can,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)    
  cv2.drawContours(img, contours,-1,(0,255,0))    
  cv2.imwrite('test write.jpg', img)
  </code></pre>
  
  <p>*******EDIT********
  **I just solved the problem by installing numpy version 1.9.2 instead of the 1.10 beta.****</p>