High-precision smooth and fast color conversion method

By generating interval curve parameters and performing interpolation calculations, the color conversion problem caused by insufficient LUT sampling accuracy in the prior art is solved, and a high-precision and fast color conversion effect is achieved.

CN119767155AActive Publication Date: 2025-04-04BEIJING DAYANG TECH DEV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411868198.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-04
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

In the prior art, due to the limitation of computing power, the sampling accuracy of LUT is low, resulting in obvious or uneven color blocks after color conversion, affecting the picture quality.

Method used

By generating interval curve parameters, curve parameters are generated for each adjacent sampling point based on the LUT discrete data, and stored in the buffer, the corresponding interval curve is found according to the input color value, and a high-precision interpolated color is calculated.

Benefits of technology

High-precision color conversion is realized, the color value is closer to the original color value, the calculation speed is fast, memory is saved, and the gamma color gamut conversion accuracy and work efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119767155A_ABST
    Figure CN119767155A_ABST
Patent Text Reader

Abstract

The invention relates to a high-precision smooth fast color conversion method. The method comprises the following steps: inputting LUT information; creating a quantization curve cache region; generating curve parameters; and calculating a color value according to the high-precision curve. According to LUT discrete data, interval curve parameters are generated for each adjacent sampling point and stored in a buffer area, corresponding interval curves are searched according to input color values, and high-precision interpolation colors are calculated according to the curves. According to the method, high-precision and rapid interval curve data can be generated according to original lut data, and a novel LUTCurve based on curve parameters can be generated, so that the problem of color conversion deviation caused by insufficient lut sampling number precision is solved, and an editor can feel color space conversion closest to reality. The color value calculated by the method can be very close to the original color value, and a large amount of memory hypothesis is saved, so that the calculation speed is higher, and the gamma color gamut conversion precision and the working efficiency are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a high-precision smooth and fast color conversion method, a video processing method, and a high-precision smooth and fast color conversion method based on a curve parameter lookup table generated by a LUT. Background Art

[0002] With the development of pan-media, there are more and more SD, HD, and UHD color gamuts and gamma parameters. When converting between these different standard or non-standard gamma color gamuts and realizing special color effects, LUT (Look Up Table) is needed. LUT comes from various sources, which stores information such as the number of color sampling points, the red, green, and blue three-channel arrays, and is divided into 1DLut and 3DLut. LUT is equivalent to a discrete function. Given an input value, an output value is obtained through a lookup table. Lookup tables can be used in many places. In the field of color adjustment, they are called color lookup tables. The color lookup table has three components R (red), G (green), and B (blue). The input components are usually called: Rin, Gin, and Bin; the output components are called Rout, Gout, and Bout. The input and output are in a one-to-one correspondence. The system finds the output value for each input value based on the correspondence in the lookup table, thereby completing the color conversion.

[0003] 1DLut is expressed as:

[0004] R out =F LUT (R in )

[0005] G out =F LUT (G in )

[0006] B out =F LUT (B in )

[0007] 1DLut stores a one-dimensional color array of red, green and blue channels. Assuming the sampling point is n, the array size of red, green and blue channels is n. Each array cell stores the color value of the red, green and blue channels.

[0008] 3DLut is expressed as:

[0009] R out =F LUT (R in , G in , B in )

[0010] G out =F LUT (Rin , G in , B in )

[0011] B out =F LUT (R in , G in , B in )

[0012] 3DLut stores the color array of the three-dimensional space of the red, green and blue channels. Assuming the sampling point is n, the size of each channel array of the red, green and blue channels is n times n times n. Each array cell stores the color value of the red, green and blue channels.

[0013] The higher the number of samples of the LUT, the higher the color conversion accuracy, but the amount of array data will increase dramatically. Taking 3DLut as an example, assuming the sampling accuracy is 33, the number of arrays is 3×35937, assuming the sampling accuracy is 64, the number of arrays is 3×262144, assuming the sampling accuracy is 256, the number of arrays is 3×16,777,216. The larger the array, the more computer memory is occupied, and the speed of table lookup operation will decrease dramatically. Therefore, LUT with high sampling rate is generally not generated.

[0014] In practice, due to the limitation of computing power, LUT can only sample with low sampling accuracy, resulting in obvious color blocks or uneven transitions in the converted colors, which affects the image quality. Therefore, how to further perform color data fitting processing on LUT, which requires both fast speed and data fitting as close to the original color as possible, is a problem that needs to be solved. Summary of the invention

