Ask Your Question
0

How to build lookup table for inverse perspective mapping?

asked 2013-04-11 13:18:18 -0600

updated 2014-06-12 12:22:36 -0600

Hi, I want to build a lookup table to use with inverse perspective mapping. Instead of applying warpPerspective with the transform matrix on each frame, I want to use a lookup table (LUT).

Right now I use the following code to generate the transformation matrix

m = new Mat(3, 3, CvType.CV_32FC1);
m = Imgproc.getPerspectiveTransform(src, dst);

In the onCameraFrame() I apply the warpPerspective() function. How can I build a LUT knowing some input pixels on the original frame and their correspondences in the output frame, and knowing the transfromation matrix??

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-04-12 02:59:53 -0600

Follow the following guide about lookup tables in OpenCV and see if it can fix your problem. If I understand your question correctly, this is all you need.

http://docs.opencv.org/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html

edit flag offensive delete link more

Comments

Here's what I have: http://img21.imageshack.us/img21/9017/imag1160p.jpg

Right now I'm using warpPerspective() to generate the birds eye view (inverse perspective map) but it's really slow.. I've been reading in some papers that you can build a lookup table and use that to map the points. ( for example here: http://shanetuohy.com/fyp/Images/Shane%20Tuohy%20Thesis.pdf >> @ page 23 >> 5.1 Generate lookup array

razvan gravatar imagerazvan ( 2013-04-12 13:39:21 -0600 )edit

I would say, give it a go. I haven't done anything related in the area so can't help ya for the moment :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-12 14:32:48 -0600 )edit

razvan i'm trying to implement inverse perspective mapping in image of road for calculate the distance but i can't generate bird-eye view :( how do you calculate destination points?

Carlos gravatar imageCarlos ( 2013-04-13 15:13:12 -0600 )edit
2

I did it by hand, manually, on a sheet of paper.. Basically on the src array you have 4 points in a trapezoid shape. On the dst array you put the corresponding calculated 4 points that represent a sqare/rectangle. I tried multiple values for the dst array, until I got a good result. Using the data from the calibration tutorial (extrinsic parameters w/ rotation and translation vectors) didn't work as expected. The source code for the transformation matrix is written in my initial question (the "m" matrix). After that you apply:

 Imgproc.warpPerspective(mRgba, tempMat, m, ddsize, Imgproc.INTER_LINEAR | Imgproc.CV_WARP_FILL_OUTLIERS);

 mRgba = tempMat.clone();
razvan gravatar imagerazvan ( 2013-04-13 19:57:40 -0600 )edit

Question Tools

Stats

Asked: 2013-04-11 13:18:18 -0600

Seen: 3,870 times

Last updated: Jun 12 '14