How to find the location of transformed points after imwarp? (transforming isosceles trapezoid to rectangle)

10 visualizaciones (últimos 30 días)
I am trying to use a projective transformation to turn an isosceles trapezoid into a rectangle, and after the transformation, I'm left with excess regions and I'm stuck trying to crop out the rectangle I want. imwarp doesn't allow me to see where those vertices by which I defined my transformation went using fitgeotrans , so I don't know what vertices to put for imcrop . Below is an example.
I know the pixel size of the final picture I want, and the excess region lies outside of that pixel area so I just want to crop it out. Since the trapezoid is isosceles, I can crop it in the x-direction just by math, but the y-direction is stretched, and in my application could be stretched in many ways due to different trapezoid shapes. I'm not sure how to get those y-coordinates. Any ideas?

Respuesta aceptada

Wen
Wen el 14 de Jun. de 2014
transform = cp2tform(movingPoints, fixedPoints, 'projective');
displayImage = imtransform(roi, transform, 'xData', [1 l], 'yData', [1 w], 'xyScale', [1 1]);
I used the not recommended functions as in here, it seems imwarp doesn't allow bounds to be specified: http://www.mathworks.com/matlabcentral/answers/69442-stretch-quadrilateral-roi-to-pre-definded-rectangle-size

Más respuestas (0)

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by