Ask Your Question

stitching vertical images

asked 2014-06-14 08:05:44 -0600

damiannelus gravatar image

updated 2014-07-21 14:32:20 -0600

Hi, i'm trying to move further with my project of panorama stitching andoid app. Stitching horizontal images still need some improvements, but at the moment i'm satisfied. I got bigger problem with stitching vertical images (one above another).

Frome time to time it works fine: image description +

image description

image description

But more oftenly result image looks horrible: image description +

image description

image description

Can anyone give suggestions what i should check first? What might went wrong?

EDIT: Landscape scene examples image description +

image description

image description

EDIT: Another example. This time images were previously stitched and then i tried to make panorama putting one above the other. Results was completly wrong. image description + image description


image description


My problem, as stated above has been solved. Once again - big thanks to Harris. But there is another issue also connected to stitching vertical images. I guess it's better to continue my question here to get comprehensive problem answear.

I rotate two images (partial panoramas): first partial panorama second partial panorama.

Then I create object for result image:

size = com.googlecode.javacv.cpp.opencv_core.cvSize(640,480);
resultImage = com.googlecode.javacv.cpp.opencv_core.cvCreateImage(

Loaded images and resultImage are passed as arguments to Stitcher.stitch method:

status = stitcher.stitch(images, resultImage);

As a result i get below image: result image

It's not the rule. Sometimes this method generates good panoramas, but unfortunately not always. It seems there something with image ratio goes wrong. Can anyone give me a hint what should I change?

edit retag flag offensive close merge delete


Is the result similar when you stitch objects that are far away like landscape or city scene?

Witek gravatar imageWitek ( 2014-06-14 14:29:30 -0600 )edit

Landscape scenes are corrupted as well. I made four photos of my flat's surroundings and two of them was stitched correctly, but the other two was disappointing.

damiannelus gravatar imagedamiannelus ( 2014-06-15 03:33:41 -0600 )edit

What was the distance do your nearest flat's surroundings? If camera motion is not purely rotational and objects are too close, stitching results may be corrupt.

Witek gravatar imageWitek ( 2014-06-15 04:24:00 -0600 )edit

I added examples of another scene. Building you can see was photographed aproximately 25 m. from camera.

damiannelus gravatar imagedamiannelus ( 2014-06-15 05:01:24 -0600 )edit

Try the next sequence WITHOUT shooting the wall of your balcony and make sure the motion of the camera is PURELY ROTATIONAL. Let's see if it is going to help.

Witek gravatar imageWitek ( 2014-06-16 16:17:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-16 23:27:48 -0600

Haris gravatar image

updated 2014-06-17 02:52:31 -0600

As the horizontal stitching gives satisfactory result, you can try that way, like

  • Rotate both input image by 90 degree.
  • Perform stitching.
  • Finally rotate back the result.

See the result I got with the above, here I rotated image manually, you can use transpose or warpAffine to rotate the image.

image description

image description

image description

edit flag offensive delete link more


Haris, it's tricky way. Maybe it doesn't sounds like solution, but definitely it is workaround. Thanks a lot! As far as i'm not able to test it now (some problems with device which i hope to manage in two days) could you tell me if you got same distortion as me without rotating images

damiannelus gravatar imagedamiannelus ( 2014-06-17 14:10:48 -0600 )edit

Yes, without rotating I got the same result as you posted above.....

Haris gravatar imageHaris ( 2014-06-17 21:57:02 -0600 )edit

Ok, so as far as it works I assume it's my last question. I create destination image with reversed dimension of source image (height -> width; width -> height). Then I rotate source image by 90 degree and center in the center of source image. The problem is that destination picutre area doesn't match to rotated picture. Is there any other possibility than creating bigger destination image and then cropping?

damiannelus gravatar imagedamiannelus ( 2014-06-22 08:27:59 -0600 )edit

If your are using transpose no need to allocate for destination Mat, the output image size will allocate automatically but it just transpose the Mat in one direction say +90, and if you need to rotate on opposite direction say -90, then first flip the source and apply transpose. And in the case of affine transform see the answer here might be helpful.

Haris gravatar imageHaris ( 2014-06-22 10:01:29 -0600 )edit

Try stitching with flag --wave_correct no.

Lexanni gravatar imageLexanni ( 2019-04-03 01:28:25 -0600 )edit

Question Tools

1 follower


Asked: 2014-06-14 08:05:44 -0600

Seen: 5,036 times

Last updated: Jul 21 '14