Skip to content

Affine Stitching works on horizontal alignment but fails with the same images on vertical alignment  #125

@mcranium

Description

@mcranium

Dear developers,

thank you for this very useful tool! I will definitively use it a lot for my projects.

I just ran into an issue when trying to assemble an affine panorama that is not horizontal but vertical (i.e. the numebr of rows is bigger than the number of columns). This can be reproduced with the following images.

horizontal_left
horizontal_mid
horizontal_right

The horizontal panorama worksusing this command:

stitch --affine --detector sift *.png

vertical_lower
vertical_mid
vertical_upper

With the same images rotated 90 degrees I get the following error message after a long computation time:

stitching vertical_lower.png vertical_mid.png vertical_upper.png into result.jpg
Traceback (most recent call last):
  File "/home/mario/.local/bin/stitch", line 8, in <module>
    sys.exit(main())
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/cli/stitch.py", line 278, in main
    panorama = stitcher.stitch(img_names)
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/stitcher.py", line 117, in stitch
    self.blend_images(imgs, seam_masks, corners)
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/stitcher.py", line 230, in blend_images
    for idx, (img, mask, corner) in enumerate(zip(imgs, masks, corners)):
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/stitcher.py", line 202, in compensate_exposure_errors
    for idx, (corner, img) in enumerate(zip(corners, imgs)):
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/cropper.py", line 66, in crop_images
    for idx, img in enumerate(imgs):
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/warper.py", line 41, in warp_images
    yield self.warp_image(img, camera, aspect)
  File "/home/mario/.local/lib/python3.8/site-packages/stitching/warper.py", line 45, in warp_image
    _, warped_image = warper.warp(
cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/imgwarp.cpp:1724: error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'remap'

I think it would be great if this inconvenience could be solved, maybe even in a way that would allow the program to rotate all images in steps of 90 degrees, if doing so without fails.

Best wishes,
Mario

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs investigationCollect and attach more details (build flags, stacktraces, input dumps, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions