saimj7 / People-Counting-in-Real-Time

People Counting in Real-Time with an IP camera.
MIT License
528 stars 263 forks source link

slow down the speed #77

Closed realTravisYou closed 7 months ago

realTravisYou commented 7 months ago

Why so fast run inference on a test video file, how slow down? I would be very grateful if you could tell me.

saimj7 commented 7 months ago

It could be that OpenCV's video capture is processing the frames faster (~50 when measured) than the original video fps (which is 30) or it may also depend on your system hardware. One nice fix for you is to measure the original fps of the video and supply it/adjust the frame rate during the live feed accordingly, or by introducing a delay in the feed

E.g., a quick way to test this is to introduce a delay to compensate for the faster fps: Try changing key = cv2.waitKey(1) to key = cv2.waitKey(15) to add delay/slow down the fps https://github.com/saimj7/People-Counting-in-Real-Time/blob/master/people_counter.py#L331

realTravisYou commented 7 months ago

It wroks. Thank you so much.