luminance

Dot Product and Luminance/ Findmyicone

帅比萌擦擦* 提交于 2019-11-29 16:38:45
All, I have a basic question that I am struggling with here. When you look at the findmyicone sample code from WWDC 2010, you will see this: static const uint8_t orangeColor[] = {255, 127, 0}; uint8_t referenceColor[3]; // Remove luminance static inline void normalize( const uint8_t colorIn[], uint8_t colorOut[] ) { // Dot product int sum = 0; for (int i = 0; i < 3; i++) sum += colorIn[i] / 3; for (int j = 0; j < 3; j++) colorOut[j] = (float) ((colorIn[j] / (float) sum) * 255); } And then it is called: normalize(orangeColor, referenceColor); Running the debugger, it is converting BGRA: (Red

Dot Product and Luminance/ Findmyicone

瘦欲@ 提交于 2019-11-28 10:31:41
问题 All, I have a basic question that I am struggling with here. When you look at the findmyicone sample code from WWDC 2010, you will see this: static const uint8_t orangeColor[] = {255, 127, 0}; uint8_t referenceColor[3]; // Remove luminance static inline void normalize( const uint8_t colorIn[], uint8_t colorOut[] ) { // Dot product int sum = 0; for (int i = 0; i < 3; i++) sum += colorIn[i] / 3; for (int j = 0; j < 3; j++) colorOut[j] = (float) ((colorIn[j] / (float) sum) * 255); } And then it