0

I want to take a sub-image from a bigger image, but I have the 4 corners of the image and I want to get the resulting image, independently of the orientation it may have.

Is there a Matlab function to make this? I can't seem to find one.

There is a similar question for opencv and python, check for more clarity-> How to straighten a rotated rectangle area of an image using opencv in python?

Community
  • 1
  • 1
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120

1 Answers1

0

you can programmatically select a rectangle using impoly or similar, then obtain the angle and use imrotate to align the subimage.

bla
  • 25,846
  • 10
  • 70
  • 101
  • thats nice, but I need to do it programaticaly, the corners are extracted with other functions before. – Ander Biguri May 02 '13 at 09:26
  • I don't understand the problem with this answer. If you have the corners then you already know what the angle is, right? – Dennis Jaheruddin May 03 '13 at 09:09
  • yes I agree... Also, if the corners aren't creating a rotated rectangle but some trapezoid then the rotation angle is not well defined. So one needs to take the mean value of the angles etc... – bla May 03 '13 at 09:12
  • @DennisJaheruddin and naten. Yeah, I was a little big vague in my question sorry. My problem is that the points are not creating a perfect square. Still this question is directly related to this one: http://stackoverflow.com/questions/16342164/how-to-plot-a-surface-with-a-texture-map . So If you want to continue with the topic, the answer to the trapezoids may help you get 50 reputation :D – Ander Biguri May 07 '13 at 13:14