Dimmable LED RGB color accuracy calibration solution

Currently, the RGB color grading scheme commonly used on the market is that the cloud or APP directly delivers sRGB (such as 255, 255, 255), and then simply and crudely converts it to pwm duty cycle, or grayscale value. This results in some inaccurate color mixing and noticeable color differences visible to the naked eye.

This article provides a new set of solutions.

First, get the color coordinates and maximum lumen value of the lamp bead through the R, G, and B lamp bead specifications.

Color coordinates

x

y

Y

R

0.6900

0.3100

50

G

0.1900

0.6100

150

B

0.1530

0.0278

30

Through the color mixing theorem, the colors inside the black triangle can be mixed out through these three lamp beads, and the color coordinates have nothing to do with lumens.

The cloud or APP still sends the sRGB value + brightness value, and then converts it to the expected xm, ym color values ​​on the device side, and then calculates the corresponding duty cycle or grayscale value through an algorithm.

duty cycle meter

xr = 0.6900  //R灯珠参数
yr = 0.3100
Yr = 50

xg = 0.1900 //G灯珠参数
yg = 0.6100
Yg = 150

xb = 0.1530 //B灯珠参数
yb = 0.0278
Yb = 40
Ym = 30  //给定一个固定值
//x,y为期望的色坐标

Dr = ((yg-yb)*(xb-x)+(y-yb)*(xg-xb)) / ((yg-yb)*(xb-xr)+(yr-yb)*(xg-xb)) * (yr * Ym) / (y * Yr) 
Dg = ((yb-yr)*(xr-x)+(y-yr)*(xb-xr)) / ((yb-yr)*(xr-xg)+(yg-yr)*(xb-xr)) * (yg * Ym) / (y * Yg) 
Db = ((yg-yr)*(xr-x)+(y-yr)*(xg-xr)) / ((yg-yr)*(xr-xb)+(yb-yr)*(xg-xr)) * (yb * Ym) / (y * Yb)

Add gamma calibration to the downloaded brightness, where the gamma value is set to 2.6 and the brightness range is 0~100.

Y = ((Y/100)^2.6)*100  //亮度调节校准

Grayscale value calculation, if the grayscale is 8 bits, the maximum is 255.

N = MAX(Dr,Dg,Db)
N = 1/N
Dr = 255 * Dr * N * Y
Dg = 255 * Dg * N * Y
Db = 255 * Db * N * Y

Give the final value to the driver and you're done.

This article only converts from color coordinates to duty cycle. You also need to convert sRGB into color coordinates. For the formula, refer to http://www.easyrgb.com/en/math.php

In addition, it involves super color gamut conversion, please read my other article.

Different color gamut conversion_xiaoredred's blog-CSDN blog_color gamut conversion

Guess you like

Origin blog.csdn.net/xiaoredred/article/details/125507487