【发布时间】:2015-09-07 08:33:54
【问题描述】:
如何用原始图像的背景在图像的旋转部分填充黑色?请注意,图像仅在位移非常小的情况下在侧面被剪切。原始图像和转换图像的大小相同。
这是我尝试过的。任何人都可以提出更好的方法吗? MATLAB代码及对应结果:
A=imread('cameraman.tif');
tform=affine2d([1 0 0 ; 0.05 1 0 ; 0 0 1]);
J=imwarp(A, tform, 'OutputView',imref2d(size(A)));
subplot(1,3,1)
imshow(A),title('Original Image');
subplot(1,3,2)
imshow(J),title('Rotated Image');
zeropixels = J == 0;
J(zeropixels) = A(zeropixels);
subplot(1,3,3)
imshow(J),title('Correct Image');
【问题讨论】:
-
@lxer:我正在尝试[像这样] (stackoverflow.com/questions/7742601/…)
标签: matlab image-processing image-rotation