Skip to content

Sorsel might be Popularity Algorithm #14

@gennyble

Description

@gennyble

seen first here: [Molecular Expressions: Color Reduction and Image Dithering][molexp]
[molexp]: https://micro.magnet.fsu.edu/primer/java/digitalimaging/processing/colorreduction/index.html

The popularity method of color reduction is one of several algorithms that have been created in an attempt to address the issue of color importance in image reconstruction. The design of this algorithm is intended to preserve those colors that occur most frequently in the image, but it is restricted in effectiveness by the fact that many images in microscopy have large areas of gray, black, or low-saturation colors. As a consequence, images that have been quantized by means of the popularity algorithm technique will often suffer from poor contrast, and important colors will often be absent from the quantized image, resulting in a loss of image detail.

but, upon reading the following page it seems that Sorsel is still different than the one described. It is a type of Popularity Algorithm most probably, though.
An Overview of Color Quantization Techniques: Popularity Algorithms

One possible implementation is to divide the space into regions 4x4x4 in size (262,144 regions). The original colors are again mapped to the region they fall in. The representative color for each region is the average of the colors mapped to it. The color map is selected by taking the representative colors of the 256 most popular regions (the regions that had the most colors mapped to them).

this paper might describe what Sorsel is doing: https://scialert.net/fulltext/fulltextpdf.php?pdf=ansinet/jas/2001/530-533.pdf

Dr. Yas Abbas, K. Alsultanny and Dr. Nidal Shilbayeh, 2001. Applying Popularity Quantization Algorithms on Color Satellite Images. Journal of Applied Sciences, 1: 530-533.

It's hard to tell if their described Dominant Factor (DF) is the same as our tolerance, but it's similar for sure. It seems that their DF works on a per-channel basis where our tolerance is full colour distance.

Kornelski's pngqant operates in a way that's similar to Sorsel, too, but it uses a modified median cut algorithm for quantization where we use popularity. https://pngquant.org/

To improve color further, histogram is adjusted in a process similar to gradient descent (Median Cut is repeated many times with more weight on poorly represented colors).


This is all to say, I will likely change Sorsel to be called Popularity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions