You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Video Object Detection and Tracking Script is a Python tool designed for processing videos or sequences of images to detect and track changes between frames. It employs various image processing techniques and algorithms to identify differences, track objects, and manage stationary objects. This script is useful in scenarios where you need to analyze and visualize motion patterns or stationary periods within a video stream.
21
+
The is a Python tool designed for processing videos or sequences of images to detect and track changes between frames. It employs various image processing techniques and algorithms to identify differences, track objects, and manage stationary objects. This script is useful in scenarios where you need to analyze and visualize motion patterns or stationary periods within a video stream.
20
22
21
23
## Features
22
24
@@ -26,16 +28,14 @@ The Video Object Detection and Tracking Script is a Python tool designed for pro
26
28
- Provides command-line interface for customization and control.
27
29
- Generates output videos and log files to visualize and analyze results.
28
30
29
-
## Getting Started
30
-
31
-
### Prerequisites
31
+
## Prerequisites
32
32
33
33
- Python 3.6 or higher
34
34
- OpenCV (cv2)
35
35
- NumPy (np)
36
36
- scikit-image (skimage)
37
37
38
-
###Installation
38
+
## Installation
39
39
40
40
1. Clone the repository:
41
41
@@ -55,38 +55,92 @@ To use the Video Object Detection and Tracking Script, follow these steps:
55
55
56
56
1. Ensure that you have Python and the required libraries installed (see Prerequisites).
57
57
58
-
2. Place your input video or image sequence in the `./data/videos/` directory.
59
-
60
-
3. Run the script using the following command:
58
+
2. Arrange your input folder and output folder accordingly. Recommended folder arrangement:
59
+
60
+
```
61
+
Object-Detection-Camera-Feed/
62
+
main.py
63
+
preprocess.py
64
+
processor.py
65
+
tracker.py
66
+
ignore.txt
67
+
data/
68
+
videos/
69
+
vid.mp4
70
+
...
71
+
masks/
72
+
mask.jpg
73
+
...
74
+
output/
75
+
...
76
+
```
77
+
78
+
3. Modify the `ingore.txt` file as you wish.
79
+
80
+
- This text file will ignore the box location that you want.
81
+
- Keep in mind that it will only ignore objects that have matching or bigger `iou` with the boxes inside `ingore.txt`.
82
+
- Format is one `[x1, y1, x2, y2]` per line.
83
+
84
+
4. Change directory to the project folder then run the program using the following command:
Copy file name to clipboardExpand all lines: main.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -27,12 +27,12 @@ def main():
27
27
parser.add_argument('-i', '--input', type=str, help='Path to the input video.', required=True)
28
28
parser.add_argument('-o', '--output', type=str, help='Path to output folder.', default=VideoProcessor.DEFAULT_OUT_PATH)
29
29
parser.add_argument('-m', '--mask', type=str, help='Path to a mask image.', default=None)
30
-
parser.add_argument('--ignore', type=str, help='Path to a list of positions of boxes in the frame that you want the program to ignore. Each line contains 1 box position. Example format: [x1, y1, x2, y2]', default=None)
30
+
parser.add_argument('-g', '--ignore', type=str, help='Path to a list of positions of boxes in the frame that you want the program to ignore. Each line contains 1 box position. Example format: [x1, y1, x2, y2]', default=None)
31
31
parser.add_argument('--iou', type=float, help='IOU threshold for object matching.', default=Tracking.DEFAULT_IOU_THRESHOLD)
32
32
parser.add_argument('--min-size', type=int, help='Minimun area of the contour box to be recorded as an object.', default=Tracking.DEFAULT_MIN_SIZE)
33
-
parser.add_argument('--track-rate', type=int, help='Tracking rate for stationary object detection.', default=Tracking.DEFAULT_TRACK_RATE)
34
-
parser.add_argument('--white', type=int, help='Determine the minimum value to be white pixel otherwise will be turned black.', default=VideoProcessor.DEFAULT_WHITE_THRESHOLD)
35
-
parser.add_argument('--black', type=int, help='Determine the minimum value to be black pixel otherwise will be turned white.', default=VideoProcessor.DEFAULT_BLACK_THRESHOLD)
33
+
parser.add_argument('--track-rate', type=int, help='Number of frames between stationary object checks', default=Tracking.DEFAULT_TRACK_RATE)
34
+
parser.add_argument('--white', type=int, help='Set the minimum value (from 0 to 255) to be white pixel otherwise will be turned black.', default=VideoProcessor.DEFAULT_WHITE_THRESHOLD)
35
+
parser.add_argument('--black', type=int, help='Set the minimum value (from 0 to 255) to be black pixel otherwise will be turned white.', default=VideoProcessor.DEFAULT_BLACK_THRESHOLD)
36
36
parser.add_argument("--gray", type=bool, help="(bool) False to turn off grayscale in preprocessing, True otherwise", action=argparse.BooleanOptionalAction, default=True)
37
37
parser.add_argument("--contrast", type=bool, help="(bool) True to turn on auto contrast in preprocessing, False otherwise", action=argparse.BooleanOptionalAction, default=False)
38
38
parser.add_argument("--blur", type=bool, help="(bool) True to turn on blurring in preprocessing, False otherwise", action=argparse.BooleanOptionalAction, default=False)
0 commit comments