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
Copy file name to clipboardexpand all lines: README.md
+52-31
Original file line number
Diff line number
Diff line change
@@ -14,10 +14,26 @@ The image below shows a video frame with extracted motion vectors overlaid,
14
14
15
15

16
16
17
-
A usage example can be found in `test.py`.
17
+
A usage example can be found in `extract_mvs.py`.
18
18
19
19
20
-
## Installation
20
+
## News
21
+
22
+
### Recent Changes
23
+
24
+
- Added unittests in `tests/tests.py`
25
+
- Updated to Ubuntu 22.04, Python 3.10, and OpenCV 4.5.5
26
+
- Provided a script to wrap Docker run command
27
+
- Updated demo script with command line arguments for extraction and storing of motion vectors
28
+
29
+
### Looking for Contributors
30
+
31
+
The mv-extractor seems to be quite popular and I want to improve it. However, I do not have the time and resources to do this alone. Hence, I gladly welcome any community contributions.
32
+
33
+
One improvement that is on my mind, is the packaging and distribution of mv-extractor via PyPI. This requires creating a source distribution and building binary wheels for different target architectures and Python versions. Ideally, the build would be automated with a CI pipeline, e.g., GitHub Actions. It would be awesome, if someone is interested in helping me and getting this to work. In this case, please just open an issue and we can discuss the details.
34
+
35
+
36
+
## Quickstart
21
37
22
38
### Step 1: Install Prerequisites
23
39
@@ -30,58 +46,63 @@ Change into the desired installation directory on your machine and clone the sou
This step is not required and for faster installation, we recommend using the prebuilt image.
44
-
If you still want to build the Docker image locally, you can do so by running the following command in the `mv_extractor` directory
57
+
The extraction script provides several command line options, e.g., to store extracted motion vectors to disk, and to enable/disable graphical output. To see all command line options type
45
58
```
46
-
sudo docker build . --tag=mv_extractor
59
+
sudo ./run.sh python3 extract_mvs.py -h
60
+
```
61
+
For example, if you want to store extracted frames and motion vectors to disk, you can do so by running
Note, that the last command will fail because there is no file called `another_video.mp4`.
60
70
61
71
62
-
### Step 4: Test Installation
72
+
##Advanced Usage
63
73
64
-
Test if everything is installed succesfully by running the demo script
65
-
```
66
-
python3 test.py
67
-
```
68
-
If you encounter the error message "cannot open display: :1" or similar, you have to disable the X server access control by running
74
+
### Run Tests
75
+
76
+
To test if everything is installed succesfully you can run the tests with
69
77
```
70
-
xhost +
78
+
sudo ./run.sh python3 tests/tests.py
71
79
```
72
-
in a new terminal on the host machine (not inside the Docker container).
73
-
80
+
Confirm that all tests pass.
74
81
75
-
##Usage
82
+
### Importing mv-extractor into Your Own Scripts
76
83
77
84
If you want to use the motion vector extractor in your own Python script import it via
78
85
```
79
86
from mv_extractor import VideoCap
80
87
```
81
-
You can then use it according to the example in `test.py`.
88
+
You can then use it according to the example in `extract_mvs.py`.
82
89
83
90
Generally, a video file is opened by `VideoCap.open()` and frames, motion vectors, frame types and timestamps are read by calling `VideoCap.read()` repeatedly. Before exiting the program, the video file has to be closed by `VideoCap.release()`. For a more detailed explanation see the API documentation below.
84
91
92
+
### Building the Docker Image Locally
93
+
94
+
This step is not required and for faster installation, we recommend using the prebuilt image.
95
+
If you still want to build the Docker image locally, you can do so by running the following command in the `mv_extractor` directory
0 commit comments