fix whitecontent calculation
This commit is contained in:
parent
c6b19b06e8
commit
f838530a04
|
@ -288,8 +288,11 @@ void dataMode(){
|
||||||
uint8_t calibW=135;
|
uint8_t calibW=135;
|
||||||
|
|
||||||
//one of calibR,calibG or calibB should be 255.
|
//one of calibR,calibG or calibB should be 255.
|
||||||
int minval=min(r-calibR,min(g-calibG,b-calibB)); //0 if rgb contains full white. <0 if not full white. -1*(max(calibR,calibG,calibB)) if no white content
|
//int minval=min(r-calibR,min(g-calibG,b-calibB)); //0 if rgb contains full white. <0 if not full white. -1*(max(calibR,calibG,calibB)) if no white content
|
||||||
float whitecontent=1.0 + (minval/255.0); //scale to: 0=no white, 1=full white content
|
//float whitecontent=1.0 + (minval/255.0); //scale to: 0=no white, 1=full white content
|
||||||
|
|
||||||
|
float whitecontent=min(float(r)/calibR, min(float(g)/calibG, float(b)/calibB));
|
||||||
|
|
||||||
//subtract white contents from rgb
|
//subtract white contents from rgb
|
||||||
r-=calibR*whitecontent;
|
r-=calibR*whitecontent;
|
||||||
g-=calibG*whitecontent;
|
g-=calibG*whitecontent;
|
||||||
|
|
Loading…
Reference in New Issue