Hello! I recently encountered a problem with Gstreamer on a jetson orin nano dev kit.I previously installed opencv with cuda support following the tutorial here:Install OpenCV on Jetson Orin Nano - Q-engineering .This code worked for me, that is, my camera opened and I could see video in real time:
import cv2
print(cv2.__version__)
width=1280
height=720
flip=2
camSet='nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=21/1,format=NV12 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(width)+', height='+str(height)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
#camSet ='v4l2src device=/dev/video1 ! video/x-raw,width='+str(width)+',height='+str(height)+',framerate=24/1 ! videoconvert ! appsink'
cam=cv2.VideoCapture(camSet)
while True:
_, frame = cam.read()
cv2.imshow('myCam',frame)
cv2.moveWindow('myCam',0,0)
if cv2.waitKey(1)==ord('q'):
break
cam.release()
cv2.destroyAllWindows()
Now after I installed ultralytics to be able to use yolo, I encounter the following problem:
Also here it appears that Gstreamer is no, although in the tutorial I set it to yes and before everything was working ok:
And if I run this command, everything works ok, that is, I can see the images from the camera:
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! nvvidconv flip-method=2 ! xvimagesink
I installed OpenCV once more following the above tutorial but the problem was not solved. How could I solve the problem? I need an urgent answer, I don’t know what to do anymore :((
hello alexandru.prisacariu,
may I know which camera module you’re working with?
what’s your test pipeline to launch camera for preview stream?
I have a raspberry pi camera, I think you need this information:
And I will explain the problem one more time. With this command from the terminal
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! nvvidconv flip-method=2 ! xvimagesink
camera works, but with the script in python it does not work.
Before installing ultralytics, everything was fine, the camera also worked with this script. But I don’t know 100% if the problem came after the installation of ultralytics.
I will post some more pictures, maybe they will help you.
Also, although Gstreamer in the installation tutorial for OpenCV is set to YES, here it appears that it is set to NO. When I installed OpenCV again, it seemed at one point that it was set to YES, but I see that in the end it still remained on NO.
I also forgot to mention that I’m using JetPack 6.0 L4T 36.3.0
Hi,
Could you try to set up OpenCV with the below link instead?
Thanks.
AastaLLL I have a question. Will the version 4.10.0 I have now be uninstalled automatically when I run your script or do I have to uninstall it manually? I don’t want to have two versions installed, otherwise I think I’ll have conflicts between them. If I have to uninstall it manually, what are the commands? (I’m asking because I tried it before and it didn’t work)
Anyway, I will try this method and come back with feedback.
I followed your tutorial but it doesn’t work, in fact TensorRT disappeared during installation. In the terminal I still see version 4.10.0 although in jtop it is 4.9.0. As a note at the beginning of the script I told it to delete the previous version of OpenCV and install the new one. I don’t know what else to do. Please, maybe you know a solution without having to reinstall the operating system or something like that. Thank you very much in advance.
Hi,
Do you export the library to python 3.10?
Thanks.
Hi,
I ran these commands in the following order:
1. wget https://raw.githubusercontent.com/AastaNV/JEP/refs/heads/master/script/install_opencv4.9.0_Jetpack6.0.sh
2. sudo chmod 755 ./install_opencv4.9.0_Jetpack6.0.sh
3. ./install_opencv4.9.0_Jetpack6.0.sh
I suppose that when the script was run, all the commands in it had to be executed. If I made a mistake, give me the correct commands. I’ll say it again, I really need help because I don’t know what methods to apply to make everything work :( Thank you.
I solved the problem with TensorRT by reinstalling it. In the terminal I still see version 4.10.0 although in jtop it is 4.9.0 (i still have this problem). But more important now does anyone know how to solve the problem with Gstreamer? Thanks in advance!
Hello!I still haven’t solved the problem with Gstreamer, but do you know another way to work with the raspberry pi camera and Open CV in python? I really need a lot of help. Thank you for your attention!
Hello! I did not understand how to do this method. But does anyone really know or has not met my problem above? To those who have answered me so far, thank you very much!
Also running this code I found that Gstreamer is installed but I don’t know why I think Open CV doesn’t interpret it properly.