필터 지우기
필터 지우기

Perspective transform a Point not an Image

조회 수: 3 (최근 30일)
Timo
Timo 2011년 4월 19일
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

채택된 답변

Teja Muppirala
Teja Muppirala 2011년 4월 19일
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)

추가 답변 (1개)

Timo
Timo 2011년 4월 19일
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!

Translated by