rotate image

Dear all,
Let say I have patch P and I want to rotate it in the direction of angle T (in degrees). Rotation should be similar to This rather This.
Rotation should be in plane, not like
imrotate(P, T)

Réponses (2)

Jan
Jan le 2 Mar 2012

0 votes

What is the difference between the two shown picture sets? Are you looking for the 'crop' method?
B = imrotate(P, T, 'nearest', 'crop')

4 commentaires

Junaid
Junaid le 2 Mar 2012
Thanks but still there is black region. though many black region is cropped, but still it is not exactly as shown in Figure 1. ??
Jan
Jan le 2 Mar 2012
So I'm asking again: What is the difference between the two sets of pictures? How did you exactly transform the one set to create the other?
Junaid
Junaid le 4 Mar 2012
Hi Jan Simon,
Thanks for your reply. Actually I want to rotate the patch in the direction of dominant gradient (similar to SIFT). As when it is rotated in the direction of 45 degree then we see many blank part. But in image when image is rotated such that there is no blank space. Either it is in plane rotation or pixel by pixel rotation. How could I rotate like that ?
Jan
Jan le 4 Mar 2012
I do not understand. It is still not clear, what you want to achieve and what is the difference between the two posted pictures. Why is the result of "imrotate('crop')" not satisfying?

Connectez-vous pour commenter.

Image Analyst
Image Analyst le 2 Mar 2012

0 votes

Junaid, there is additional information that is not being shown. Even the 0 degree image was cropped out of a larger image. How do I know that? Well look at the "good" 45 degree rotation. Do you see that black and white "ball" structure in the upper left corner? Well, it was not there at all in the zero degree image. That means it "got rotated in" from some region unseen (i.e. outside) the zero degree image. To get this "good" image, you'll have to start with the full image.

6 commentaires

Junaid
Junaid le 3 Mar 2012
Thank you sir,
Could you please help me in this. Let say I have image I, with center x,y and radius R. Now I want to rotate only this point with given Radius?
Image Analyst
Image Analyst le 3 Mar 2012
What do you mean by "rotate only this point"? Not the whole image???? Rotating only a point won't show any effect. A pixel is just a point - it won't look any different if it's rotated. If you want to rotate the whole image around that point, use imrotate like suggested, but it won't "make up" data to fill in missing areas (like that ball structure that I mentioned) - how could it possibly do that?
Jan
Jan le 4 Mar 2012
@Junaid: You can give us a chance to create a sufficient answer, if you answer our questions. Currently your problem is not clear enough.
Junaid
Junaid le 4 Mar 2012
Hi Jan Simon, Thanks for kind reply. I have tried to explain my problem again under your reply.
Junaid
Junaid le 4 Mar 2012
Hi Image Analyst,
I mean to rotate a small patch in image such that there is no blank space when image is rotate. As using imrotate function there remains blank space as shown in Figures.
or there is any other way to rotate patch in dominant gradient (similarly like SIFT).
Image Analyst
Image Analyst le 4 Mar 2012
That's impossible. As you rotate a rectangle, if it's going to be on a rectangular canvass, then there will be some area that was previously not shown. Something has to be there, usually a uniform gray level such as black. The only other option would be to crop such that no black appears but you'd be cutting off some of your image. Like I said the way that your web site did it was to rotate a larger image and then crop down.

Connectez-vous pour commenter.

Question posée :

le 2 Mar 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by