def cam_loop(images, end): cap = CSICamera(width=224, height=224, capture_width=1080, capture_height=720, capture_fps=30) while True: img = cap.read() print("reading image") if img is not None: images.put(img) if end.value == 1: cap.release() return
if cv2_save_frame == 1: cv2.imwrite (iname, image) # if cv2_display == 1: cv2.imshow("Camera Output", frame) #cv2.imshow("Clahe", cl1) #cv2.imshow("Threshold", th2) #cv2.imshow("EQC", hisimg) #cv2.imshow("HSV", hsv) #cv2.imshow("Color Mask", cmask) #cv2.imshow("Final Result", result) #rawCapture.truncate(0) #key = stdscr.getch() k = cv2.waitKey(1) #& 0xFF #print ("key: ", k) if "q" == chr(k & 0xff): estop = True break except KeyboardInterrupt: estop = True break #time.sleep (1) #curses.endwin() camera.release() if cv2_display == 1: cv2.destroyAllWindows()
lFPSbeg = datetime.now() while True: try: frame = capture.read() video_writer.write(frame) # #fps computation lFPSrun = (datetime.now() - lFPSbeg).seconds lFPSfnm = lFPSfnm + 1 if lFPSrun > 0: FPSavg = lFPSfnm / lFPSrun else: FPSavg = 0 cfpst = "FPS: %d t: %dsec %.2ffps" % (lFPSfnm, lFPSrun, FPSavg) if use_display: if True or (lFPSfnm % 10) == 0: cv2.putText(frame, cfpst, (10, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2, cv2.LINE_AA) cv2.imshow('Video Stream', frame) else: if (lFPSfnm % 50) == 0: print(cfpst) if cv2.waitKey(1) & 0xFF == ord('q'): break except KeyboardInterrupt: break # capture.release() video_writer.release() cv2.destroyAllWindows()