UndistortPoints randomly returning huge values

asked 2017-07-21 02:52:07 -0500

GruenSein gravatar image

Hi all,

to let me put everything in context, let me describe what I am doing/trying to do. I have a multiple camera setup which I calibrate using OpenCV. The images obtained from the cameras contain a bunch of bright spots which I use to triangulate their real world coordinates. This has been working flawlessly so far. To improve the real world coordinate accuracy, I use the resulting point cloud and the positions of the peaks in the images, to refine the calibration of each camera. This is also working well. Afterwards, I repeat the undistortion of the raw peak positions in the images so that the undistorted peak list reflects the changed calibration parameters. In randomly occuring cases after recalibrating the cameras, however, I am left with absolutely unusably undistorted peak positions that exhibit values of the order of 1.0E+28 and above. Usually, the undistored peak positions should be in the range of +-1 or so. So far, I have only been able to trace this behavior back to the undistortPoints call. My suspicion is that the calibration uses a not-quite-robust-enough optimizer so that a large number of world-image-coordinate pairs (approx. 100k) with some degree of uncertainty can cause it to diverge.

Has anyone else seen this kind of behavior and can suggest some countermeasures?

Thanks for your input and all the best, Alex

edit retag flag offensive close merge delete


Just a guess: Are your data-types overflowing?

Franz Kaiser gravatar imageFranz Kaiser ( 2017-07-21 05:23:57 -0500 )edit

Possibly, but if so, it happens within OpenCVs undistortPoints function call. I have looked at the problem a bit more closely and found that usually when it happens it is only one of 100k points that exhibits this behavior. For now, my solution is to filter it out and only use the remaining peaks but I'd much rather fix this behavior completely

GruenSein gravatar imageGruenSein ( 2017-07-24 03:46:15 -0500 )edit