1 | initial version |
I just tracked down the cause of this bug in my code: every so often the checkerboard was flipping 180 degrees between left/right images, breaking stereo matching.
My quick solution was to check the vertical disparity between the left and right checkerboard points. If it's above a threshold, reverse the list of checkerboard points (which is equivalent to flipping them 180 degrees).
The python code for that looks like this:
# Check for the flipped checkerboard!
diff = leftCorners - rightCorners
lengths = np.linalg.norm(diff[:, :, 1], axis=-1)
sum = np.sum(lengths, axis=0)
if (sum > 2000.0):
print("THIS STEREO PAIR IS BROKEN!!! Diff is: "+str(sum))
rightCorners = np.flipud(rightCorners)