Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

How to check if two following frames are identical ?

$
0
0
Hi, I'm using Python 3.5 and OpenCV 3.4.1. I just want to open a .avi video file and check if two frames in a row are identical in order to get the actual framerate of the game captured. I don't want to use an mse based comparison or something like that, I just want to know if two successives frames are EXACTLY identical. I currently have the following code : def unique_frame(): video_name = 'G:/VirtualDub Capture/RAW-Uncompressed.avi' cap = cv2.VideoCapture(video_name) fps = int(math.ceil(cap.get(cv2.CAP_PROP_FPS))) fps_counter = fps unique_fps_counter = 0 previous = cap.read() while cap.isOpened(): current = cap.read() if previous != current: unique_fps_counter += 1 if fps_counter == 0: print(actual_fps_counter) unique_fps_counter = 0 fps_counter = fps else: fps_counter -= 1 Obviously the '!=' part doesn't works. I'm a total newbie with OpenCV and I can't manage to find how to properly compare two frames. Thank you in advance

Viewing all articles
Browse latest Browse all 2088

Trending Articles