Image rotate

14 visualizaciones (últimos 30 días)
Dipak
Dipak el 23 de Jun. de 2011
Respondida: DGM el 30 de Dic. de 2023
Can I have rotate image with white background
By default if we use imrotate it rotate image with black background can I have rotated image with white background?

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 23 de Jun. de 2011
Irot = imrotate(I,theta);
Mrot = ~imrotate(true(size(I)),theta);
Irot(Mrot&~imclearborder(Mrot)) = 255;
%View 'er
imtool(Irot)
Edited to be more robust/simpler
  4 comentarios
Leo Wong
Leo Wong el 5 de Sept. de 2018
You are a genius Sean. Your code was the missing piece to complete my project :)
Ali RAHIMI KHOJASTEH
Ali RAHIMI KHOJASTEH el 1 de Abr. de 2021
Thank you, it works for me

Iniciar sesión para comentar.

Más respuestas (2)

Walter Roberson
Walter Roberson el 23 de Jun. de 2011
imrotate() always fills with 0.
If your image is floating point, then one way to proceed would be to put a border of NaN around your image, and rotate that. The resulting image should have NaN in it; set the NaN and everything outside to the background color you want.
  1 comentario
Dipak
Dipak el 24 de Jun. de 2011
Thanks Walter For the reply.
Thank you.

Iniciar sesión para comentar.


DGM
DGM el 30 de Dic. de 2023

Categorías

Más información sobre Image Processing and Computer Vision en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by