opencv with gstreamer in VideoCapture doesn't work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

opencv with gstreamer in VideoCapture doesn't work

3,405 Views
yibhan
Contributor III

Hello guys,

I have built imx-image-multimeia in yocto(kernel 5.4.3.1) and added opencv some packages such as

CORE_IMAGE_EXTRA_INSTALL += " opencv-apps opencv-samples python3-opencv".

and then bitbake ima-image-multimedia -c populate_sdk.

and CROSS_COMPILE=/opt/fsl-imx-x11/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-

and SDKTARGETSYSROOT=/opt/fsl-imx-x11/5.4-zeus/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi.

but, when i run web cam app, some error occurred and stopped. I thought the pipeline would be right below

v4l2src device=/dev/video2 ! 'video/x-raw,width=640,height=480' ! imxv4l2sink. it works, but

VideoCapture cap("imxv4l2src device=/dev/video2 ! 'video/x-raw,width=640,height=480' ! appsink") doesn't work and below error is:

/usr/src/debug/opencv/4.1.2.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

I think it is caused by opencv with gstreamer but, I have no idea.

Could you tell me how to debug?

Labels (3)
0 Kudos
Reply
4 Replies

3,020 Views
Shinra
Contributor II

Got the exact same problem. For reference my pipeline is:

cap_send = cv2.VideoCapture('v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1920,height=1080 ! videoconvert ! appsink',cv2.CAP_GSTREAMER)

Did you manage to solve it ?

0 Kudos
Reply

3,187 Views
yibhan
Contributor III

Hello igorpadykov,

I don't think so, there is something wrong in my side, but I can't find any reason.

Am i missing some of packages?

0 Kudos
Reply

3,187 Views
igorpadykov
NXP Employee
NXP Employee

Hi Yibeom

for supported i.MX GStreamer plugins one can refer to Table 15. i.MX GStreamer 1.0 plugins

attached Release Notes, seems there is no opencv.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,187 Views
yibhan
Contributor III

Below build configuration to be used:

Build Configuration:
BB_VERSION           = "1.44.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-16.04"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "imx6qpsabresd"
DISTRO               = "fsl-imx-x11"
DISTRO_VERSION       = "5.4-zeus"
TUNE_FEATURES        = "arm vfp cortexa9 neon thumb callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            = "HEAD:0275e68b0576cdefc19718e4b1977044f9f43f48"
meta-oe              
meta-multimedia      
meta-python          = "HEAD:aad5b3d070cd8c58828b0975cf861d8ebc90f460"
meta-freescale       = "HEAD:0be39721cea6e04c589a419f4bb07fabd0da6704"
meta-freescale-3rdparty = "HEAD:aea3771baa77e74762358ceb673d407e36637e5f"
meta-freescale-distro = "HEAD:ca27d12e4964d1336e662bcc60184bbff526c857"
meta-bsp             
meta-sdk             
meta-ml              = "HEAD:435f5e984856a943986491fddd061734a0b9eba5"
meta-browser         = "HEAD:5f365ef0f842ba4651efe88787cf9c63bc8b6cb3"
meta-rust            = "HEAD:5cda04c7c2158fc982502ca1e7893f71e4ca1729"
meta-gnome           
meta-networking      
meta-filesystems     = "HEAD:aad5b3d070cd8c58828b0975cf861d8ebc90f460"
meta-qt5             = "HEAD:432ad2aa6c3a13253fefc909faba368851d21fb1"

0 Kudos
Reply