|
1 |
| -# Motion_Detection_Using_Python |
| 1 | +# Motion Detection Using Python |
| 2 | + |
| 3 | +This repository contains a Python program for motion detection using the OpenCV library. The program allows you to detect motion in a video stream or a webcam feed and highlight the areas where motion is detected. It also provides the option to save the output video with the motion highlights. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Real-time motion detection: The program continuously analyzes the video frames and detects any motion occurring in the scene, providing instant feedback. |
| 8 | +- Motion highlighting: Detected motion is visually highlighted in the video stream, making it easy to identify the areas where motion is occurring. |
| 9 | +- Adjustable sensitivity: You can fine-tune the motion detection sensitivity by modifying the threshold value in the configuration file. This allows you to customize the detection algorithm to suit your specific needs. |
| 10 | +- Configurable minimum area: The program allows you to set a minimum contour area threshold. Any detected motion with an area below this threshold will be disregarded. You can adjust this value based on your requirements. |
| 11 | +- Gaussian blur for noise reduction: The frames are preprocessed with a Gaussian blur to reduce noise and enhance the accuracy of motion detection. |
| 12 | +- Save output video: The program provides an option to save the processed video with the motion highlights as an output file. This allows you to review and analyze the detected motion later. |
| 13 | +- Executable file provided: You can also run the motion detector using the provided executable file, making it easier to use the program without Python dependencies. |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +1. Clone the repository to your local machine using the following command: |
| 18 | + |
| 19 | + ``` |
| 20 | + git clone https://github.com/alok-2002/Motion_Detection_Using_Python.git |
| 21 | + ``` |
| 22 | + |
| 23 | +2. Navigate to the project directory: |
| 24 | + |
| 25 | + ``` |
| 26 | + cd Motion_Detection_Using_Python |
| 27 | + ``` |
| 28 | + |
| 29 | +3. Install the required dependencies: |
| 30 | + |
| 31 | + ``` |
| 32 | + pip install -r requirements.txt |
| 33 | + ``` |
| 34 | + |
| 35 | +## Usage |
| 36 | + |
| 37 | +### Running with Python |
| 38 | + |
| 39 | +To run the motion detection program using Python, use the following command: |
| 40 | + |
| 41 | +``` |
| 42 | +python motion_detection.py |
| 43 | +``` |
| 44 | + |
| 45 | +The program will open the webcam and start detecting motion. The areas where motion is detected will be highlighted in real-time. If you want to save the output video, press the 's' key. |
| 46 | + |
| 47 | +Press the 'q' key to quit the program and stop the motion detection. |
| 48 | + |
| 49 | +### Running with the Executable File |
| 50 | + |
| 51 | +If you prefer not to run the program with Python, you can use the provided executable file. Simply double-click the `motion_detection.exe` file to start the motion detection program. The functionality and usage remain the same as running with Python. |
| 52 | + |
| 53 | +Please note that the executable file is platform-specific, so make sure to use the appropriate file for your operating system. |
| 54 | + |
| 55 | +## Configuration |
| 56 | + |
| 57 | +You can modify the program's behavior by adjusting the configuration settings in the `config.json` file. The available configuration options are: |
| 58 | + |
| 59 | +- `MIN_AREA`: The minimum contour area (in pixels) to be considered as motion. You can increase or decrease this value based on your needs. |
| 60 | +- `THRESHOLD_SENSITIVITY`: The sensitivity of the motion detection algorithm. Higher values will detect smaller motion, while lower values may require larger motion to be detected. |
| 61 | +- `BLUR_SIZE`: The size of the Gaussian blur kernel applied to the frames. Increasing this value can help reduce noise but may result in less precise motion detection. |
| 62 | + |
| 63 | +## Contributing |
| 64 | + |
| 65 | +Contributions to this repository are always welcome. If you find any issues or have suggestions for improvements, please create an issue or submit a pull request. |
| 66 | + |
| 67 | +## License |
| 68 | + |
| 69 | +This project is licensed under the [MIT License](LICENSE). |
| 70 | + |
| 71 | +## Acknowledgments |
| 72 | + |
| 73 | +This program is built using the OpenCV library. Special thanks to the developers of OpenCV for providing a powerful computer vision library that made this motion detection implementation possible. |
0 commit comments