Imrotate help - black pixel border remains despite changing the colour of the background?
7 views (last 30 days)
Show older comments
Hello,
With the imrotate function, the negative space of the image is automatically replaced with black. My attached script works great and changes this to the colour I need -- grey. However, if the rotation is not along a right angle, a tiny border of black pixels remains (see attached image). Please tell me there is a way to remove them?
Thanks in advance for your help.
RGB = imread('wheel_final.jpg');
rotationdegree = randi(360);
RGB_Rotated = imrotate(RGB,rotationdegree,'bilinear','crop');
Mrot = ~imrotate(true(size(RGB)), rotationdegree,'bilinear','crop');
RGB_Rotated(Mrot&~imclearborder(Mrot))=150;
imtool(RGB_Rotated);
0 Comments
Accepted Answer
More Answers (1)
DGM
on 30 Dec 2023
This answer covers mulptile approaches to controlling the padding color, and the halo left by simple workarounds is addressed without needing to resort to sacrificing interpolation.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!