How to fill black color in a rotated portion of an image with background of original image? Note that, image gets sheared on sides only with very small displacement. The size of original and transformed image is same.
This is what i have tried. Can anyone suggest a better approach? The MATLAB code and and corresponding results:
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');