Approximate images using quadtree i.e. by recursively subdividing the image into four quadrants if some conditions are met. In this case, the split is done whether the image and its mean colour differ in some tolerance. This is not an efficient way to compress images however the visual result is pleasant to the eye.
-
Install the requirements:
pip3 install -r requirements.txt
-
Run the code:
python3 main.py <input_image> -e <threshold> -o <outpput_image>
Examplepython3 main.py ./images/test.jpeg -e 35 -o result.png
and the result for different threshold epsilon.
Other parameters are listed by running python3 main.py --help
.
I'm interested into implementing other quadtree methods such as:
- Allow non-square quadrants
- Optimise the split of the quadtree (i.e. split quadrants such that the error in the color is minimised)
- Animation! Animate the quadtree recursive subidivision