Imrotate help - black pixel border remains despite changing the colour of the background?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Moriah Stendel
el 11 de Nov. de 2016
Respondida: DGM
el 30 de Dic. de 2023
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 comentarios
Respuesta aceptada
Más respuestas (1)
DGM
el 30 de Dic. de 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 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!