Image Segmentation Animation using QuadTree concepts.
- Split the Image into four quadrants.
- Split the quadrant with the highest error into four quadrants.
- Repeat N times.
With or without borders, the quadtree images achieve great compression, especially when using png
encoding. Looking at the Mountain Images above, the original is a 1.51 MB jpg
file (7.89 MB
when converted to png
), while the Quadtree Image with borders is a 333 KB png
and the one without borders is a 160 KB png
.
usage: quad.py [-h] [-q QUALITY] [-b] [-au] [-mw MINWIDTH] [-mh MINHEIGHT] input output iterations
Quadtree Image Segmentation.
positional arguments:
input Image to segment.
output Output filename.
iterations Number of segmentation iterations.
optional arguments:
-h, --help show this help message and exit
-q QUALITY, --quality QUALITY
Quality of the output video. (0-10), 0 worst, 10 best.
-b, --border Add borders to subimages.
-a, --audio Add audio from the input file to the output file.
-mw MINWIDTH, --minwidth MINWIDTH
Minimum width of the smallest image quadrant.
-mh MINHEIGHT, --minheight MINHEIGHT
Minimum height of the smallest image quadrant.
numpy
tqdm
imageio
imageio-ffmpeg
pip install numpy tqdm imageio imageio-ffmpeg