Reputation: 14022
I followed Panorama – Image Stitching in OpenCV to do same task on Android,by using openCV4Android
.My problem is in about warping image by founded homography matrix.I tested these images:
image1:
image2:
Result of warping image1 by founded homography is:
You can see that result is good warped but first part of that(left side) is cut! So stitching result was:
And result of above images in referenced link page,is:
Why warping by homography cut that?Or may be I did some things wrong?
Upvotes: 1
Views: 2175
Reputation: 14022
OK! Finally I could solve the problem.I saw this answer and understand what causes this problem and how I can solve that:
The problem occurs because the homography maps part of the image to negative x,y values which are outside the image area so cannot be plotted. what we wish to do is to offset the warped output by some number of pixels to 'shunt' the entire warped image into positive coordinates(and hence inside the image area)...So just premultiply your homography by a matrix similar to the above, and your output image will be offset.
Upvotes: 0
Reputation: 1927
Image 1 does not have any information about the rest of the scene. Since you're only applying the homography on image 1, it gets warped with respect to image 2 but doesn't really add any further scene information.
To get the resultant image you need, check the furthest x and y shift of image 1 after warping, and add this missing region along with stitching image 2. This isn't as simple as an addition, because the resultant image is larger, but it isn't too complicated either.
Upvotes: 1