[0015] In order to overcome the problems of the prior art, the present invention proposes a high-precision, smooth and fast color conversion method. The method generates interval curve parameters according to LUT discrete data, and then searches for the corresponding interval curve according to the color value to calculate the high-precision interpolation color. The calculated color value is closer to the original color value, and the calculation speed is fast, and the work efficiency is higher.

[0016] The object of the present invention is achieved by: a high-precision smooth and fast color conversion method, characterized in that the steps of the method are as follows:

[0017] Step 1, input LUT information: open the LUT file and read the LUT information, including: identifying 1D or 3D, and the number of sampling points;

[0018] Step 2, create a quantization curve buffer: create a quantization curve buffer according to the number and type of sampling points in the LUT file. For a 1D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively; for a 3D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively and then multiplied by the three dimensions of xyz;

[0019] Step 3, generate curve parameters: according to the sampling data of LUT, calculate the adjacent n elements of each sampling point along the same direction one by one, generate curve parameters, and store the curve parameters in the curve buffer array corresponding to the sampling point;

[0020] For 1D sampling points:

[0021] Get n adjacent points before and after the sampling points of the red channel, green channel, and blue channel for sampling respectively, plus the sampling point itself, the total number of samples N is N=n+1, calculate the curve parameters, and store them in the corresponding position of the one-dimensional interval curve array;

[0022] For 3D sampling points:

[0023] Get the values ​​of the sampling points of the red channel, green channel, and blue channel respectively:

[0024] For the x direction, take n points before and after the color sampling point along the x-axis direction for sampling, plus the sampling point itself, the total number of samples N is N = n + 1, and the curve parameters are calculated;

[0025] For the y direction, take n points before and after the color sampling point along the y axis for sampling, plus the sampling point itself, the total number of samples N is N = n + 1, and the curve parameters are calculated;

[0026] For the z direction, take n points before and after the color sampling point along the z axis for sampling, plus the sampling number N of the sampling point itself, a total of N = n + 1, and calculate the curve parameters;

[0027] The interval curve parameters of the three directions are stored in the corresponding positions of the corresponding three-dimensional interval curve parameter arrays respectively;

[0028] After generating the interval curve parameter array data, the curve array is stored as a new type of interval curve lookup table file, which can be directly opened next time without recalculating the curve buffer;

[0029] Step 4: Calculate the color value based on the high-precision curve: Based on the input color value, according to the curve formula:

[0030] s(x)=a+bx+cx^2+dx^3

[0031] Calculate the corresponding curve in the corresponding curve array, and calculate the color value according to the curve parameters;

[0032] Where: s(x) is the curve function; a, b, c, d are the curve parameters.

[0033] The advantages and beneficial effects of the present invention are as follows: the present invention generates interval curve parameters for each adjacent sampling point according to LUT discrete data, and stores them in a buffer, searches for the corresponding interval curve according to the input color value, and calculates the high-precision interpolation color according to the curve. The method described can generate high-precision and fast interval curve data according to the original LUT data, and can generate a new LUT file (LUTCurve) based on the curve parameters, thereby solving the deviation in color conversion caused by insufficient accuracy of the LUT sampling number, and allowing editors to experience the color space conversion closest to reality. The color value calculated in this way can be very close to the original color value, and a large amount of memory assumptions are saved, making the calculation speed faster, and greatly improving the gamma color domain conversion accuracy and work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0035] Figure 1 is a flow chart of the method described in an embodiment of the present invention;

[0036] Figure 2 It is a schematic diagram of LUD3D coordinates. DETAILED DESCRIPTION

[0037] Example:

[0038] This embodiment is a high-precision, smooth and fast color conversion method, the process of the method is as follows: Figure 1 As shown, the following steps are included:

[0039] Step 1, input LUT information: open the LUT file and read the LUT information, including: identifying 1D or 3D, and the number of sampling points.

[0040] The LUT file contains a lot of content. This step is only concerned with identifying the curve array type of the LUT: whether it is 1D or 3D, and the number of sampling points.

[0041] Step 2, create a quantization curve buffer: Create a quantization curve buffer according to the number and type of sampling points in the LUT file. For a 1D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively. For a 3D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively and then multiplied by the three dimensions of xyz.

