Converts a video into images filtered for Photogrammetry.
Its main goal is to reduce the on-site time needed for data capture and also the time for photogrammetry software, such as Meshroom, to compute by only using a small selection of frames from a video data capture. This tool filters out frames that are too blurry to be used and consecutive frames that have too many features in common.
To install Poetry, follow these steps:
python -m pip install --upgrade pip
python -m pip install --user pipx
python -m pipx ensurepath
pipx install poetry
To install the project dependencies, execute the following command:
poetry install
To activate the virtual environment, run:
poetry shell
For command line arguments, use:
python video2images.py --help
To convert a video into images, run:
python video2images.py PATH_TO_VIDEO
This command will create a folder named extracted_frames
at the same location as PATH_TO_VIDEO
.
The process is based on a simple, pipeline-oriented approach. No multiprocessing, threads, or clusters are used.
The pipeline operates as follows:
- Create an output directory or clear if already existent
- Open the video file and retrieve needed properties
- Processes each frame with the following quality checks:
-
Blurriness Check:
Filters out frames that are too blurry based on the
blur_min_threshold
. -
Feature Check:
Filters out frames that do have too many features in common with its previous frame based on
feature_max_threshold
.
-
- Save Valid Frames
- Cleanup & Print Stats
Special thanks to the following resources for their contributions:
- Adrian Rosebrock's Tutorial for providing valuable insights on detecting and debugging blur in frames.
- AzureDVBB for demonstrating an alternative approach to filtering frames from a video. For additional context, see the related article, Photogrammetry Datasets from Video - A Slightly Less Naive Approach.
If you have other possible approaches or suggestions, please contact me at [email protected].