Ask Your Question

Image transformation

asked 2012-11-27 08:15:14 -0600

Bomber19 gravatar image

updated 2012-11-28 06:41:28 -0600

SR gravatar image

Hello, I've got the following problem: I would like to transform an image (with scaling, rotation and sheering) and save the position of a pixel in the reference image and the transformed position of this pixel in the transformed image. How can I do this, when the transformation matrix is known and I work with Mat objects?

edit retag flag offensive close merge delete


Did you actually try anything?

SR gravatar imageSR ( 2012-11-27 09:17:17 -0600 )edit

I've already transformed the images but have no idea how i can figure out the change of the pixelposition. Normally i'm working with Matlab. There is a function is available for this. Do you have any idea how to do this?

Bomber19 gravatar imageBomber19 ( 2012-11-27 09:36:24 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-11-27 11:36:19 -0600

Ben gravatar image

Check this question to see how to use perspectiveTransform()

edit flag offensive delete link more


Thanks ;)

Bomber19 gravatar imageBomber19 ( 2012-11-28 03:12:33 -0600 )edit

answered 2012-11-27 15:23:40 -0600

SR gravatar image

updated 2012-11-27 16:55:50 -0600

Each pixel is a point (x, y). You simply apply the same transformation to this 2-D Point as to the image. Use transform() or perspectiveTransform() to perform this matrix-vector multiplication.

edit flag offensive delete link more

Question Tools


Asked: 2012-11-27 08:15:14 -0600

Seen: 549 times

Last updated: Nov 28 '12