I would like to rotate an object in an image in Matlab. I'm trying this code:
I = imread('MPE.jpg');
imagesc(I);
theta=90
tform = affine2d([cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1]);
J = imwarp(I,tform);
h=imagesc(J);
end
I would like to rotate an object in an image in Matlab. I'm trying this code:
I = imread('MPE.jpg');
imagesc(I);
theta=90
tform = affine2d([cosd(theta) -sind(theta) 0; sind(theta) cosd(theta) 0; 0 0 1]);
J = imwarp(I,tform);
h=imagesc(J);
end
One technique could be to have bounding box (BB) to red and green contours. Resize red BB to green BB with imresize(). Then, you can easily rotate resized portion to the desired angle by using imrotate().