iOS Library used to detect a number of most used colors in a UIImage.
pod 'TDImageColors', '~> 0.2'
Just download the source files and drag them into your project.
iOS Library used to detect a number of most used colors in a UIImage instace.
License: MIT License
Hi, I've noticed a problem in the isDistinct method while comparing colors in a black and white picture.
I was comparing black (RGB 0, 0, 0) and white (RGB 1, 1, 1) and I noticed that the method only compares colors channels by subtracting R and G channels and then R and B channels.
So 0 - 0 < threshold and 1 - 1 < threshold, resulting in white and black colors being considered as not distinct, returning only one color while processing my image.
I then added a control for luminance as well, so if the colors are both in a grey scale AND their luminance is within the threshold, then consider them to be similar, otherwise not.
// Check for grays
if (abs(r - g < 0.03f && fabs(r - b) < 0.03f)) {
if (fabs(rc - gc) < 0.03f && (fabs(rc - bc) < 0.03f)){
//Also check for luminance!!
if(fabs([self luminance] - [color luminance]) < threshold){
return NO;
}else{
return YES;
}
...
After this, the color extraction works for B&W images as well, returning a grey scale palette.
I hope this can help you!
Could you please add weight for each colour and calculate an array with sorted ones?
Is there a way to get the percentage of each of the 5 colours?
Hello Timominous,
Good to have your library in IOS, we also wanted the similar version in Android for our application.
Can you suggest some leads.
Thanks
Vicky
Could you explain the color retrieving algorithm in the readme or in a separate file?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.