Hello there, I’m using khadas Vim3 PRO and mipi camera OS08A10 8MP HDR Camera from your official store. I tried to run camera with simple command cap = cv2.cv2.VideoCapture('/dev/video0', cv2.CAP_FFMPEG) I’m just getting infinite cycle (programm is running, but showing nothing):
MIPI camera plugged in correctly because this command shows me what she see (but then throws error in few seconds): v4l2_test -c 1 -p 0 -F 0 -f 0 -D 0 -R 1 -r 2 -d 2 -N 1000 -n 800 -w 0 -e 1 -I 0 -b /dev/fb0 -v /dev/video0
The question - how can I capture a frame using my MIPI cam with OpenCV?
Hey, I already saw this topic, the app is working, but when I’m trying it with OpenCV, he just fails, he just stucks in the infinite loop after cap = cv2.VideoCapture('/dev/video0')
If I’m putting 0 instead of /dev/video0 he just fails because he is receiving no frame.
(I tried it with OpenCV 4.2 and 4.6)
import cv2
if __name__ == '__main__':
val = True
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter("./test.avi", fourcc, 20.0, (640, 480), True)
while val is True:
ret, frame = cap.read()
cv2.cvtColor(frame,cv2.COLOR_RGB2BGR)
if frame is None:
break
else:
out.write(frame)
cv2.imshow("video", frame)
k = cv2.waitKey(1) & 0xFF
if k == 27:
break
cap.release()
out.release()