main.py 585 B

123456789101112131415161718192021222324252627
  1. import cv2
  2. from sheet import get_answer_from_sheet
  3. cap = cv2.VideoCapture(1)
  4. while True:
  5. ret, frame = cap.read()
  6. cv2.imshow("img", frame)
  7. height, width = frame.shape[:2]
  8. frame = cv2.resize(
  9. frame,
  10. # (int(round(0.7667 * width)), int(round(0.765625 * height))),*
  11. (600, 500),
  12. interpolation=cv2.INTER_CUBIC
  13. )
  14. try:
  15. get_answer_from_sheet(frame)
  16. break
  17. except Exception as e:
  18. # print e
  19. if cv2.waitKey(1) & 0xFF == ord('q'):
  20. break
  21. continue
  22. cap.release()
  23. #cv2.destroyAllWindows()