필터 지우기
필터 지우기

question about imrotate function

조회 수: 1 (최근 30일)
UTA
UTA 2013년 11월 29일
댓글: UTA 2013년 11월 29일
When I use imrotate function to rotate a binary image which only has a single pixel with value of one, the rotate function I use as follow:
fimage = zeros(480,640);
fimage(140,396) = 1;
if 5.2668 < 90
fimage = imrotate(fimage, 5.2668,'crop');
elseif 5.2668 > 90
fimage = imrotate(fimage, 5.2668, 'crop');
end
where fimage is the image with size of 480*640 and with all value zero expect that single pixel, and the single value one pixel with the position of [140 396], however, the after rotating , I can not find that single value any more, which means the whole image becomes zero value. It seems that the rotate angle is not too large to make that value one pixel out of boundary, also that pixel almost lies in the center of the image, so it mean it should not be out of boundary and corp by that function. Can anyone help me on this?*
Thanks so much ahead.
  댓글 수: 2
UTA
UTA 2013년 11월 29일
it is very wired, I test many ange value from 1.2558 to 8.2668, only some value around 5.2668 can not show the rotate pixel.
Image Analyst
Image Analyst 2013년 11월 29일
Like I tried to explain to you below, it depends on how close the input pixel is to its rotated position. If it's close, and the value would be more than 0.5 it rounds it up and you'll see it.

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

채택된 답변

Image Analyst
Image Analyst 2013년 11월 29일
There is no pixel at the center of an image that has an even number of rows or columns. Thus your pixel landed at some place in between 4 pixels. When averaged with the 3 other black pixels (to create the output pixel), your pixel ended up being less than 1. They 4 corners averaged 0.25 and since your output is binary, it rounded down to 0 and disappeared. You can make it grayscale if you want to keep it.
  댓글 수: 2
Image Analyst
Image Analyst 2013년 11월 29일
Try using the 'nearest' option to prevent anti-aliasing and rounding.
UTA
UTA 2013년 11월 29일
thank you, it's helpful.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axes Transformations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by