I am doing GoPro camera calibration with OpenCv. But findChessboardCorners return false on many of my images and Matlab not. I have tried to biniraze images to help OpenCv but it helps only in some cases. Here is example:

Here is code:
CHECKERBOARD = (6,9)
img = cv2.imread('1.JPG')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, corners = cv2.findChessboardCorners(gray, CHECKERBOARD, cv2.CALIB_CB_ADAPTIVE_THRESH+cv2.CALIB_CB_FAST_CHECK+cv2.CALIB_CB_NORMALIZE_IMAGE)
print(ret)
I have tried different flags. OpenCv fails and matlab not. Any hint?
Resizing the image seems to work.
Code Sample:
import cv2
import numpy as np
CHECKERBOARD = (6,9)
img = cv2.imread("Q2l11.jpg")
img = cv2.resize(img,(int(400),int(400)))
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, corners = cv2.findChessboardCorners(gray, CHECKERBOARD, cv2.CALIB_CB_ADAPTIVE_THRESH+cv2.CALIB_CB_FAST_CHECK+cv2.CALIB_CB_NORMALIZE_IMAGE)
print(corners)
#print(ret)
corners = np.int0(corners)
for i in corners:
x,y = i.ravel()
cv2.circle(img,(x,y),3,(0,0,255),-1)
cv2.imshow('Corners',img)
cv2.waitKey(0)
Result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With