无法拼接图像

发布于 2025-01-18 14:28:32 字数 529 浏览 2 评论 0原文

我无法拼接图像,这是我的代码:

import cv2

stitcher = cv2.Stitcher_create(mode = 0)
foo = cv2.imread("./foo.png")
bar = cv2.imread("./bar.png")
result = stitcher.stitch(foo,bar)

cv2.imwrite("./result.jpg", result[1])

两个图像:

  • foo.png
  • < a href="https://i.sstatic.net/XTpyu.png" rel="nofollow noreferrer">bar.png

我得到的结果: 结果

I'm unable to stitch images, this is my code:

import cv2

stitcher = cv2.Stitcher_create(mode = 0)
foo = cv2.imread("./foo.png")
bar = cv2.imread("./bar.png")
result = stitcher.stitch(foo,bar)

cv2.imwrite("./result.jpg", result[1])

Both images:

The result i get: result

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流云如水 2025-01-25 14:28:33

stitcher.stitch 接收要拼接在一起的图像列表。将代码更改为:

result = stitcher.stitch([foo,bar])

此外,OpenCV 无法拼接两个图像,因为它无法找到足够数量的关键点。尝试使用其他图像。

stitcher.stitch takes in a list of images that are to be stitched together. Change the code to:

result = stitcher.stitch([foo,bar])

Also, OpenCV is not able to stitch your two images as it is not able to find a sufficient number of keypoints. Try using other images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文