Breakthrough / DVR-Scan

:vhs: Tool for extracting scenes with motion from videos (e.g. security camera or DVR footage). Written in Python, uses OpenCV.
http://www.dvr-scan.com/
Other
362 stars 47 forks source link

CNT erroneusly starts in a motion event #119

Closed Breakthrough closed 8 months ago

Breakthrough commented 1 year ago

After some discussion in https://github.com/Breakthrough/DVR-Scan/discussions/115 it was found that setting -b CNT will always treat the first frame as being a motion event. This can be verified using -mo mask.avi where the first frame is all 0xFFFFFF. This needs to be compensated for otherwise every video scanned will have an extra motion event.

Breakthrough commented 9 months ago

Fixed in latest development branch, will be included in the v1.6 release. Thanks for the report!

As part of the fix, I've added a rejection filter for any frames where all pixels in the frame appear as having motion. This is highly unlikely for legitimate events, even when they occupy a significant portion of the frame. This also makes detection more robust when the background subtractor updates it's state (e.g. due to compression artifacts).

Before closing this out, will also add a config option for the rejection filter so it can be disabled or customized (e.g. ignore up to N frames in a row).