ColorFinder 1.1.0

dotnet add package ColorFinder --version 1.1.0                
NuGet\Install-Package ColorFinder -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ColorFinder" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ColorFinder --version 1.1.0                
#r "nuget: ColorFinder, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ColorFinder as a Cake Addin
#addin nuget:?package=ColorFinder&version=1.1.0

// Install ColorFinder as a Cake Tool
#tool nuget:?package=ColorFinder&version=1.1.0                

It just gets to all the pixels in the image and store their color value as a key in a hash map. The value is then the number of pixels of the same color encountered. However, this gives poor results so here are the improvements I wrote:
I treat at most 5000 pixels so if the image is bigger I start undersampling. This is an order of magnitude, not a certain rule.
To avoid noise due to flat areas (text, borders, ...) I start by right shifting all the RGB values by 6. So all the values are now between 0 and 3, allowing to encompass large areas of almost-the-same color. Then I perform another pass of the same algorithm (with a shift of 4) on all the pixels falling in the previous winning color group. And so on until I reach zero.
When trying to find the group that has the most pixels, I use a callback to weight the score. This allows customization and tell the algorithm you wand a rather dark color, you wan to exclude black, you want only highly saturated color excluding the greys or anything else you might think of.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 3,053 6/5/2015