I am in the process of performing a stereo calibration for two cameras. I know that Stereo calibration will essentially find out the rotation R and translation t between both the cameras. For the two cameras I have given the intrinsic parameters. In the first step, I take about 50 images simultaneously with both cameras. I then finally use these for the stereo calibration. My results also make rough sense. Because I know the distance of the cameras and compared them with the output t and that fits.
However, I sometimes get an error message when I, for example, vary the distance between the cameras and take new pictures, namely:
(expected: ‘nimages == (int)imagePoints2.total()’), where
‘nimages’ is 27
must be equal to
‘(int)imagePoints2.total()’ is 50
Can anyone give me a tip on how to make sure I get the same number of object/image points for both images? Or does anyone know this problem in general and knows a solution? I would be very grateful.
isn’t that a limitation of the (terrible) code you copypasted from SO only ?
you indeed have to make sure, it sees a complete chessboard for each image pair.
(if it’s not so, you have to skip both images)
it’s just a matter of re-organization
again, you need a loop over image pairs, not 2 (shittily copypasted) ones per camera
But I wonder why you have such a nasty expression? Not everyone here is a professional and can immediately write the perfect code. So please pay attention to how you write. You may be a professional and can distinguish good and bad code but others cannot.
I see you are a moderator. You should be a role model and not bash other people here.
No problem…and yes I understand the problem. We need always a pair of images. But my problem is how to implement a code which can detected a fault pair to ignore them. I did not find examples in the internet.
the essence of it is:
you need to do this for both images, and ret has to be True for both. only then, you can go on:
# Find the chess board corners
ret, cornersL = cv2.findChessboardCorners(grayL, (9,6),None)
# If found, add object points, image points (after refining them)
if ret == True:
# ok for L