필터 지우기
필터 지우기

imrotate make image blur. Any solution?

조회 수: 2 (최근 30일)
Kyle
Kyle 2011년 6월 5일
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

채택된 답변

Kyle
Kyle 2011년 6월 7일
Thanks for the replies.
Does it means there are no way to preserve the pixel value after rotation?
  댓글 수: 1
Walter Roberson
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
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
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by