0

I have a picture in which I'm looking for a rectangle (dotted in the picture below). This rectangle might, however, be rotated. Once I found that rectangle, I extract and, if necessary, rotate it so that it is properly aligned. I then try to locate a given point within that rotated rectangle (the X in the picture below, let's say it is at position (100/20)).

How do I now calculate the position of that point in terms of the original picture (e.g. (120/25))?

|----------------------------------------------------------|
|                                    `......` -            |
|                            `......`         .`           |
|                    `......`             X    -           |
|            `....````                         ..          |
|    `....````                                  -          |
|  -``                                          `.         |
|  ..                                            -         |
|   -                                            `-        |
|   `.                                            -`       |
|    -                                             -       |
|    `-                                            -`      |
|     -                                             -      |
|     `-                                            -`     |
|      -`                                   ````...```     |
|       -                           ````....```            |
|       .`                  ````....```                    |
|        -          ````....`                              |
|        ..  ```....`                                      |
|         ..`                                              |
|                                                          |
|                                                          |
|                                                          |
|----------------------------------------------------------|
Max
  • 1
  • 2
  • Just invert the transformation that you used to align the rectangle. If you represent it as a matrix, it is literally the matrix' inverse. – Nico Schertler Sep 27 '16 at 13:09
  • 2
    Thank you very much, your answer also pointed me to the solution in OpenCV: http://stackoverflow.com/questions/6864994/rotating-back-points-from-a-rotated-image-in-opencv – Max Sep 27 '16 at 14:34

0 Answers0