How to install openCV on rb5 with Gstreamer?

I have installed opencv-wayland on Qualcomm’s rb5, but it did not install GStreamer automatically. Do I have to re-build opencv from scratch to install Gstreamer? Is there any OpenCV version where it can be run on wayland + have Gstreamer?

This is my error message when I am running VideoCapture on opencv-wayland.

(process:8785): **GStreamer-CRITICAL : 13:24:22.731: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
OpenCV | GStreamer warning: GStreamer: unable to query pipeline state (/home/src/opencv-wayland/modules/videoio/src/cap_gstreamer.cpp:421)
(DEBUG) try_init_v4l2 VIDIOC_QUERYCAP “/dev/video0”: Inappropriate ioctl for device
Unable to stop the stream: Inappropriate ioctl for device
Failed to open VideoCapture.

3rdparty thing, not maintained at all from opencv devs. talk to the maintainer of that package.

main opencv has support for wayland – you dont need that (unmaintained !) fork at all !

please show minimal code to reproduce it, there might just be an error in your pipeline

First I am doing this for gstreamer pipeline:

gst-launch-1.0 -e qtiqmmfsrc name=qmmf ! video/x-h264,format=NV12, width=1280, height=720,framerate=30/1 ! h264parse config-interval=1 ! mpegtsmux name=muxer ! queue ! tcpserversink port=8900 host=<RB5_IP_ADDRESS>

and then this code to capture an image:

import cv2

cap = cv2.VideoCapture(“tcp://<RB5_IP_ADDRESS>:8900”) #I have added rb5 port and ip add
while(cap.isOpened()):
ret, frame = cap.read()

cv2.imwrite("image.jpg",frame)
break

cap.release()

After this, I get the abovementioned error.

are you sure that’s right? don’t you want to present a source?

Yes, I have been following this forum to debug.

1 Like

I am trying to use tcp server & client architecture to send/receive camera frame on opencv in Qualcomm rb5. Is there any other architecture which I can use to use VideoCapture() in opencv on rb5?

my bad. I am fairly unfamiliar with gstreamer and mixed up the meaning of sink and source.

you can maybe run the gstreamer pipeline right in a VideoCapture object. the pipeline usually ends with an appsink that OpenCV then reads from

I think OpenCV’s cv2.VideoCapture() function does not support creating a capture object using a Gstreamer pipeline string. Probably I have to use Gstreamer’s python bindings to interact with the pipeline directly and then use OpenCV to display the frames.

print(cv.getBuildInformation())

the Video I/O section mentions gstreamer. if the build supports gstreamer, it should work.

of course you can deal with gstreamer directly. that is surely more flexible and controllable.

related: