python - opencv: camera calibration image not being displayed -


so took bunch of pictures camera , have followed tutorial posted here: http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_calib3d/py_calibration/py_calibration.html

but i've ran problem. i'm getting empty image drawchessboardcorners function , i'm not sure why. note new opencv , may trivial right can't figure out. i'm using opencv 2.4.10.

code:

import numpy np import cv2  # termination criteria criteria = (cv2.term_criteria_eps + cv2.term_criteria_max_iter, 30, 0.001)  # prepare object points, (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((6*7,3), np.float32) objp[:,:2] = np.mgrid[0:7,0:6].t.reshape(-1,2)  # arrays store object points , image points images. objpoints = [] # 3d point in real world space imgpoints = [] # 2d points in image plane.  in range (1,13):     img = cv2.imread('calibrate/calibrate' + str(i) + '.jpg')     gray = cv2.cvtcolor(img,cv2.color_bgr2gray)      # find chess board corners     ret, corners = cv2.findchessboardcorners(gray, (9,6),none)      # if found, add object points, image points (after refining them)     if ret == true:         objpoints.append(objp)          corners2 = cv2.cornersubpix(gray,corners,(11,11),(-1,-1),criteria)         imgpoints.append(corners)          # draw , display corners         img = cv2.drawchessboardcorners(img, (9,6), corners2,ret)         cv2.imshow('img',img)         cv2.waitkey(500)     else:         print "no calibration"  cv2.destroyallwindows() 

here's picture taken webcam:

here's picture of error code: enter image description here

i modified code bit work pictures took (using program wrote). example, loop there because have 12 photos names calibrate1,calibrate2 , forth. i'm pretty stumped on one, , 1 of can give me insight! thanks

so after @berak's comment decided uninstall opencv 2.4 , install opencv 3.0 , behold, above code worked! thank @berak


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -