Quart icon indicating copy to clipboard operation
Quart copied to clipboard

Quadtree Image Art.

Quart

Image Segmentation Animation using QuadTree concepts.

  1. Split the Image into four quadrants.
  2. Split the quadrant with the highest error into four quadrants.
  3. Repeat N times.

Images

Segmented Image of an Acacia Tree Segmented Image of some Rocks Segmented Image of some Palm Trees Segmented Image of a Prairie Segmented Image of a tree on a cliff Segmented Image of a river Segmented Image of a Tropical Beach Segmented Image of a Coastline Segmented Image of Moonlight Segmented Image of some Waterfalls Segmented Image of some Houses Segmented Image of some Pipes Segmented Image of some sandstone stairs Segmented Image of a Palace Segmented Image of a Landscape Segmented Image of Lightning Segmented Image of a road at night Segmented Image of a twisty road

Borders

Image of a Mountain Road Segmented Image of a Mountain Road Segmented Image of a Mountain Road - No Borders

Compression

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.

Video

Fish Video

Usage

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.

Dependencies

numpy
tqdm
imageio
imageio-ffmpeg

pip install numpy tqdm imageio imageio-ffmpeg