Image rotate
1 回表示 (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
採用された回答
Sean de Wolski
2011 年 6 月 23 日
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 件のコメント
Leo Wong
2018 年 9 月 5 日
You are a genius Sean. Your code was the missing piece to complete my project :)
その他の回答 (2 件)
Walter Roberson
2011 年 6 月 23 日
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!