hello everyone i want to capture 20 photo step by step from csi camera
I am doing a loop but first 11 photo same whatever I do.
import cv2
import os
import time
cycle = 20
dispW=640
dispH=480
flip=2
camSet = 'nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method='+str(flip)+' ! video/x-raw, width='+str(dispW)+', height='+str(dispH)+', format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink'
cap = cv2.VideoCapture(camSet)
path = '/home/yum/Desktop/egg'
a = 0
egg_name = input("What's name of egg?\n")
folder = os.path.join(path, egg_name)
os.mkdir(folder)
while cap.isOpened() and a < cycle:
ret, frame = cap.read()
cv2.imshow("frame", frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
if not ret:
print("Unable to read camera..")
break
a=a+1
time.sleep(1)
cv2.imwrite(path + '/' + egg_name + '/photo_%02d.jpg'%a,frame)
cap.release()
cv2.destroyAllWindows()
this is output image
how can I fix this !