[0042] The way to create the quantization curve buffer is different for 1D and 3D files, respectively:

[0043] For a 1D buffer, it is composed of three one-dimensional interval curve parameter arrays, namely red, green and blue arrays. The length of each array is the number of samples, and each array unit stores a curve parameter.

[0044] Assume: the number of samples is N,

[0045] The parameter size of the 1D curve is G (the number of parameters and the space occupied by different curves are different)

[0046] Then the overall buffer size Size = 3*N*G

[0047] The red array occupies N*G;

[0048] The green array occupies N*G;

[0049] The blue array occupies N*G;

[0050] The above is applicable to the sampling curve of RGB color space, and is also applicable to YUV space. YUV space is represented by three channels: Y, U, and V.

[0051] The 3D buffer consists of three 3D interval curve parameter arrays, one for red, green and blue channels, each 3D array uses xyz to represent three dimensions. Each array cell stores three curve parameters (xyz directions), x horizontal, y vertical, z depth.

[0052] Assume: the number of samples is N,

[0053] The 3D curve parameter size is G (different curve parameters have different numbers and occupy different spaces)

[0054] Then the overall size of the buffer is size = 3*N(x)*N(y)*N(z)*G

[0055] The red three-dimensional array occupies N(x)*N(y)*N(z)*G;

[0056] The green three-dimensional array occupies N(x)*N(y)*N(z)*G;

[0057] The blue three-dimensional array occupies N(x)*N(y)*N(z)*G.

[0058] Step 3, generate curve parameters: According to the sampling data of LUT, calculate the adjacent n elements of each sampling point along the same direction one by one, generate curve parameters, and store the curve parameters in the curve cache array corresponding to the sampling point.

[0059] For 1D sampling points: obtain the sampling points of the red, green, and blue channels respectively for sampling, calculate the curve parameters and store them.

[0060] Get n adjacent points before and after the sampling points of the red channel, green channel, and blue channel for sampling respectively, plus the sampling point itself, the total number of samples N is N=n+1, calculate the curve parameters, and store them in the corresponding positions of the one-dimensional interval curve array.

[0061] For 3D sampling points: Get the values ​​of the sampling points of the red, green, and blue channels respectively: For the x, y, and z directions, take color sampling points along the x, y, and z axes respectively to sample and calculate the curve parameters.

[0062] Get the values ​​of the sampling points of the red channel, green channel, and blue channel respectively:

[0063] For the x direction, n points before and after the color sampling point are sampled along the x-axis direction, and the sampling point itself is added, so the total number of samples N is N=n+1, and the curve parameters are calculated.

[0064] For the y direction, n points before and after the color sampling point are sampled along the y axis, and the sampling point itself is added, so the total number of samples N is N=n+1, and the curve parameters are calculated.

[0065] For the z direction, n points before and after the color sampling point are sampled along the z axis, and the number of samples N of the sampling point itself is added, totaling N=n+1, to calculate the curve parameters.

[0066] Taking the red channel as an example, for all sampling points, the interval curve parameters are calculated one by one. Taking the cubic spline curve as an example, the values ​​of the three adjacent sampling points before and after the sampling point (a total of 4 point values) are taken to calculate the cubic spline curve parameters and store them in the corresponding position of the curve array. For 1D, only one dimension needs to be calculated, and for 3D, the three directions of x, y, and z need to be calculated. The remaining two green and blue channels are processed in the same way.

[0067] The specific process is: take the generation of a cubic spline curve as an example (the curve is not limited to a specific curve, it can be a cubic spline curve or a fitting curve. In short, the curve whose value is closest to restoring the true original color is the best).

[0068] Generation of 1D curve parameter array:

[0069] Red channel: Take the three adjacent elements before and after the sampling point p (1DLut red color value), the previous point is p0, the next point is p1, and the next point is p2, a total of four sampling points. Then the parameters of the interval curve s(x) = a+bx+cx^2+dx^3 of this point can be calculated as a, b, c, d. And store the curve parameters in the interval curve cache array of the corresponding sampling point.

[0070] The green channel and blue channel interval curve parameter tables are generated by this method.

[0071] Generation of 3D curve parameter array:

[0072] Red Channel:

[0073] For the x direction, take the three adjacent elements before and after the sampling point p (3DLut red color value), the first point is p0, the second point is p1, and the third point is p2, a total of four sampling points. Then the interval curve of the point can be calculated

