Failed on warp() #135
-
Hi again. I was trying to following the tutorials but using my own images. However, when I reach to the following steps from stitching.images import Images
img_handler = Images.of(images[10:13]) final_sizes = img_handler.get_scaled_img_sizes(Images.Resolution.FINAL)
camera_aspect = img_handler.get_ratio(Images.Resolution.MEDIUM, Images.Resolution.FINAL)
warped_final_imgs = list(warper.warp_images(final_imgs, cameras, camera_aspect))
warped_final_masks = list(warper.create_and_warp_masks(final_sizes, cameras, camera_aspect))
final_corners, final_sizes = warper.warp_rois(final_sizes, cameras, camera_aspect) I see an error message saying ---------------------------------------------------------------------------
error Traceback (most recent call last)
Cell In[15], line 4
1 final_sizes = img_handler.get_scaled_img_sizes(Images.Resolution.FINAL)
2 camera_aspect = img_handler.get_ratio(Images.Resolution.MEDIUM, Images.Resolution.FINAL)
----> 4 warped_final_imgs = list(warper.warp_images(final_imgs, cameras, camera_aspect))
5 warped_final_masks = list(warper.create_and_warp_masks(final_sizes, cameras, camera_aspect))
6 final_corners, final_sizes = warper.warp_rois(final_sizes, cameras, camera_aspect)
File [/opt/venv/lib/python3.9/site-packages/stitching/warper.py:41](https://vscode-remote+ssh-002dremote-002bcyhsu-002dwork-002ddev-002eokteto.vscode-resource.vscode-cdn.net/opt/venv/lib/python3.9/site-packages/stitching/warper.py:41), in Warper.warp_images(self, imgs, cameras, aspect)
39 def warp_images(self, imgs, cameras, aspect=1):
40 for img, camera in zip(imgs, cameras):
---> 41 yield self.warp_image(img, camera, aspect)
File [/opt/venv/lib/python3.9/site-packages/stitching/warper.py:45](https://vscode-remote+ssh-002dremote-002bcyhsu-002dwork-002ddev-002eokteto.vscode-resource.vscode-cdn.net/opt/venv/lib/python3.9/site-packages/stitching/warper.py:45), in Warper.warp_image(self, img, camera, aspect)
43 def warp_image(self, img, camera, aspect=1):
44 warper = cv.PyRotationWarper(self.warper_type, self.scale * aspect)
---> 45 _, warped_image = warper.warp(
46 img,
47 Warper.get_K(camera, aspect),
48 camera.R,
49 cv.INTER_LINEAR,
50 cv.BORDER_REFLECT,
51 )
52 return warped_image
error: OpenCV(4.8.0) [/io/opencv/modules/imgproc/src/imgwarp.cpp:1730](https://vscode-remote+ssh-002dremote-002bcyhsu-002dwork-002ddev-002eokteto.vscode-resource.vscode-cdn.net/io/opencv/modules/imgproc/src/imgwarp.cpp:1730): error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'remap' I am not really familiar with OpenCV and also the stitching package. Could someone here help me to figure out what the issue is, please? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
You should either share your input images or intermediate results so one could help you |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Have you tried the AffineStitcher? Your Images have no homographic relation |
Beta Was this translation helpful? Give feedback.
-
AffineStitcher works well. Thank you @lukasalexanderweber !!!! |
Beta Was this translation helpful? Give feedback.
-
On homography, all images are taken from the same spot: With affine stitching the images are just "merged" into a joint image plane. The best use case are scanners or perfectly aligned drone images: You could also try homography settings and use the |
Beta Was this translation helpful? Give feedback.
Have you tried the AffineStitcher? Your Images have no homographic relation