Ask Your Question

Homography transformation + scale

asked 2018-03-21 03:55:47 -0600

lock042 gravatar image

I have a transformation between 2 images. I've computed the homography matrix. Applying this mastrix with warpPerspective works well.

Now, before to apply warpPerspective, I want to resize the image by a factor 2 (in x and y) with resize(in, out, out.size(), 0, 0, interpolation); So I need to update H if I want the transformation be alright. I thought that doing

resize(in, out, out.size(), 0, 0, OPENCV_NEAREST) --> scaling by 2
H02 * 2;
H12 * 2;
warpPespective(in, out, H, OPENCV_BILINEAR)

was enough, but apparently not.

Doing it in one pass would be easy:

H02 *= 2;
H12 *= 2;

H00 *= 2;
H01 *= 2;
H10 *= 2;
H11 *= 2;

warpPespective(in, out, H, OPENCV_NEAREST);

But I don't want it because I want a different interpolation algorithm between the scale and the warpPespective. How the H transformation should be to match what I want ?

edit retag flag offensive close merge delete



Hi, this link should be helpful

VxW gravatar imageVxW ( 2018-03-21 04:12:43 -0600 )edit

Oh gosh. This is exactly the same question. I'm so confused. Thank you, I will make some tests and will give you feedbacks. Thank you so much !!

lock042 gravatar imagelock042 ( 2018-03-21 04:39:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-03-21 16:07:07 -0600

lock042 gravatar image

Works great, many thanks.

edit flag offensive delete link more

Question Tools



Asked: 2018-03-21 03:55:47 -0600

Seen: 1,413 times

Last updated: Mar 21 '18