Rock It 《Armbian》六

雖然 ROCK64 只有 USB Camera 可用︰

 

 

既已經安裝了 OpenCV ,當然得試試看也︰

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__
'4.0.1-dev'
>>> camera = cv2.VideoCapture(0)

(python3:9042): GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
>>>

 

結果嚇一跳呦★

當真

塞翁得馬,焉知非禍耶?!

淮南子‧卷十八‧人間訓

夫禍福之轉而相生,其變難見也。 近塞上之人有善術者,馬無故亡而入胡,人皆弔之。其父曰:「此何遽不為福乎!」居數月,其馬將胡駿馬而歸,人皆賀之。其父曰:「此何遽不能為禍乎!」家富良馬,其子好騎,墮而折其髀,人皆弔之。其父曰:「此何遽不為福乎!」居一年,胡人大入塞,丁壯者引弦而戰,近塞之人,死者十九,此獨以跛之故,父子相保。故福之為禍,禍之為福,化不可極,深不可測也。

 

不過無獨有偶乎!?

/opencv

Videocapture error while reading from camera using backend (i.e. Ffmpeg, Gstreamer, Direct Show) #11806

Open
rashikcs opened this issue Jun 22, 2018
System information (version)
  • OpenCV => 4.0.0
  • Operating System / Platform => Ubutu 64bit
  • Compiler => g++ -std=c++11
Detailed description

compile with GDB.

(process:24917): GStreamer-CRITICAL **: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
ERROR! Unable to open camera
[Thread 0x7fffc5ec2700 (LWP 24921) exited]
[Inferior 1 (process 24917) exited with code 0377]

compile the videocapture_basic.cpp file using the following command.

OPENCV_LOG_LEVEL=DEBUG OPENCV_VIDEOIO_DEBUG=1 ./output

[ INFO:0] VIDEOIO: Enabled backends(7, sorted by priority): FFMPEG(1000); GSTREAMER(990); V4L2(980); CV_IMAGES(970); CV_MJPEG(960); FIREWIRE(950); GPHOTO2(940)
[ WARN:0] VIDEOIO(createGStreamerCapture(filename)): trying …

(video_stream:17022): GStreamer-CRITICAL **: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
[ WARN:0] VIDEOIO(createGStreamerCapture(filename)): result=(nil) isOpened=-1 …

terminate called after throwing an instance of ‘char const*’
Aborted (core dumped)

Steps to reproduce

After compiling the sample code in file opencv/samples/cpp/videocapture_basic.cpp changing line 28 and executing the output file getting the error

int apiID = cv::CAP_GSTREAMER

 

又得練功夫啦☆