How can i slip and rotate a color image?
Afficher commentaires plus anciens
Hi,how can i slip and rotate the color image img like the binary image bw?
I=imread('image.jpg'); %color image
bw=segmentation(I); % the result is a binary image where the object detected (ROI) is white
img = bsxfun(@times, I, cast(bw,class(I)));
phy = regionprops(bw, 'Orientation')
[barx,bary]=barycentre(edge);
% slip the region to the center of the image
edge = recentre(edge,barx,bary);
I2 = recentre(bw,barx,bary);
phy1=phy.Orientation;
edge=imrotate(edge,-phy,'loose');
I3=imrotate(I2,-phy,'loose');
thanks
4 commentaires
Carole
le 28 Nov 2012
Sean de Wolski
le 28 Nov 2012
Why isn't imrotate working for you?
For more fancy transformations, look into imtransform.
Carole
le 28 Nov 2012
yagnesh
le 29 Nov 2012
use imrotate after separating rgb planes and after that combine those 3 planes
Réponse acceptée
Plus de réponses (1)
Sean de Wolski
le 28 Nov 2012
imrotate can rotate color images just fine:
imshow(imrotate(imread('peppers.png'),42,'crop'))
2 commentaires
Carole
le 29 Nov 2012
Image Analyst
le 30 Nov 2012
Sean, you also have imtranslate: http://www.mathworks.com/matlabcentral/fileexchange/27251-imtranslate
Catégories
En savoir plus sur Read, Write, and Modify Image dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!