Different color gamut conversion

In the design of adjustable RGB LED lights, we will encounter the problem that some standard color gamut colors cannot be displayed. As shown in the picture below, the standard color gamut sRGB is a black triangle, and the red triangle is our actual lamp bead parameter. In the picture, you can see that some colors in the upper right and lower left exceed the colors that our lamps can actually adjust. This will cause color calibration errors. A negative value appears.

 Through observation, it is found that the color beyond the part is similar to the nearby color, and it is difficult for the human eye to distinguish clearly.

Through this, we can map the excess to the red triangle edge.

But the question arises, how should it be mapped? Is it a perpendicular line passing through the super color gamut point as the side of the red triangle, or something else.

Through testing, we found that the center point of the graph is white and radiates to the surroundings from this point, so we select the sRGB white point (0.3127, 0.329), and connect the super color gamut points through this point, and the intersection point with the red triangle edge is the mapping point.

The next step is to solve the two straight line equations, but the results are often infinitesimals. You need to know when to carry and when to discard. For example, in the upper right corner, if the calculated number is (0.512367, 0.423785), we take four decimal places. To ensure that it is within the red triangle, we should adopt the discarding end strategy. The processed data is (0.5123, 0.4237). For example, in the lower left corner, the calculated result is (0.152342, 0.067543), x needs to be carried, y needs to be rounded, and the final processed data is (0.1524, 0.0675).

// 超色域映射
  if (y > ((yg - yr) / (xg - xr) * x + yg - (yg - yr) / (xg - xr) * xg))
    {
        x = (yw - yg + (yg - yr) / (xg - xr) * xg - (yw - y) / (xw - x) * xw) / ((yg - yr) / (xg - xr) - (yw - y) / (xw - x));
    }
    if (y > ((yg - yb) / (xg - xb) * x_tmp + yg - (yg - yb) / (xg - xb) * xg))
    {
        x = (yw - yg + (yg - yb) / (xg - xb) * xg - (yw - y) / (xw - x) * xw) / ((yg - yb) / (xg - xb) - (yw - y) / (xw - x));
    }

    if ((y > ((yg - yr) / (xg - xr) * x_tmp + yg - (yg - yr) / (xg - xr) * xg)) || (y > ((yg - yb) / (xg - xb) * x_tmp + yg - (yg - yb) / (xg - xb) * xg)))
    {
        y = (yw - y) / (xw - x) * x + yw - (yw - y) / (xw - x) * xw;
    }

After testing, it was found that this method is very reliable and the color display is accurate.

I compiled a table, input the super color gamut coordinates, and the corresponding mapping points will be calculated. It provides two sets of algorithms, one is the vertical algorithm, and the other is the intersection algorithm of the white point connection. It is recommended to use the white point connection algorithm. The connections are as follows.

sRGB Super Color Gamut Conversion Yxy-MCU Documentation Resources-CSDN Download In the design of adjustable RGB LED lamps, we will encounter the problem that some standard color gamut colors cannot be displayed. As shown below, the standard color gamut sRGB is black. For more download resources and learning materials, please visit the CSDN download channel. https://download.csdn.net/download/xiaoredred/85826429 The materials are all original and not easy to edit. Thank you for your support.

Everyone is also very welcome to point out mistakes and learn and improve together.

Guess you like

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