Rock It 《Armbian》七

查讀 GitHub

/opencv

gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed

相關問題集 Issues ,沒找到有效解決問題的方法☻

谷歌篩選後,留意著這則 Q&A ︰

3.4.2 cannot open and create videos, but with 3.4.1 I can

asked Jul 10 ’18

the_phet gravatar image  the_phet 1 1 2

I am using ArchLinux. My system just got updated to OpenCV 3.4.2-1. When I try to read or create a video, it outputs this error message:

python:15977): GStreamer-CRITICAL **: 18:19:37.484: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed Unable to stop the stream: Inappropriate ioctl for device

If I downgrade Opencv to 3.4.1-3 then it works fine.

 

故興起了『降級』想法︰

Releases

wget https://github.com/opencv/opencv/archive/3.4.1.zip

不知該訝異其正常乎?

rock64@rock64:~python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39)  [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.4.1' >>> cap = cv2.VideoCapture(0) >>></pre>    <span style="color: #666699;">縱驗之以 USB Microscope ︰</span> <pre class="lang:default decode:true">rock64@rock64:~ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import cv2
>>> cap = cv2.VideoCapture(0)
>>> while(True):
...     ret, frame = cap.read()
...     gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
...     cv2.imshow('frame',gray)
...     if cv2.waitKey(1) & 0xFF == ord('q'):
...         break
... 

※ 註︰

Getting Started with Videos

 

 

一日一夜 OK ,猶不安心也!