문제

I'm using OpenCVs solvePnP to get the pose/positon of the camera. I'm doing this by using points selected by the user, on an image that is already calibrated and have applied the fix for radial and tangential distortion.

However, it seems solvePnP() takes distortion coefficients as input in addition to the points selected in the image, which I suppose means taht SolvePnP applies the distortion-fix on the points given as input to the function.

This would create a minor error in my program, since the source image is already barrel-distorted, right?

If so, how can I make solvePnP() ignore the barreldistortion? Can I pass a vector with distortion-coefficients set to just 1's? Or should i set all values to 0? Some other way?

도움이 되었습니까?

해결책

In the past I have just passed an empty cv::Mat

cv::solvePnP(world_points, image_points, camera_mat, cv::Mat(), rotation_vector, translation_vector);

the documentation says that if you pass NULL it will set all the coefficients to 0 for you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top