fix whitecontent calculation

This commit is contained in:
interfisch 2020-12-18 00:11:28 +01:00
parent c6b19b06e8
commit f838530a04
1 changed files with 5 additions and 2 deletions

View File

@ -288,8 +288,11 @@ void dataMode(){
uint8_t calibW=135;
//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
float whitecontent=1.0 + (minval/255.0); //scale to: 0=no white, 1=full 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=min(float(r)/calibR, min(float(g)/calibG, float(b)/calibB));
//subtract white contents from rgb
r-=calibR*whitecontent;
g-=calibG*whitecontent;