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

  • Topic: MATLAB 
  • Thread starter Thread starter eddiethegreat
  • Start date Start date
  • Tags Tags
    Image Matlab Rotating
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
1 reply · 6K views
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