Unable to run opencv with detectron on jetson xavier nx

This is the wat the terminal shows when i run the code

(python3:3543): GStreamer-WARNING **: 10:38:24.675: Failed to load plugin ‘/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so’: /lib/aarch64-linux-gnu/libGLdispatch.so.0: cannot allocate memory in static TLS block

(python3:3543): GStreamer-WARNING **: 10:38:24.683: Failed to load plugin ‘/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so’: /lib/aarch64-linux-gnu/libGLdispatch.so.0: cannot allocate memory in static TLS block
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: no element “nvarguscamerasrc”
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ERROR:0] global …/modules/videoio/src/cap.cpp (116) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.2.0) …/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can’t find starting number (in the name of file): nvarguscamerasrc ! video/x-raw(memory:NVMM), width=326 4, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=2 ! video/x-raw, width=320, height=240, format=BGRx ! videoconvert ! video/x- raw, format=BGR ! appsink in function ‘icvExtractPattern’

Traceback (most recent call last):
File “pom-ai_1.py”, line 71, in
cv2.imwrite(filename, frame)
cv2.error: OpenCV(4.2.0) …/modules/imgcodecs/src/loadsave.cpp:715: error: (-215:Assertion failed) !_img.empty() in function ‘imwrite’

Hi,

The error print shows gstreamer is not enabled in OpenCV. You may try to use the default OpenCV package installed through SDKManager.


but print(cv2.getBuildInformation())
shows gstreamer is enabled in opencv
bdw opencv works perfectly to check the camera ,it shows this error only when running with detectron2

Hi,
Please try the sample:
[Gstreamer] nvvidconv, BGR as INPUT - #4 by DaneLLL

If above sample can be run successfully, it may be an issue in the detecton2 sample.

You may try:

LD_PRELOAD=/lib/aarch64-linux-gnu/libGLdispatch.so  python3 your_app.py

You would remove the extra space → width=3264

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.