imrotate make image blur. Any solution?
3 次查看(过去 30 天)
显示 更早的评论
I = imread('cameraman.tif');
L = imrotate(I,50);
M= imrotate(L,-50);
imshow(M)
x_corr = normxcorr2(I,M);
[max_c, imax] = max(abs(x_corr(:)))
I tested with above code to see the effect of imrotate had on image. The result if the correlation was 0.94, less than what i expected and the image M was blur.
Any way to rotate the image without effecting its pixel value?
Thanks
0 个评论
采纳的回答
Kyle
2011-6-7
1 个评论
Walter Roberson
2011-6-7
In order to preserve pixel values, your rotated picture would have to contain the same number of lit pixels as the original picture, and you would have to come up with a one-to-one and "onto" mapping of the pixels that worked for any rotation angle. This is not necessarily impossible, but the variations that I can think of at the moment have the effect of having pictures that are not aligned with the axes be non-square.
I suggest you start with a simple case: rotate a single-width line from the axes to 45 degrees. Which pixels would you choose to light in the rotated image? What is the distance from the origin of rotation to the edge of the lit area? Were you able to come up with a fixed pixel mapping that pretty much preserved linear distances? Okay, now extend this to a line of width two being rotated to 45 degrees and see if you find that the choices you made for where to put the pixels for the first line clash with where the pixels would go for the second line.
更多回答(1 个)
Walter Roberson
2011-6-5
No, the closest you can get to rotating an image without affecting its pixel value is to use a hgtransform -- which will affect the pixels of the displayed image but not the values that are stored in the CData property of the image. The observed image will have blur either way. This is inherent in the representation of data as finite sized non-circular pixels.
1 个评论
Jan
2011-6-6
+1. The blur is a result of the rotation of a data, which are discretized in rectangles (pixels here). Imagine a 2x2 pixel image: a rotated image *must* be blurred, of course.
You can reduce the effects by increasing the resolution before rotating and decreasing it afterwards again - this is an anti-aliasing method and the Lanczos3 method might be "nice". But unfortunately this will produce other artifacts.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!