Slow capture video from camera via OpenCV IMX 8 Mini EVK

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

Slow capture video from camera via OpenCV IMX 8 Mini EVK

858 Views
SYakubson
Contributor II

Hello! I tried to catch video from nxp csi camera via opencv, but it works too slow. When i paste command to catch video in terminal it works fine.

Code to terminal:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, framerate=30/1,width=1920,height=1080 ! videoconvert ! waylandsink

OpenCV code:

import cv2
import numpy as np
 
pipeline = 'v4l2src device=/dev/video0 ! video/x-raw, framerate=30/1,width=1920,height=1080 ! videoconvert ! appsink'
camera = cv2.VideoCapture(pipeline, cv2.CAP_ANY)
data = np.zeros((1920, 1080))

while True:
success, data = camera.read()
 
if(success == True
cv2.imshow("Image", data)

if cv2.waitKey(1) == 27:
break
print(success)
cv2.destroyAllWindows()
camera.release()
Tags (1)
0 Kudos
Reply
2 Replies

849 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello SYakubson,

You are using /dev/video1 this is for USB or remove the data np.zeros.

 

Regards

0 Kudos
Reply

844 Views
SYakubson
Contributor II

@Bio_TICFSL in my code everywhere video0
I try to use it without numpy arrays, work similar

0 Kudos
Reply