imrotate make image blur. Any solution?

3 visualizaciones (últimos 30 días)
Kyle
Kyle el 5 de Jun. de 2011
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

Respuesta aceptada

Kyle
Kyle el 7 de Jun. de 2011
Thanks for the replies.
Does it means there are no way to preserve the pixel value after rotation?
  1 comentario
Walter Roberson
Walter Roberson el 7 de Jun. de 2011
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.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 5 de Jun. de 2011
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 comentario
Jan
Jan el 6 de Jun. de 2011
+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.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by