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