Ask Your Question
0

cv::undistortPoints not working for me ....

asked 2019-01-19 02:51:40 -0500

mikeitexpert gravatar image

I am trying to un-distort the pixel coordinate of two points using the code below but I am not successful.

       vector<Point2f> pts;
       cv::Mat upts;
       pts.push_back(diagStartPnt);
       pts.push_back(diagEndPnt);
       cerr << "m_cameraMat = \n" << m_cameraMat << endl;
       cerr << "m_distortionCoefMat = \n" << m_distortionCoefMat << endl;
       cerr << "pts = \n" << pts << endl;
       undistortPoints(Mat(pts), upts, m_cameraMat, m_distortionCoefMat);

        cerr << "upts = " << upts << endl;

But it doesn't seem to be working, I get weird output ... !!!???

m_cameraMat = 
[606.184487913021, 0, 320;
 0, 606.184487913021, 240;
 0, 0, 1]

m_distortionCoefMat = 
[-0.02448317075341529;
 0.3189340323130755;
 0;
 0;
 -1.013832345303472]

pts = 
[533.44543, 347.06061;
 529.32397, 234.65332]

upts = 
[0.35208049, 0.1765976;
 0.34534943, -0.0088211242]

I am totally clueless ... :|

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-01-19 14:09:29 -0500

Tetragramm gravatar image

Take a look at the documentation HERE.

See the last argument, P=noArray()? It says it's the "New camera matrix (3x3) ... If the matrix is empty, the identity new camera matrix is used."

Take your camera matrix and place it also in that argument (leave R as noArray()), and you should see the points where you expect them.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-19 02:51:40 -0500

Seen: 64 times

Last updated: Jan 19