在 Linux 上使用 OpenCV 2.2 和 Python 捕获图像(Fedora 15 Beta)

发布于 2024-11-04 03:38:08 字数 778 浏览 5 评论 0原文

我有下面的代码;

import cv
import time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

while True:
    img = cv.QueryFrame(capture)
    cv.ShowImage("camera", img)
    if cv.WaitKey(10) == 27:
    break

上面的代码是OpenCV-2.2自带的Python的CAM捕获脚本。所以我知道这个程序没有任何问题。我可以将我的摄像头与 Linux 上的不同应用程序一起使用,例如名为 Cheese 的程序。但是,当我编译该程序时,出现以下错误;

(camera:2519): GStreamer-CRITICAL **: gst_debug_add_log_function: assertion `func != NULL' failed

(gst-plugin-scanner:2521): GStreamer-WARNING **: Failed to load plugin '/usr/lib64/gstreamer-0.10/libgstbcmdec.so': /usr/lib64/gstreamer-0.10/libgstbcmdec.so: undefined symbol: gst_video_format_new_caps

我猜测 GStreamer 有问题。有办法解决这个问题吗?还是OpenCV-2.2本身有问题?或者示例脚本可能有问题?

感谢您抽出时间。

I have the code below ;

import cv
import time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

while True:
    img = cv.QueryFrame(capture)
    cv.ShowImage("camera", img)
    if cv.WaitKey(10) == 27:
    break

The above code is OpenCV-2.2's own CAM capture script for Python. So I know nothing is wrong with the program. And I can use my cam with different applications on Linux like the program called Cheese. However when I compile this program I get an error as below;

(camera:2519): GStreamer-CRITICAL **: gst_debug_add_log_function: assertion `func != NULL' failed

(gst-plugin-scanner:2521): GStreamer-WARNING **: Failed to load plugin '/usr/lib64/gstreamer-0.10/libgstbcmdec.so': /usr/lib64/gstreamer-0.10/libgstbcmdec.so: undefined symbol: gst_video_format_new_caps

I'm guessing that there is something wrong with the GStreamer. Is there a way to fix this? Or is there a problem with OpenCV-2.2 itself? Or maybe something is wrong with the sample script?

Thank you for your time.

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

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

发布评论

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

评论(2

撩起发的微风 2024-11-11 03:38:09

尝试使用不同的相机索引

capture = cv.cvCaptureFromCam(1)

或其他更高的索引

Try using a different camera index

capture = cv.cvCaptureFromCam(1)

or other higher indexes

橙幽之幻 2024-11-11 03:38:08

该符号应该由 gstreamer-plugins-base 包提供。

检查是否已安装。如果您确实有它,则意味着您的此软件包版本比 OpenCV 2.2 所需的版本旧。为了确保万无一失,最好更新您平台上的整个 GStreamer

That symbol should be provided by the package gstreamer-plugins-base.

Check if you have it installed. If you do have it, it means your version of this package is older than what OpenCV 2.2 needs. It's best to update the entire GStreamer on your platform just to be sure.

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