Go Deep with your Vision
dvg-utils is a set of tools to help you easily build your image and video processing pipeline using OpenCV and Python. With an easy configuration file and implementation modules you can try your computer vision pipeline on different devices like webcams, RaspberryPi Camera or camera connected to NVIDIA Jetson device (Nano, TX2, XAVIER) through GStreamer and more.
The library provides a handful of examples to start from.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
I suggest using Python virtual environment. Virtual environments will allow you to run independent Python environments
in isolation on your system.
Please take a look at this article on RealPython.
$ pip install tqdm pyyaml numpy
For OpenCV installation steps please look at OpenCV Tutorials, Resources, and Guides.
Mostly:
$ pip install opencv-python
or
$ pip install opencv-contrib-python
if you need both main and contrib modules should work.
You can also try to play hard and compile OpenCV with CUDA (if you got GPU on your board).
NVIDIA Jetson devices with JetPack SDK have OpenCV already installed.
For more info about OpenCV on Jetson platform looky here.
For Raspberry Pi Buster, install OpenCV with the help of this article: Install OpenCV 4 on Raspberry Pi 4 and Raspbian Buster from the wonderful PyImageSearch blog.
$ pip install dvg-utils
We can install the package locally (for use on our system), with:
$ pip install .
We can also install the package with a symlink, so that changes to the source files will be immediately available to other users of the package on our system:
$ pip install -e .
Running tests requires pytest package to be installed.
$ pip install pytest
$ make test
After dvg-utils installation, you get access to dvg-utils command which allows you to:
-
convert a video file to set of images:
$ dvg-utils v2i -i assets/videos/faces.mp4 -o output --display -
convert a set of frame images to a video file:
$ dvg-utils i2v -i output -o output/my_new_file.avi --display -
plot metrics (see examples below):
$ dvg-utils pm --input output/metrics_1.csv --input output/metrics_2.csv
$ pip install matplotlib
$ pip install scipy
$ pip install dlib
If you run examples on Raspberry Pi Camera you will need to:
$ pip install picamera
$ python ./examples/capture_image.py -i assets/images/friends
$ python ./examples/capture_video.py
$ python ./examples/capture_multi_video.py
$ python ./examples/detect_face_image.py -i assets/images/friends
$ python ./examples/detect_face_video.py --metrics output/metrics_no_pipeline.csv
or using pipeline implementation:
$ python ./examples/detect_face_video.py --pipeline --metrics output/metrics_with_pipeline.csv
$ dvg-utils pm --input output/metrics_no_pipeline.csv --input output/metrics_with_pipeline.csv
$ python ./examples/detect_motion_video.py
$ python ./examples/detect_object_video.py
$ python ./examples/track_object_video.py
$ python ./examples/count_object_video.py
- PyImageSearch for ideas
- pixabay for assets
This project is licensed under the MIT License - see the LICENSE.md file for details