- Region of interest
- Adaptation to light changes
- Works 110% of the time
- Performant, uses 0-1% of CPU and 40 mb of RAM
- Download Python
- Download the file
main.py - Install the
pyautoguilibrary for hotkey support usingpip install pyautoguiin the console. - Set the
debugvariable toTruein the main.py file. - Run the script with
python main.pyin the console. - Adjust the settings in the main.py file through trial and error to suit your use case.
- Set
debugtoFalseand run again
You can modify theon_movement_detected()function to customize actions upon movement detection. If issues arise, experiment with different settings.
Here is the algorithm:
- Capture the image from a webcam
- Downscale the image to eliminate some noise
- Convert to hsv and remove brightness information
- Compare the hues of the processed image to the previous frame's hues
- If the difference exceeds the threshold, motion is present
