I have an image of a quadrilateral (the image is of a rectangle, but in an unknown perspective). Assume it looks something like this:
Also, assume I've found the coordinates for the quadrilateral's corners (hence the black arrows, which are NOT part of the actual image).
What I want is, given the 4 corners' coordinates, to take only the quadrilateral and project it to a rectangle of a given size (say, height h and width w).
Meaning, the result should be:
I've tried several things (like imwarp, for example) but can't get the result I'm looking for.
How do I go about making this in MARLAB?
EDIT: I should mention that thus far, using MATLAB's fitgoetrans
and imwarp
transformed the image, but didn't create a new image containing just the shape.