RGB to Lab color space conversion

I. Introduction

As the printing industry changes from analog to digital, the problem of accurate color reproduction has become critical. We need to use color management to ensure better, faster, and more accurate color images. In order to achieve color uniformity and device independence in the process of image processing, it is necessary to implement standardized and standardized color management.

The so-called color management is to solve the problem of image conversion between colors, so that the color of the image is minimized during the entire copying process. The basic idea is to first select a device-independent reference color space, then characterize the device, and finally establish a relationship between the color space of each device and the device-independent reference color space, so that the data file is in each device. There is a clear relationship between the transitions. While it's impossible to have all the colors on different devices exactly the same, you can use color management to ensure that most colors are the same or similar to achieve a consistent color copying effect.

Second, color space conversion

Color space conversion refers to converting or representing color data in one color space into corresponding data in another color space, that is, using the data in different color spaces to represent the same color. In this paper, the device-dependent RGB color space is converted to a device-independent CIELab color space. Any color space associated with the device can be measured and calibrated in the CIELab color space. If different device-related colors correspond to the same point in the CIELab color space, then the transition between them must be accurate.

There are many ways to convert color space. This paper mainly introduces 3D table interpolation and polynomial regression.

1. Three-dimensional table look-up interpolation

The three-dimensional lookup table method is currently a commonly used algorithm for studying color space conversion. The core idea of ​​the 3D lookup table algorithm is to divide the source color space into a regular cube. The data of the eight vertices of each cube is known, and the known points of all source spaces form a three-dimensional. Lookup table. When any point in the source space is given, the eight data points adjacent to it can be found to form a node of a small cube lattice, and the eight vertices of the small cube are interpolated to obtain data corresponding to the target space.

The general lookup table method is used in combination with the interpolation method and becomes a three-dimensional lookup table method with an interpolation algorithm. This method can be divided into three steps:

1 segmentation: partition the source color space at a certain sampling interval to establish a three-dimensional lookup table;
2 Find: For a known input point, search the source space and find the cube consisting of eight grid points containing it;
3 Interpolation: Calculate the color values ​​on non-grid points in a grid of cubes.
According to different segmentation methods of source space, common interpolation algorithms are: trilinear interpolation, triangular prism interpolation, pyramid interpolation and tetrahedral interpolation.

Polynomial regression

The polynomial regression algorithm is based on the assumption that the association of color spaces can be estimated by a set of simultaneous equations. The only necessary condition for the polynomial regression algorithm is that the number of points in the source space should be greater than the number of items in the selected polynomial. The focus of this algorithm is to calculate the coefficients of the polynomial, and then substitute the data of the source color space into the polynomial, and then the converted result can be obtained according to the equation.

Polynomial regression algorithm is simple, easy to implement, and has a good conversion effect; but the accuracy is low when the number of items is small, when the number of items is too large, the calculation amount is large, and the precision is not necessarily high.

3. Color difference

When evaluating the color reproduction quality and controlling the color reproduction process, for example, when implementing color management and evaluating the color of a print, it is often necessary to calculate the color difference of the color to achieve the purpose of controlling the color. At present, the CIE 1976 Lab uniform color space and its corresponding color difference formula are commonly used in the printing industry. [next]

Third, the realization process

Firstly, the operation platform of this topic is briefly introduced, and the method of obtaining the data used in this topic and the detailed steps of realizing the color space conversion are explained in detail.

Operating platform

The operating system used in this topic is Microsoft Windows XP, the programming environment is Visual C++ 6.0, the entire application is based on the MFC application framework, and OpenGL and OpenCV are also used.

2. Data acquisition

The data is divided into two parts: modeling data and test data. The modeling data is used to calculate the coefficients of the polynomial. The test data is used to analyze the accuracy of the algorithm. The modeling data and test data from the source space and the target space are all in Adobe Photoshop. Collected.

1 acquisition of modeling data. This topic uses six levels of uniform segmentation to collect modeling points, and R, G, and B take 0, 51, 102, 153, 204, and 255, respectively. Input the values ​​of R, G, and B in the color picker of PhotoShop, and record the values ​​of L, a, and b corresponding to the set of values, and record them in the text. A total of 63 = 216 sets of values ​​were obtained.

2 Acquisition of test data This topic uses eight-level non-uniform segmentation to collect test points. R, G, and B respectively take 0, 36, 72, 108, 144, 180, 216, 255. The acquisition method is the same as above, and a total of 83=512 group values ​​are obtained.

3. Specific implementation steps

The specific steps of the program implementation are as follows:

1 Start Visual C++ 6.0 first, and set the OpenCV runtime environment in MFC.
2 Read the modeling data.
3 Completion of the calculation of the polynomial coefficients: according to formulas (3), (4), (5), respectively. The coefficients of the polynomial are obtained by sequentially obtaining , , and .
4 Read the test data.
5 Draw a three-dimensional color view of the corresponding Lab model after eight-level segmentation of the RGB model.
6 Bring the RGB values ​​of each point obtained by the eight-stage segmentation into the three polynomials obtained in step 3, and calculate the L, a, and b values ​​of each point (hereinafter referred to as the calculated value), thereby Convert RGB color space to Lab color space by polynomial regression.
7 In order to judge the merits of this color space conversion method, it is necessary to judge by calculating the color difference. For each color, the measured value obtained in step 4 is obtained by subtracting the calculated value obtained in step 6, and then the color difference is obtained according to formula 6, the histogram of the excellent difference distribution is drawn, and the difference is in the range of different color differences. proportion.

Fourth, the results display and analysis

According to the specific steps in the previous section, VC++6.0 is used to realize the conversion of RGB to Lab color space in PhotoShop. This section mainly displays the running results of the program and performs a brief analysis.

V. Summary

It can be seen that the use of polynomial regression to perform color space conversion is relatively accurate. The polynomial of different item numbers can be used to compare the conversion results of the same source space to the same target space; thereby finding out the optimal number of polynomials in the process of converting the source space into the target space. Therefore, further research is needed on this topic.

Article source address: http://

Microfiber Mops

The microfiber mops are produced by kinds of mop cleaning fabric,there are many kinds of microfibre mop refills and with different usage,like Microfiber Tube Mop,microfiber string mop,Microfiber Wet And Dry Mop,Microfiber Dust Mop.They are all knitting by 80% polyester,20% polyamide microfiber yarn which have high water absorbtions and excellent cleaning ability.Also microfiber mops are easy to use because they are lighter and more agile than the mop and bucket combination.

Microfibre Velcro Wet And Dry MopHardwood Micorifberwet Dry MopWholesale Mcirofiber Wet Mop Head

Microfiber Mops,Microfibre Mop,Microfiber Mop Heads,Microfiber Mop Pads,microfibra mop refill

jiangsu qiyun cleaning knitting product co.,ltd , https://www.jarfrry.com