main.py 335 B

12345678910111213141516
  1. import cv2
  2. import numpy as np
  3. vid = cv2.VideoCapture("./pictures.avi")
  4. target = np.array([160.31783565, 179.92989583, 204.62822049])
  5. c = 0
  6. ret, frame = vid.read()
  7. while ret:
  8. col = frame.mean(axis=0).mean(axis=0)
  9. if abs(np.sum(target - col)) < 1:
  10. c += 1
  11. ret, frame = vid.read()
  12. print(f"Total frames: {c}") # 70