在 Linux 上使用 OpenCV 2.2 和 Python 捕获图像(Fedora 15 Beta)
我有下面的代码;
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用不同的相机索引
或其他更高的索引
Try using a different camera index
or other higher indexes
该符号应该由 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.