Skip to content

Conversation

@lou-roboflow
Copy link
Collaborator

@lou-roboflow lou-roboflow commented Dec 23, 2025

Description

Motion detection has an option to not start detection motion until the background is initialized. The order of the code however was actually preventing the background from initializing until the time limit hit. This is a very small change to fix the issue. Also filtering out contours of < 3 points earlier rather than hold onto them.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested locally and with test cases

Any specific deployment considerations

N/A

Docs

N/A

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in motion detection where the background subtraction model was not being initialized properly. The background subtractor needs to process frames to build its model, but the code was previously checking frame initialization status before applying background subtraction, preventing the model from learning until the time limit was reached.

Key Changes:

  • Moved background subtraction call before the frame initialization check, allowing the model to process frames during the initialization period
  • Refactored the initialization condition logic for clarity
  • Removed unused variables and improved contour filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ion/v1.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@lou-roboflow lou-roboflow merged commit 8530589 into main Dec 23, 2025
51 checks passed
@lou-roboflow lou-roboflow deleted the MotionDetectionFramesInitializedBug branch December 23, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants