kershner / screenBloom

Fake Ambilight for Philips Hue via Python
http://www.screenbloom.com
329 stars 48 forks source link

Computing dominant colour by frequency analysis #81

Closed CedricHerzog closed 7 months ago

CedricHerzog commented 6 years ago

Hi,

I tried to find the dominant color using a frequency analysis instead of an average. It is based on this paper: https://zeevgilovitz.com/detecting-dominant-colours-in-python

I think it gives promising results. Do you think it worth the shot continuing? Maybe we can let the user choosing between those two methods?

kershner commented 6 years ago

Hey there! Awesome work. I've tried implementations of K-Means clustering in the past but it adds latency to the update loop and the results I thought weren't very good, or at least no better than a simple and fast RGB average. Not to mention there are elements of randomness in the calculation, so sometimes you'd get a completely wacky color instead of what you'd expect.

I like the idea of using the "most used color" though. Might try and experiment with that someday.

With the release of Hue Sync on the horizon this project is kinda rapidly reaching its end of life, so I don't foresee having much time or drive to merge this in, do all the testing, and then re-build for the two platforms ScreenBloom supports. I'll leave the pull request open for now in any case.

Aerinx commented 6 years ago

This would be awesome, as I came to Screenbloom after another abandoned project stopped working properly and I remember that the first think I thought is that Screenbloom had better UI and approach but the coloring was a lot worse, and it just doesn't work well when images don't have the same predominant color all over them.