Rotate Image segment without background
8 ビュー (過去 30 日間)
古いコメントを表示
I want to rotate image like this
I have rotated Image but I have got image like this in matlab
How to fix this problem in matlab Actually I want only rotate leaf part only not whole image. Is it posibble
4 件のコメント
採用された回答
Gopichandh Danala
2016 年 9 月 16 日
A simple trick is to change all the pixels other than the segment to a white background in your case.
I cropped your main image as u didn't post original image
and sample code is here:
leaf = imread('leaf.jpg');
figure, imshow(leaf, []);
rotateImg = imrotate(leaf,45,'crop'); % rotate by 45 or 315 degrees
figure, %imshow(rotateImg);
subplot(1,2,1)
imshow(rotateImg, [min(min(rotateImg(:))) max(max(rotateImg(:)))]);
newrotateImg = rotateImg;
newrotateImg(newrotateImg == 0) = 255; % make all 0 pixels to 255..
subplot(1,2,2)
imshow(newrotateImg, [min(min(newrotateImg(:))) max(max(newrotateImg(:)))]);
Hope it helps.
12 件のコメント
Busy Bee
2018 年 2 月 10 日
what if the image segment that I want to rotate is itself made of black pixels?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で 3-D Volumetric Image Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!