Closed CrazyCoder closed 10 years ago
We have a few colour conversion methods in the PHUtilities class in the SDK.
There is a little code snippet for setting RGB values in the 'Coding Tips' section in the below link: https://github.com/PhilipsHue/PhilipsHueSDK-Java-MultiPlatform-Android/blob/master/Documentation/HackathonQuickStart.md
Let me know if this helps.
Thanks for the tip, I've already tried the suggested PHUtilities.calculateXYFromRGB
method, but it's not really what convertRGBtoXY_final
method in ambilight+hue app is doing. The main difference is that the latter somehow calculates the brightness of the hue lamps basing on the RGB colors of ambilight leds. Here is the poorly decompiled fragment. paramAtomicInteger1
is set inside the method to the brightness level and is used later in the code to set hue lamp brightness.
iOS Hue SDK seems to have something related, but Java PHUtilities
doesn't have methods that return brightness, only XY.
Unfortunately I can't help you with the ambilight code. This was developed by an external company which appears to be a wrapper on top of the SDK and I have no knowledge of its inner workings. This is a little bit out of my domain sorry.
As far I am aware the brightness is obsolete in the iOS SDK due to it's innaccuracy.
OK, I've contacted ambilighthue@tpvision.com a couple of days ago, but got no response yet.
I've found some details about the algorithm here.
I've managed to reuse Android classes (bytecode) in the desktop Java application and it works perfectly. Algorithm in the documentation produces completely different colors that do not match ambilight colors/brightness. Android/iOS ambilight+hue app uses different transformation matrix leading to more accurate results.
Good news. Am pleased you got it working.
I've published the first version of my HAmbiSync application here: http://amip.tools-for.net/hambisync
I'm trying to create a desktop and server version of the ambilight+hue mobile application and stuck with the colors conversion as this part is not available via SDK or the source code. Also, algorithm seems to be pretty complex.
It would be nice if it becomes a part of the SDK or if the source becomes open.
Please check my forum post for more details.