Open buranmert opened 9 years ago
Hello @ruuki
I was wondering if your current port is taking into account the neutral choice of the demo (on the webpage) or the favor saturated. Indeed, I'm struggling to get the most dominant saturated color in a picture in objective-c and I was wondering if yours was doing that or if it could be possible.
Thanks!
if you really know what you need in terms of RGB, you can easily add a filter to that line: https://github.com/ruuki/ColorFinder/blob/master/ColorFinder/UIImage%2BColorFinder.m#L109
I left a commented out filter there as an example. But no, without adding your own filter you can't extract the most saturated dominant color from an UIImage with ColorFinder :(
Hello @ruuki
Thanks for your answer.
Ok that's too bad. I tried to add the formula explain here, the favorHue:
function favorHue(r,g,b) { return (Math.abs(r-g)_Math.abs(r-g) + Math.abs(r-b)_Math.abs(r-b) + Math.abs(g-b)_Math.abs(g-b))/65535_50+1; }
by adding a "weight" variable in each point and by returning the most weighted point of the selected cluster at the end of your algorithm (tempCluster) but I'm still not satisfied with the result. If you have any idea it would be great and I think a great addition to be as close as the javascript version (here: http://pieroxy.net/blog/pages/color-finder/guide.html)
Thanks again!
maybe you can add the same point (with same RGB values) multiple times to achieve what you try to achieve by adding weight variable to each point. otherwise, you should modify updateCenterWithNewPoint method and consider the weights of individual points.
but my approach would be filtering out the points which have lower hue values and ignoring them in the first place.
add pre-set configs to find bright-dark colors