如何从Philips Hue中的ct获取XY值?

问题描述

如何从ct获取XY值。

例如: ct = 217,我想得到x =“ 0.3127569”,y =“ 0.32908”。

我可以使用以下代码将XY值转换为ct值。

        float R1 = [hue[0] floatValue];
        float S1 = [hue[1] floatValue];
        
        float result = ((R1-0.332)/(S1-0.1858));
        
        NSString *ctString = [NSString stringWithFormat:@"%f",((-449*result*result*result)+(3525*result*result)-(6823.3*result)+(5520.33))];
        
        float micro2 = (float) (1 / [ctString floatValue] * 1000000);
        
        NSString *ctValue = [NSString stringWithFormat:@"%f",micro2];
        ctValue = [NSString stringWithFormat:@"%d",[ctValue intValue]];
        if ([ctValue integerValue] < 153) {
            ctValue = [NSString stringWithFormat:@"%d",153];
        }

现在我想要取反数值,从ct到XY。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)