Cv2.getoptimalnewcameramatrix Returns Roi Of [0,0,0,0] On Some Data Sets
Solution 1:
Solved.
Tl;dr: make sure the edges and corners are well represented by the checkerboard in the calibration images.
With data only in the center, where distortion is minimal, the solution is subject to greater error.
Further discussion here.
Solution 2:
What I found out is that the criteria matters alot for this: self.criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.1) returns good values.
self.criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.01) returns 0 0 0 0
in other words, if you set the last term as 0.1 it might work, if it is lower... might not (if I set the last value to 1 it also work... maybe just try to modify that value and see what works best for you)
I am still not sure what that value does but, if I set it to 0.05 it works and the picture is pixelated (scaled) and if I set it to a higher value like 5 or 10, it looks that it still works but the picture is clearer (not scaled).
Overall, if you encounter this problem just try to adjust the last value from the termination criteria.
Post a Comment for "Cv2.getoptimalnewcameramatrix Returns Roi Of [0,0,0,0] On Some Data Sets"