Reversing or 'unwarping' an image from imwarp. Result not as expected?

9 views (last 30 days)
I have, for example, A, the first image a black rectangle with a white border. I warp it using A_warped = imwarp(A, tform) and i get the second image. Suppose I want to return to the original image by warping it. Why is the result not the original image, if I use, for example, imwarp(A_warped, invert(tform))? Instead the result is the third image. I suppose it may have something to do with the black added around the outside of the warped image.
  3 Comments
Image Analyst
Image Analyst on 13 Sep 2017
Give us code and image to reproduce the images if you still need help.
ilay
ilay on 18 Dec 2017
I have the same problem. Did you maybe find a solution? Here is my example:

Sign in to comment.

Answers (1)

René Heijdens
René Heijdens on 5 Apr 2018
Edited: René Heijdens on 5 Apr 2018
Hi all! I have been struggling with the same problem for a while. I have to place a virtual banner next to the field, so the image is transformed for a square field. Unfortunately, the inverse of the transform matrix does not give the proper results.
This is the first (correct) transformation.
This is the resulting inverse transformation
The code which generated these images are shown below.
rgbImage = imread('tennismatch.jpg');
load('cornerPoints.mat');
% tennisfield size
p2 = [ 1 1; 1098 1; 1 2378; 1098 2378];
% calculating the transformtion matrix and corresponding inverse
tform = fitgeotrans(p, p2, 'projective');
invtform = invert(tform);
% generating the transformed images
imWarp = imwarp(rgbImage,tform);
figure(); imshow(imWarp);
imWarp = imwarp(imWarp,invtform);
figure(); imshow(imWarp);
Is anyone familiar with this problem or has some tips which might help, that would be great! Any help would be greatly appreciated.
Thanks in advance.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!