I want to use OpenCV to analyze (parts of) frames taken from a webcam taken at its native resolution of 1280 by 960. I can capture these using Gstreamer and an appsink. I've come to realize, however, that merely importing OpenCV messes up Gstreamer so that my capturing does not work anymore. I need gstreamer because OpenCV only allows capturing 640x480 and I've come to like all the extra features it brings.
The most minimal example I could think of to show my problem is this:
import gst
from time import sleep
#import cv2
pipeline = gst.Pipeline()
bin = gst.parse_bin_from_description('''
autovideosrc !
video/x-raw-rgb, width=1280, height=960 !
ffmpegcolorspace !
xvimagesink
''', False)
pipeline.add(bin)
pipeline.set_state(gst.STATE_PLAYING)
while True:
sleep(1)
in the version above, it runs nicely, if I uncomment the import cv2 statement, It gives me unending error messages:
libv4l2: error got 4 consecutive frame decode errors, last error: v4l-convert: error Could not enum frameival index: 6 for: RGB3 1280x960 using src: MJPG 1280x960, error: Invalid argument
I am on Kubuntu Linux 12.04, using OpenCV version 2.4.1, Gstreamer version 0.10.36
What does openCV do to mess up my Gstreamer ? How can I use both ?