remap single point does not give me the correct value

Hello!

I am trying to compute the remaped position of a specific point of an image but it does not give me the correct coordinate as I compare it with the remaped image.

is this correct?

Point2f relocated = Point2f(mapx.at<float>(input.rows,input.cols),mapy.at<float>(input.rows,input.cols));

edit retag close merge delete

the farthest point you can legally access is:

mapx.at<float>(input.rows-1,input.cols-1)


while

mapx.at<float>(input.rows,input.cols)


( 2016-07-15 05:16:44 -0600 )edit

my mistake... the point can be mapx.at<float>(input.rows/2,input.cols/2) and still give me the wrong value

( 2016-07-15 05:22:15 -0600 )edit

( 2016-07-15 05:32:18 -0600 )edit

This is the code for creating the maps. This is basically a barrell distortion mapping // clean the room mapx.release(); mapy.release();

// allocate the maps
mapx.create( imframe.size(), CV_32FC1 );
mapy.create( imframe.size(), CV_32FC1 );

// the image size
int w = imframe.cols;
int h = imframe.rows;

for (int y = 0; y < h; y++) {
int ty= y-Cy;
for (int x = 0; x < w; x++) {
int tx= x-Cx;
int rt= tx*tx+ty*ty;

mapx.at<float>(y,x) = (float)(tx*(1+kx*rt)+Cx);
}
}

for (int y = 0;y < h; y++) {
int ty= y-Cy;
for (int x = 0; x < w; x++) {
int tx= x-Cx;
int rt= tx*tx+ty*ty;

mapy.at<float>(y,x) = (float)(ty*(1+ky*rt)+Cy);
}
}

( 2016-07-15 05:35:30 -0600 )edit

So the mappings work on the whole imframe if I remap it. but if i draw a circle in the remaped image using the mapx.at<float>(imframe.rows/2,imframe.cols/2) it does not follow the remapped image

( 2016-07-15 05:38:00 -0600 )edit

Show the part where you use the maps. I don't entirely understand what you're doing with them.

( 2016-07-15 15:00:26 -0600 )edit

Hi, i need to do the same. Did you get any sucess to remap a single point or an array of points?

( 2018-01-19 12:25:16 -0600 )edit