The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Imrotate matrix size change
Replies: 2   Last Post: Dec 11, 2012 2:30 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2
Registered: 12/11/12
Imrotate matrix size change
Posted: Dec 11, 2012 2:02 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi All,

Does anyone know how imrotate does the size change exactly? I assumed it was based on pythagorean geometry but when I plot the actual matrix size change compared to my "predicted" size change the imrotate function is clearly using some other cut offs as well because the size change is always in intervals of 4 (step function style).

Here is the tests i've been doing to see how the side differs with just a simple square:

O = ones(1,50);
sq1 = [ O; O ; O; O; O; O; O; O; O; O];
sq11 = [sq1; sq1; sq1; sq1; sq1];

sz = [];

[~,xx] = size(sq11);

for i = 1:360 %test how the size changes with angle

eval(['t',int2str(i),' = imrotate(sq11,',int2str(i),');'])

eval(['[x,y] = size(t',int2str(i),');' ])

eval(['c',int2str(i),' = ceil(xx*cos(',int2str(i),'*pi/180))+ceil(xx*sin(',int2str(i),'*pi/180));'])

eval(['sz = [sz; x y c',int2str(i),']; ' ])
plot(sz) % where x&y in this example are always the same because i'm testing a square and c_i is the dimension of the square using the trig i thought matlab should be using.

Ultimately i want to be able predict how matlab adds this zero pad so that i can effectively remove it later. I am aware of the "crop" functionality, however, I need the full matrix (plus zeros) to perform a convolution on the rotated matrix and then I want to be able to get back the original size after rotating back to the original matrix orientation.

Thanks to anyone who has an insight into this!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.