Ask Your Question
2

Inverse Perspective Mapping -> When to undistort?

asked 2013-06-20 19:33:57 -0600

Ashok Elluswamy gravatar image

BACKGROUND:

I have a a camera mounted on a car facing forward and I want to find the roadmarks. Hence I'm trying to transform the image into a birds eye view image, as viewed from a virtual camera placed 15m in front of the camera and 20m above the ground. I implemented a prototype that uses OpenCV's warpPerspective function. The perspective transformation matrix is got by defining a region of interest on the road and by calculating where the 4 corners of the ROI are projected in both the front and the bird's eye view cameras. I then use these two sets of 4 points and use getPerspectiveTransform function to compute the matrix. This successfully transforms the image into top view.

QUESTION:

When should I undistort the front facing camera image? Should I first undistort and then do this transform or should I first transform and then undistort.

If you are suggesting the first case, then what camera matrix should I use to project the points onto the bird's eye view camera. Currently I use the same raw camera matrix for both the projections.

Please ask more details if my description is confusing!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-21 04:30:14 -0600

neoirto gravatar image

Hi,

You should :

  • first undistort your raw image

  • then apply your warpperspective()

And use the undistorted camera matrix of course ( Intrinsic_undisto ).

To get the transform Mat, you don't have to do such complex computes.

Mat Trans_to_C= (   Mat_<double>(3,3) <<
1, 0, -Cx,
0, 1, -Cy,
0, 0, fx);

Mat Intrinsic_undisto = (   Mat_<double>(3,3) <<
fx, 0, Cx,
0, fy, Cy,
0, 0, 1);

Mat 3x3_Translation_bird_eye = (    Mat_<double>(3,3) <<
1, 0, Trans_X,
0, 1, Trans_Y,
0, 0, Trans_Z);

Mat transform =  3x3_Translation_bird_eye * Intrinsic_undisto * 3x3_Rot * Trans_to_C;

I'm not sure for 3x3_Translation_bird_eye, but you should try this...

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-20 19:33:57 -0600

Seen: 2,616 times

Last updated: Jun 21 '13