How can I find the maximum dimension of a rotated image in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter eddiethegreat
  • Start date Start date
  • Tags Tags
    Image Matlab Rotating
Click For Summary
SUMMARY

The discussion centers on finding the maximum dimensions of a rotated image in MATLAB. The original poster (OP) attempts to calculate the maximum size of a rectangle when rotated using the Pythagorean theorem, suggesting that the maximum dimension occurs at a 45-degree rotation. However, a more accurate approach is proposed, indicating that for a rectangle with dimensions 'a' and 'b', where 'b' is greater than 'a', the maximum dimension can be determined by considering the square with side 'b', which can contain the rectangle at any rotation angle.

PREREQUISITES
  • Understanding of MATLAB image processing functions
  • Knowledge of geometric properties of rectangles and squares
  • Familiarity with the Pythagorean theorem
  • Basic concepts of rotation in 2D space
NEXT STEPS
  • Research MATLAB functions for image rotation and manipulation
  • Study geometric transformations in 2D space
  • Explore the implications of rotation on bounding boxes of shapes
  • Learn about the use of the 'regionprops' function in MATLAB for image analysis
USEFUL FOR

This discussion is beneficial for MATLAB users, image processing enthusiasts, and anyone interested in geometric transformations and their applications in computer vision.

eddiethegreat
Messages
1
Reaction score
0
Hi,

I am working on a MATLAB assignment and I stuck in rotating image,
I got a code that allocates starting and ending points in matrix I got, works with no difficulties. (which means this code allows me to ignore the white(255) points and get he actual size of image, that is a rectangle or a square)

My problem is I needed to find maximum dimension of this picture when rotated, so that I will expand all of my rotations to maximum rotation size. I can't obtain that so simply.

I got a solution (probably incorrect) which is:

think that the image I got is a rectangle with width:a, length:b,
when I rotate to 45degrees I get the maximum size, so that with simple Pythagorean theorem we can say that one side comes from a is a*sqrt(2) and other is b*sqrt(2), then maximum size of my image when rotated should be a square, with one side equals to (a+b)*sqrt(2), which gives an incorrect result.

Can you help me out?
 
Physics news on Phys.org
Probably of no help to the OP, but I would take a different approach. The idea that you get the largest containing rectangle if the original rectangle is rotated 45° is reasonable if the original figure is a square, but it isn't reasonable if the figure is a rectangle. In that case, if a and b are the dimensions of the rectangle, and b > a, then a square with side b would be able to contain the rectangle if it's rotated by any amount.
 
  • Like
Likes   Reactions: Wrichik Basu

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K