I'm having a "trigonometric" issue. I have as input an image that contains a skewed rectangle. The image is like a bounding box of the rectangle. like this:
0,0
|""""/\"""""|
| / \ |
| / \ |
| / /|
|/ / |
|\ / |
| \ / |
| \ / |
""""""""""" w,h
When I rotate it over the center, I have a rectangle inside an image, like this:
0,0
|"""""""""""|
| ------- |
| | | |
| | | |
| | | |
| | | |
| | | |
| ------- |
""""""""""" w,h
The rectangle is centralized (my ascii art wasn't really precize). What I want is the coordinates (width and height) of the rectangle I've deskewed, so I could crop the borders out.
Summarizing, the information I have:
- Image width and height (the skewed rectangle's bounding box is the size of the image)
- The skew angle
What I want:
- Rectangle Width and Height
It should be easy to do, since we would just need to isolate width and height in a system of equations. However, when I test my solution, I get errors.
Could you help me?