Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue initializing a Pipeline with Gstreamer using Kinect webcam ASUS #1178

Open
Adrien3B1BGang opened this issue Mar 3, 2023 · 0 comments

Comments

@Adrien3B1BGang
Copy link

I'm trying to use a webcam plunged into a Jetson Xavier NX so as to use it for obstacle detection for blind people but I don't know which pipeline to use with Gstreamer so as to capture image on this webcam. Here's my code using OpenCV and Python below thanks in advance

`

coding=utf-8

import cv2
print(cv2.version)

width = 800
height = 600
flip = 2
#camSet = 'udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! appsink'
camSet = 'videotestsrc ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! appsink'
#camSet = 'appsrc ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=5000'
#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'
cam = cv2.VideoCapture(camSet,cv2.CAP_GSTREAMER)

window_width = 1920
window_height = 1020
print("Nombre de frames par secondes : ")
print(cam.get(cv2.CAP_PROP_FPS))

cam.set(cv2.CAP_PROP_FRAME_WIDTH,window_width)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT,window_height)

if not cam.isOpened():
quit(1)
#else :

print("Success")

while True: #boucle infinie
ret, frame = cam.read() #on met l'image capturée par la camera dans la variable frame

if not ret:
    break

cv2.imshow('myCam', frame) #on affiche la frame, grâce à la boucle infinie ça devient une video (succesion d'images)
cv2.moveWindow('myCam',0,0) #On bouge la fenêtre
if cv2.waitKey(1) == ord('q'): #Si on appuie sur q on quitte la boucle (plus propre que ctrl + c)
    break

cam.release()
cv2.destroyAllWindows()

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant