The repo contains the script, which creates a video from sequences from DAVIS dataset.
Note: the script requires the DAVIS dataset to be present in the directory where the script will be launched.
The script uses base images from the JPEGImages
directory and annotation images from Annotations
to create an example video with annotation visualization. The script is using cv2
and numpy
. In addition, the repo contains a simple logger, which uses Python's built-in logging module, and writes logs both to the file and stdout. The log_handler module also contains a decorator for measuring the runtime of the functions.
The script is designed to be launched from the command line with different arguments.
Example of splitting the image: python3 create_video.py --output_path path/to/file.mp4 --sets_number 3
Where both arguments are required: output path to the result file, and a number of sets which will be used to create the video.
I started the approach to the solution by understanding how images in the Annotations
directory are storing useful data. It takes some time and several tries, since I started to solve the problem with incorrect tools (I tried to handle images as masks with cv2.bitwise_and and the result was far from expected), which leads me to errors, trying and researching. After this problem was solved just with simple image blending, the rest part of the task didn't provide complex challenges. The easiest way was to handle each frame of the resulting video, pack it into the list and then create a video frame by frame. Since I already completed the first test task, I was able to re-use my code and copy-pasted the logger and argparser
.