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.
question about imrotate function
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Image Analyst
am 29 Nov. 2013
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.
Akzeptierte Antwort
Image Analyst
am 29 Nov. 2013
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axes Transformations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!