[0074] The parameters of s(x)=a+bx+cx^2+dx^3 are aX, bX, cX, dX

[0075] For the y direction, take the three adjacent elements before and after the sampling point p (3DLut red color value), the first point is p0, the second point is p1, and the third point is p2, a total of four sampling points. Then the interval curve of the point can be calculated

[0076] The parameters of s(x)=a+bx+cx^2+dx^3 are aY, bY, cY, dY

[0077] For the z direction, take the three adjacent elements before and after the sampling point p (3DLut red color value), the first point is p0, the second point is p1, and the third point is p2, a total of four sampling points. Then the interval curve of the point can be calculated

[0078] The parameters of s(x)=a+bx+cx^2+dx^3 are aZ, bZ, cZ, dZ

[0079] The green channel and blue channel interval curve parameter tables are generated by this method.

[0080] The interval curve parameters in these three directions are stored in corresponding positions of the corresponding three-dimensional interval curve parameter arrays.

[0081] After generating the interval curve parameter array data, the curve array is stored as a new type of interval curve lookup table file (the specific format of the generated interval curve parameter comparison table can be formulated as needed) for directly opening the file next time without recalculating the curve buffer.

[0082] Step 4, calculate the color value according to the high-precision curve: calculate the corresponding curve in the corresponding curve array according to the input color value, and calculate the color value according to the curve parameters.

[0083] When the program transforms the input color, it corresponds to the corresponding position of the interval curve array according to the input color value, and calculates the converted color value according to the curve formula s(x)=a+bx+cx^2+dx^3. This process is exactly the same as the LUT search for corresponding data, except that the corresponding tables are different, the corresponding element meanings are different, and the calculation method of the values ​​is also different. For 1Dlut, you only need to find the corresponding position of the interval curve array, and then use the curve formula to calculate the value, which is the color value.

[0084] For example, p=f*N; N is the number of samples, f is the color value, and p is a floating point number.

[0085] Round p to P, then use P (index value) to locate the element position in the interval curve array and obtain the curve parameters a, b, c, d.

[0086] x=pP; x is the fractional part of the position.

[0087] s(x)=a+bx+cx^2+dx^3

[0088] Substitute it into the formula to find the new color value. Here, the red, green, and blue or YUV channels are calculated independently.

[0089] For 3Dlut, you need to find the corresponding position corresponding to the interval curve array. Here, there are three plane positions to choose from according to the color value, and each plane requires 4 positions to be positioned.

[0090] xyz represents the red, green and blue (RGB) coordinates and values, respectively, or YUV space coordinates. For LUT3D, each small square in the coordinate represents a color value, such as Figure 2 As shown. For the interval curve parameter array, each small square stores the curve parameters in three directions. There are three such three-dimensional arrays, namely the red interval curve parameter three-dimensional array, the green interval curve parameter three-dimensional array, and the blue interval curve parameter three-dimensional array). The red, green, and blue channel color values ​​are calculated in their respective interval curve parameter arrays. The method of finding the position is to use the red, green, and blue color values ​​as indexes at the same time. The index value p = f*N; N is the number of samples, f (red, green, and blue) is the color value, and p is a floating point number. Round p to P, and then use P (index value) to locate the element position in the interval curve parameter array.

[0091] xz (red and blue) two-dimensional plane, P0 (x0, y0, z0); P1 (x1, y0, z0); P2 (x1, y0, z1); P3 (x0, y0, z1);

[0092] xy (red and green) two-dimensional plane, P0(x0,y0,z0); P1(x1,y0,z0); P2(x1,y1,z0); P3(x0,y1,z0);

[0093] yz (green and blue) two-dimensional plane, P0(x0,y0,z0); P1(x0,y1,z0); P2(x0,y1,z1); P3(x0,y0,z1);

[0094] The P0 position is the color value multiplied by the number of samples. P1 P2 P3 are points on the plane coordinates.

[0095] For the xz plane, P0(x, z), P1(x+1, z), P2(x+1, z+1), P3(x, z+1).

[0096] For the xy plane, P0(x, y), P1(x+1, y), P2(x+1, y+1), P3(x, y+1).

[0097] For the yz plane, P0(y,z), P1(y+1,z), P2(y+1,z+1), P3(y,z+1).

