This is an implementation of a content-aware image compression algorithm. The content awareness mechanism is based on entropy, which is computed using the hue value frequency distribution of color pixels in a given rectangle. Then the parent rectangle image will be split (either horizontally or vertically) so that the weighted average entropy of the two sub-rectangles gets minimized. This process is repeated recursively until the 2 sub-rectangles become single pixels. Technically, this approach is a modified KD Tree.
As indicated in the section below, the input images get compressed without losing resolution in the most informative regions.
Input image | Compressed image |
---|---|
Input image | Compressed image |
---|---|
Input image | Compressed image |
---|---|
Skeleton code and structures are provided by Prof. Cinda K. Heeren as part of a course on data structure and algorithm in University of British Columbia (UBC).
Raw source images are cited here:
temple image
fuji image
totem image