我想围绕中心旋转图像。我使用了transformPointForward函数来完成此操作。我想获取更改后图像的四个角的坐标。在下面,您可以看到我的代码。感谢您的帮助。< / p>
theta=+50;
tform = affine2d([cosd(theta) -sind(theta) 0;sind(theta) cosd(theta) 0; 0 0
1]);
A = imread('pout.tif');
corners = [1,1;1,size(A,2);size(A,1),1;size(A,1),size(A,2)];
X = transformPointsForward(tform,corners);
Rin = imref2d(size(A))
Rin.XWorldLimits = Rin.XWorldLimits-mean(Rin.XWorldLimits);
Rin.YWorldLimits = Rin.YWorldLimits-mean(Rin.YWorldLimits);
[out,ref] = imwarp(A,Rin,tform);
figure,
subplot(1,2,1),imshow(A,[])
subplot(1,2,2),imshow(out,[])
X(:,1) = X(:,1) - ref.XWorldLimits(1);
X(:,2) = X(:,2) - ref.YWorldLimits(1);