[0098] For the xz two-dimensional plane, take the four curve parameters in the y (vertical) direction, and you can calculate four values ​​(c0, c1, c2, c3) based on the curve. These four values ​​are then interpolated using the decimal parts of the x and z positions (dx, dz), which are the color values.

[0099] cT0=c0*(1-dz)+c3*dz;

[0100] cT1=c1*(1-dz)+c2*dz;

[0101] Cxz=cT0*(1-dx)+cT1*dx;

[0102] Cxz is the output conversion value.

[0103] For the xy two-dimensional plane, take the four curve parameters in the z (vertical) direction, and you can calculate four values ​​(c0, c1, c2, c3) based on the curve. These four values ​​are then interpolated using the decimal parts of the x and y positions (dx, dy) to get the color value.

[0104] cT0=c0*(1-dy)+c3*dy;

[0105] cT1=c1*(1-dy)+c2*dy;

[0106] Cxy=cT0*(1-dx)+cT1*dx;

[0107] Cxy is the output conversion value.

[0108] For the yz two-dimensional plane, take the four curve parameters in the x (vertical) direction, and you can calculate four values ​​(c0, c1, c2, c3) based on the curve. These four values ​​are then interpolated using the decimal parts of the y and z positions (dy, dz), which are the color values.

[0109] cT0=c0*(1-dz)+c3*dz;

[0110] cT1=c1*(1-dz)+c2*dz;

[0111] Cyz=cT0*(1-dy)+cT1*dy;

[0112] Cyz is the converted value of the output.

[0113] You can also calculate the values ​​of these three two-dimensional planes and take the average value as the output conversion value ((Cxz+Cxy+Cyz) / 3). Here, the red, green, and blue or YUV channels are calculated independently.

[0114] Finally, it should be noted that the above is only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred arrangement scheme, a person of ordinary skill in the art should understand that the technical solution of the present invention (such as the format of the video or image, the use of various formulas, the sequence of steps, etc.) can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A high-precision, smooth and fast color conversion method, characterized in that: The steps of the method are as follows: Step 1, input LUT information: open the LUT file and read the LUT information, including: identifying 1D or 3D, and the number of sampling points; Step 2, create a quantization curve buffer: create a quantization curve buffer according to the number and type of sampling points in the LUT file. For a 1D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively; for a 3D buffer, it is divided into three channels of red, green and blue, multiplied by the number of samples respectively and then multiplied by the three dimensions of xyz; Step 3, generate curve parameters: according to the sampling data of LUT, calculate the adjacent n elements of each sampling point along the same direction one by one, generate curve parameters, and store the curve parameters in the curve buffer array corresponding to the sampling point; For 1D sampling points: Get n adjacent points before and after the sampling points of the red channel, green channel, and blue channel for sampling respectively, plus the sampling point itself, the total number of samples N is N=n+1, calculate the curve parameters, and store them in the corresponding position of the one-dimensional interval curve array; For 3D sampling points: Get the values ​​of the sampling points of the red channel, green channel, and blue channel respectively: For the x direction, take n points before and after the color sampling point along the x-axis direction for sampling, plus the sampling point itself, the total number of samples N is N = n + 1, and the curve parameters are calculated; For the y direction, take n points before and after the color sampling point along the y axis for sampling, plus the sampling point itself, the total number of samples N is N = n + 1, and the curve parameters are calculated; For the z direction, take n points before and after the color sampling point along the z axis for sampling, plus the sampling point itself, the total number of samples N is N = n + 1, and the curve parameters are calculated; The interval curve parameters of the three directions are stored in the corresponding positions of the corresponding three-dimensional interval curve parameter arrays respectively; After generating the interval curve parameter array data, the curve array is stored as a new type of interval curve lookup table file, which can be directly opened next time without recalculating the curve buffer; Step 4: Calculate the color value based on the high-precision curve: Based on the input color value, according to the curve formula: s(x)=a+bx+cx^2+dx^3 Calculate the corresponding curve in the corresponding curve array, and calculate the color value according to the curve parameters; Where: s(x) is the curve function; a, b, c, d are the curve parameters.

Citation Information

Patent Citations

  • Color reproduction method

    CN101361096A

  • Gamma correction method, gamma correction device and computer readable storage medium

    CN109637422A

  • Color lookup table generation method and color correction method

    CN117612470A

  • Ocean data visual color mapping method based on unreal engine

    CN118840464A

  • Color correction apparatus, device and method for outputting color correction data

    JP2011004021A