cv::projectPoints giving bad results when undistorted 2d projections are far

asked 2020-03-03 03:28:40 -0600

Houthius gravatar image

Hello guys,

I'm using opencv to calibrate my cameras and I use distortions up to K6. When I use cv::projectPoints, sometimes it gives me really bad projections and when I checked to project without distortion, the points that are badly projected are a bit far outside the image. So it is the distortion that is done poorly and is giving really bad 2d coordinates (sometimes inside the image!!).

I was wondering if there is a way to project points without distortion and predict which ones would be badly distorted (I use up to K6 distortion coefficients).

edit retag flag offensive close merge delete

Comments

1

I'm not sure about that, but I read somewhere that using more than the usual 4/5 distortion coefficients in this function sometimes lead to bad results. Try to search here in the forum first. Just to give a try, use the function with less coefficient and see if the result is acceptable or not. Otherwise you need to investigate to something else. There is also undistortPoints function, you can try to use it to remove the distortion effect on your point and then feed projectPoints with a null/empty distortion coefficients

HYPEREGO gravatar imageHYPEREGO ( 2020-03-03 06:37:41 -0600 )edit
1

I found some code that allow to predict if distortion will go well or not but it only works with calibs going no more than K3. I was wondering if there is something for calibs going up to K6.

Houthius gravatar imageHouthius ( 2020-03-03 07:18:46 -0600 )edit
1

Try with the workaround I suggest to you, so, undistortPoint and then applying projectPoints

HYPEREGO gravatar imageHYPEREGO ( 2020-03-03 08:23:51 -0600 )edit

I have a similar problem and I'm wondering if you can share the code to allow to predict wether the distortion goes ok. In my case, the suggestion from @HYPEREGO doesn't work, I need the projection of my points in the distorted image. Going back and forth is a waste of time.. at least this is my point of view

trigal gravatar imagetrigal ( 2020-07-01 16:46:10 -0600 )edit

I just created a new question with a more extended analysis of the issue https://answers.opencv.org/question/2...

trigal gravatar imagetrigal ( 2020-07-01 19:06:07 -0600 )edit