Perspective transform a Point not an Image

3 views (last 30 days)
Hello,
I have four points I measured in an Image. In reality they are the corners of a rectangle.
ImagePoints = [x1 y1;x2 y2;x3 y3;x4 y4]
RealPoints = [0 0;100 0;0 60;100 60]
I measure another point lying in this rectangle. I need the real koordinates of this Point (in the rectangle).
ImageMeasurePoint = [x y]; <= I have this.
RealMeasurePoint = [x y]; <= I want this.
I don't want to transform the whole image. I just want to calculate the RealMeasurePoint. Is there a function I can use?
Can you help me.
Thanks Timo

Accepted Answer

Teja Muppirala
Teja Muppirala on 19 Apr 2011
If you have the Image Processing Toolbox, using cp2tform and tformfwd makes this very easy, and will work even when ImagePoints is not a perfectly straight rectangle:
ImagePoints = [10 10; 110 10; 10 310; 110 310];
RealPoints = [0 0;100 0;0 60;100 60];
T = cp2tform(ImagePoints,RealPoints,'projective')
ImageMeasurePoint = [60 160];
RealMeasurePoint = tformfwd(T,ImageMeasurePoint)

More Answers (1)

Timo
Timo on 19 Apr 2011
Hall Teja!
Your my hero! Thanks a lot! Thumbs up! I'm happy now!
Wish you a nice day! You deserve it.
Thanks Timo

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!