问题
I am using cap = cv.VideoCapture(0) When opening the camera to record video, the program will work but he prompts me ((process:10728): GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed ) I don't know what the reason is, is it because of a problem with your cmake or a problem with the installation?
回答1:
I had similar issue in version 3.4.4, compiled with gstreamer support. Syntax "cv2.VideoCapture(0)" just stopped working. I had all gst-* libraries installed, so most of answers wasn't helpful. But finally changing VideoCapture argument to full device path ("/dev/video0") helped.
回答2:
Try:
cap = cv2.VideoCapture(0, cv2.CAP_V4L)
From this SO Answer
it works in my project
来源:https://stackoverflow.com/questions/50868893/process10728-gstreamer-critical-gst-element-get-state-assertion-gst-is