Capturing images with OpenCV 2.2 and Python on Linux (Fedora 15 Beta)
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 be开发者_如何学JAVAlow;
(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.
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.
Try using a different camera index
capture = cv.cvCaptureFromCam(1)
or other higher indexes
精彩评论