Color gamut compression method, device, computer equipment, storage medium and program product
By determining the tip points of the color gamut boundary in the OKLab color space and performing Bezier curve adjustments, the color distortion and detail loss problems in traditional color gamut compression algorithms are solved, achieving more accurate color restoration and picture detail retention.
Patent Information
- Application Number
- CN202411962607.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-12-30
AI Technical Summary
Traditional color gamut compression algorithms are prone to color distortion and detail loss when color signals move from a large color gamut to a small color gamut.
The OKLab color space is used for transformation processing. By determining the tip point of the color gamut boundary in the LCH color space and adjusting the boundary using the Bezier curve, the color data is mapped and inversely transformed in combination with the contraction coefficient to ensure that the color data is within the color gamut and achieve color gamut compression.
It effectively avoids color distortion and detail loss, retains color level differences, and makes the picture details richer.
Smart Images

Figure CN119383281B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a color gamut compression method, apparatus, computer equipment, storage medium, and program product. Background Art
[0002] Color gamut compression is part of color management, and its purpose is to achieve more accurate end-to-end color reproduction. During the transmission process of color signals between light, cameras, screens and other devices, they may need to adapt to multiple standards. For example, the camera encodes in a large color gamut (such as rec2020), while the screen expresses it in a small color gamut (such as sRGB). In the process of color signals entering the small color gamut from the large color gamut, colors that overflow the color gamut usually appear, so a color gamut compression algorithm needs to be used for processing.
[0003] Traditional color gamut compression algorithms, such as those in the ACES (Academy Color Encoding Specification), are primarily based on the DaVinci Colorspace Transform Language (DCTL). Their core concept is to achieve color gamut compression by determining compression thresholds in the Yxy color space. However, using this color gamut compression algorithm can still result in color distortion and loss of detail. Summary of the Invention
[0004] Based on this, it is necessary to provide a color gamut compression method, device, computer equipment, storage medium and program product to address the above technical problems, which can effectively avoid the problems of color distortion and detail loss during the color gamut compression process.
[0005] In a first aspect, the present application provides a color gamut compression method, the method comprising:
[0006] When encoding the original color data obtained by the sensor into the standard color space, the obtained encoded color data is transformed into the OKLab color space to obtain first color data; the first color data includes brightness, a first color component and a second color component;
[0007] Performing space transformation processing on the first color component and the second color component to obtain chroma and hue in an LCH color space; the chroma, the hue, and the brightness constitute second color data;
[0008] Taking the endpoint with the maximum chroma of the LCH color space as the tip of the color gamut boundary, finding the tip point under each isochromatic plane, and determining the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition;
[0009] Mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data that is within the color gamut boundary;
[0010] Performing a spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in the standard color space.
[0011] In one embodiment, the method further comprises:
[0012] Performing boundary adjustment on the color gamut boundary to obtain a reshaped color gamut boundary;
[0013] Mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary includes:
[0014] The second color data that overflows the reshaped color gamut boundary is mapped into the boundary to obtain the second color data that is within the reshaped color gamut boundary.
[0015] In one embodiment, adjusting the color gamut boundary to obtain the reshaped color gamut boundary includes:
[0016] The color gamut boundary with the hue near the target value is adjusted using a Bezier curve to obtain a reshaped color gamut boundary.
[0017] In one embodiment, mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the reshaped color gamut boundary includes:
[0018] determining a target brightness and a shrinkage coefficient according to the reshaped color gamut boundary;
[0019] The second color data that overflows the color gamut boundary is brought closer to the target brightness by the shrinkage coefficient, so as to obtain the second color data that is within the reshaped color gamut boundary.
[0020] In one embodiment, when encoding the original color data obtained by the sensor into the standard color space, converting the obtained encoded color data into the OKLab color space to obtain the first color data includes:
[0021] Encode the original color data obtained by the sensor into a standard color space to obtain encoded color data;
[0022] Performing spatial transformation processing on the encoded color data using a first transformation matrix to obtain XYZ values in an XYZ color space;
[0023] Convert the XYZ values into color values that match the OKLab color space;
[0024] Performing nonlinear processing on the color value to obtain a processed color value;
[0025] The processed color value is transformed into an OKLab color space using a second transformation matrix to obtain first color data.
[0026] In one embodiment, the method further comprises:
[0027] Converting the color gamut boundary into a first input-output pair and a second input-output pair;
[0028] storing the color gamut boundary in the form of the first input-output pair and the second input-output pair in a memory for use by hardware in a color gamut compression process;
[0029] Among them, the first input-output pair is an information pair with the hue on the color gamut boundary as input content and the chroma on the color gamut boundary as output content, and the second input-output pair is an information pair with the hue on the color gamut boundary as input content and the brightness on the color gamut boundary as output content.
[0030] In a second aspect, the present application further provides a color gamut compression device, the device comprising:
[0031] A first conversion module is configured to convert the encoded color data obtained by the sensor into an OKLab color space when encoding the original color data into a standard color space, thereby obtaining first color data; the first color data includes brightness, a first color component, and a second color component;
[0032] a second transformation module, configured to perform space transformation processing on the first color component and the second color component to obtain chroma and hue in an LCH color space; the chroma, the hue, and the brightness forming second color data;
[0033] a determination module, configured to use the endpoint with the maximum chroma of the LCH color space as the tip of the color gamut boundary, search for the tip point under each isohue plane, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the one that meets the brightness condition;
[0034] a mapping module, configured to map the second color data that overflows the color gamut boundary into the boundary, so as to obtain the second color data that is within the color gamut boundary;
[0035] The inverse transformation module is used to perform spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in the standard color space.
[0036] In one embodiment, the apparatus further comprises:
[0037] An adjustment module, configured to adjust the color gamut boundary to obtain a reshaped color gamut boundary;
[0038] The mapping module is further configured to map the second color data that overflows the reshaped color gamut boundary into the boundary to obtain the second color data that is within the reshaped color gamut boundary.
[0039] In one embodiment, the adjustment module is further configured to use a Bezier curve to adjust the color gamut boundary when the hue is near a target value to obtain a reshaped color gamut boundary.
[0040] In one embodiment, the mapping module is further used to determine the target brightness and the shrinkage coefficient based on the reshaped color gamut boundary; and the second color data that overflows the color gamut boundary is moved closer to the target brightness through the shrinkage coefficient to obtain the second color data within the reshaped color gamut boundary.
[0041] In one embodiment, the first transformation module is used to encode the original color data obtained by the sensor into a standard color space to obtain encoded color data; use the first transformation matrix to perform spatial transformation processing on the encoded color data to obtain XYZ values of the XYZ color space; convert the XYZ values into color values that match the OKLab color space; perform nonlinear processing on the color values to obtain processed color values; and use the second transformation matrix to transform the processed color values into the OKLab color space to obtain first color data.
[0042] In one embodiment, the apparatus further comprises:
[0043] A conversion module, configured to convert the color gamut boundary into a first input-output pair and a second input-output pair;
[0044] a storage module, configured to store the color gamut boundary in a form of the first input-output pair and the second input-output pair in a memory for use by hardware during color gamut compression;
[0045] Among them, the first input-output pair is an information pair with the hue on the color gamut boundary as input content and the chroma on the color gamut boundary as output content, and the second input-output pair is an information pair with the hue on the color gamut boundary as input content and the brightness on the color gamut boundary as output content.
[0046] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the color gamut compression method when executing the computer program.
[0047] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the color gamut compression method are implemented.
[0048] In a fifth aspect, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the color gamut compression method.
[0049] The above-mentioned color gamut compression method, device, computer equipment, storage medium and program product, when encoding the original color data obtained by the sensor into the standard color space, transforms the obtained encoded color data into the OKLab color space to obtain the first color data; performs spatial transformation processing on the first color component and the second color component in the first color data to obtain the chroma and hue of the LCH color space; the chroma, hue and brightness constitute the second color data; the endpoint with the largest chroma in the LCH color space is used as the tip of the color gamut boundary, finds the tip point under each equal hue surface, and determines the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition; maps the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary; performs spatial inverse transformation on the second color data within the reshaped color gamut boundary to obtain the target color data of the standard color space. Using the color gamut compression scheme of the present application, since color gamut compression is achieved in a uniform color space, the original hue of the super-gamut color can be well restored, and the level difference between different colors is retained, making the picture details richer, and effectively avoiding the problems of color distortion and detail loss in the color gamut compression process. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A diagram showing an application environment of a color gamut compression method in one embodiment;
[0051] Figure 2 1 is a flow chart of a color gamut compression method according to an embodiment;
[0052] Figure 3 Schematic diagram of the color gamut boundary of sRGB in the OKLab color space in one embodiment;
[0053] Figure 4 is a schematic diagram of color gamut boundary reshaping in one embodiment;
[0054] Figure 5 is a schematic diagram of color gamut mapping in one embodiment;
[0055] Figure 6 is a schematic flow chart of a color gamut compression method in another embodiment;
[0056] Figure 7 is a structural block diagram of a color gamut compression device in one embodiment;
[0057] Figure 8is a structural block diagram of a color gamut compression device in another embodiment;
[0058] Figure 9 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0060] It should be noted that in the following description, the terms "first, second and third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first, second and third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0061] The color gamut compression method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 via a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104 or placed on the cloud or other network servers.
[0062] When the terminal 102 encodes the original color data obtained by the sensor into the standard color space, the obtained encoded color data is transformed into the OKLab color space to obtain the first color data; the first color component and the second color component in the first color data are spatially transformed to obtain the chroma and hue of the LCH color space; the chroma, hue and brightness constitute the second color data; the endpoint with the largest chroma in the LCH color space is used as the tip of the color gamut boundary, the tip point under each equal hue surface is searched, and the color gamut boundary is determined based on the tip point and the endpoint corresponding to the brightness condition; the second color data that overflows the color gamut boundary is mapped into the boundary to obtain the second color data within the color gamut boundary; the second color data within the reshaped color gamut boundary is spatially inversely transformed to obtain the target color data of the standard color space, and then the target color data is displayed on the display; or, the target color data is transmitted to the server 104 for storage.
[0063] Among them, the terminal 102 can be a camera or a smartphone with a sensor, a tablet computer, a laptop computer, a desktop computer, an Internet of Things device and a portable wearable device. The Internet of Things device can be a smart speaker, a smart TV, a smart air conditioner and a vehicle, etc.
[0064] Server 104 can be a standalone physical server or a service node in a blockchain system. Each service node in the blockchain system forms a peer-to-peer network. The peer-to-peer protocol is an application layer protocol that runs on top of the Transmission Control Protocol (TCP). Furthermore, server 104 can be a server cluster consisting of multiple physical servers. It can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0065] In one embodiment, Figure 2 As shown, a color gamut compression method is provided, which can be Figure 1 The server or terminal in the embodiment is executed, or the server and the terminal are executed in collaboration, in which method the Figure 1 The following steps are used as an example to illustrate the terminal execution in .
[0066] S202 : When encoding the original color data obtained by the sensor into the standard color space, transform the obtained encoded color data into the OKLab color space to obtain first color data.
[0067] The first color data includes brightness, a first color component, and a second color component. The first color component may be a green / red component (a) of the color, and the second color component may be a blue / yellow component (b) of the color.
[0068] The sensor can be a visual sensor, such as a laser scanner, a linear array or area array CCD (Charge Coupled Device) camera, a TV (television) camera, or a digital camera.
[0069] The raw color data may be color data in the original color space of the sensor, such as the Sensor RGB (Red, Green, Blue) color space. The standard color space may be the sRGB (standard Red, Green, Blue) color space.
[0070] The OKLab color space is an open source color space that is calibrated based on the dataset generated by the CAM16 and IPT models. The OKLab color space can use three coordinates to represent color, which are:
[0071] L: indicates brightness;
[0072] a: represents the green / red component of the color;
[0073] b: Indicates the blue / yellow component of the color.
[0074] The OKLab color space has the following characteristics: 1) The compression target boundary can be adjusted for different hues; 2) Because l, m, and s are processed nonlinearly similar to the human eye (γ≈1 / 3), the perception of brightness is more uniform; c) The color gamut boundary is defined based on the equal hue (hue, H) plane, and super-gamut colors of the same hue are mapped back to the target color gamut more smoothly; d) The calculation of the conversion process is simpler than that of the CIELab color space, making it easier to implement on FPGA chips.
[0075] In one embodiment, the terminal can encode the original color data obtained by the sensor into a standard color space to obtain encoded color data; use a first transformation matrix to perform spatial transformation processing on the encoded color data to obtain XYZ values in the XYZ color space; convert the XYZ values into color values that match the OKLab color space; perform nonlinear processing on the color values to obtain processed color values; use a second transformation matrix to transform the processed color values into the OKLab color space to obtain first color data.
[0076] The first transformation matrix may be a matrix for converting the sensor RGB color space into the XYZ color space, and the second transformation matrix may be a matrix for converting color data in the XYZ color space into a standard color gamut (ie, the OKLab color space).
[0077] When the color value is compatible with the OKLab color space, a preset conversion matrix can be used to convert the XYZ value into a color value compatible with the OKLab color space.
[0078] For example, the CCM (Color Correction Matrix) can be abstracted as the product of two matrices:
[0079]
[0080] in, represents the first transformation matrix, Represents the second transformation matrix. Inverse it and multiply it by the calibrated CCM to get , the corresponding expression is as follows:
[0081]
[0082] Then, by The conversion from Sensor RGB color space to XYZ color space can be achieved. The corresponding expression is as follows:
[0083]
[0084] Next, convert the obtained XYZ value of the XYZ color space into a color value (LMS) that matches the OKLab color space. The corresponding conversion formula is as follows:
[0085]
[0086] in, is the preset transformation matrix, that is The matrix elements in can be obtained based on practical experience, such as by iterating over datasets generated based on CAM16 and IPT space. It can be:
[0087]
[0088] After obtaining the color value, the LMS can be subjected to nonlinear processing. The nonlinear processing method can be:
[0089]
[0090] in, k It can be a coefficient less than 1 and greater than 0. For example k =1 / 3 is a better value, which can be derived based on data sets generated from other uniform perception spaces, and the exponential law is also more consistent with the log curve law of the human visual system's brightness perception.
[0091] After nonlinear processing, the processed color values are converted to the OKLab color space as follows:
[0092]
[0093] in, The second transformation matrix can be expressed as follows, which is obtained by iterating the data set generated based on CAM16 and IPT space. It can be:
[0094]
[0095] S204 , performing space transformation processing on the first color component and the second color component to obtain chroma and hue in the LCH color space.
[0096] The above-mentioned chroma, hue and brightness constitute the second color data.
[0097] The LCH color space can be a cylindrical color space obtained by deforming the OKLab color space. This color space is represented by L, C, and H. Among them, L represents the lightness (i.e., brightness) corresponding to the three elements of color, with a value of 0 to 100; C represents chroma, that is, the distance between the coordinate position of a color and the origin, with a value of 0 to 181. The chroma of the color at the center of the circle is 0, and the farther away from the center of the circle, the greater the chroma; H is hue, with a value of 0° to 360°. Therefore, the conversion formula of the LCH color space is as follows:
[0098]
[0099]
[0100] S206 , taking the endpoint with the maximum chroma of the LCH color space as the tip of the color gamut boundary, searching for the tip point under each isochromatic plane, and determining the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition.
[0101] Among them, this application simplifies the entire color gamut boundary calculation process through the LUT method, greatly optimizing the implementation cost.
[0102] For example, taking the target color gamut as sRGB, the endpoint with the largest chroma is used as the tip of the color gamut boundary, and the tip point (C, L) under each isochromatic plane is found. Finally, the color gamut boundary is obtained by combining the two endpoints with brightness of 0 and 1. Then, the color gamut boundary of sRGB in OKLab can also be obtained, such as Figure 3 shown.
[0103] In one embodiment, after obtaining the color gamut boundary, the terminal can convert the color gamut boundary into a first input-output pair and a second input-output pair; store the color gamut boundary in the form of the first input-output pair and the second input-output pair in the memory for use by the hardware during the color gamut compression process; wherein the first input-output pair is an information pair with the hue on the color gamut boundary as input content and the chroma on the color gamut boundary as output content, and the second input-output pair is an information pair with the hue on the color gamut boundary as input content and the brightness on the color gamut boundary as output content.
[0104] Memory can be either static random-access memory (SRAM) or dynamic random-access memory (DRAM). SRAM is a type of random-access memory that retains data permanently as long as it's powered on. However, when the power goes out, the data stored in the SRAM disappears. In contrast, data stored in DRAM requires periodic updating.
[0105] For example, the endpoint with the largest chroma is used as the tip of the color gamut boundary, and the tip point (C, L) under each isochromatic plane is found. The color gamut boundary is obtained by combining the two endpoints with brightness of 0 and 1. In addition, after obtaining the color gamut boundary, the color gamut boundary can be stored in SRAM in the form of two 1D luts (i.e., C_cusp is checked according to H, and L_cusp is checked according to H) for use by the hardware. This avoids the high cost of using complex methods to calculate the color gamut boundary in the hardware.
[0106] In one embodiment, after obtaining the color gamut boundary, the terminal may perform boundary adjustment on the color gamut boundary to obtain a reshaped color gamut boundary, thereby retaining some saturation for some colors and making the overall color more saturated.
[0107] Specifically, the terminal can use the Bezier curve to adjust the color gamut boundary near the target value to obtain the reshaped color gamut boundary. Figure 4 As shown in the figure, the color gamut boundary with a hue of about 260 degrees is adjusted through the Bezier curve, which adjusts the blue light suppression effect and makes the overall color more saturated. Figure 4 Figure (a) is a schematic diagram of the color gamut boundary at the perspective of brightness. Figure 4 Figure (b) is a schematic diagram of the color gamut boundary from the perspective of chroma.
[0108] S208 : Map the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary.
[0109] In one embodiment, the terminal can determine in turn whether the current second color data is within the color gamut boundary. If not, the second color data that overflows the color gamut boundary is mapped to the boundary to obtain the second color data within the color gamut boundary; if so, no mapping processing is required.
[0110] For example, determine whether the current color is within the color gamut boundary. If not, map the (C, L) point that overflows the color gamut boundary to the color gamut boundary to obtain color data within the color gamut boundary. If yes, no mapping processing is required.
[0111] In one embodiment, the terminal maps the second color data that overflows the reshaped color gamut boundary into the boundary, which can be referred to as Figure 5 , thereby obtaining the second color data within the reshaped color gamut boundary.
[0112] Specifically, the terminal determines the target brightness and the shrinkage coefficient according to the reshaped color gamut boundary; and moves the second color data that overflows the color gamut boundary toward the target brightness through the shrinkage coefficient to obtain the second color data within the reshaped color gamut boundary.
[0113] For example, for the mapping of overflow colors into the color gamut, the process can be controlled by two parameters: base brightness L0 and contraction coefficient α. L0 determines the target brightness of the mapping, and the contraction coefficient determines the degree to which the mapping vector approaches the target brightness. The two degrees together determine the direction of the mapping.
[0114] S210 , performing a spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in a standard color space.
[0115] The spatial inverse transformation of the second color data may be to transform the second color data in the color gamut boundary of the LCH color space into the OKLab color space, and then transform it into the standard color space, thereby obtaining the target color data in the standard color space.
[0116] In the above embodiment, when the original color data obtained by the sensor is encoded into the standard color space, the obtained encoded color data is transformed into the OKLab color space to obtain the first color data; the first color component and the second color component in the first color data are spatially transformed to obtain the chroma and hue of the LCH color space; the chroma, hue and brightness constitute the second color data; the endpoint with the largest chroma in the LCH color space is taken as the tip of the color gamut boundary, the tip point under each equal hue surface is found, and the color gamut boundary is determined based on the tip point and the endpoint corresponding to the brightness condition; the second color data that overflows the color gamut boundary is mapped into the boundary to obtain the second color data within the color gamut boundary; the second color data within the reshaped color gamut boundary is spatially inversely transformed to obtain the target color data of the standard color space. The color gamut compression scheme of the present application is adopted. Since the color gamut compression is realized in a uniform color space, the original hue of the super-gamut color can be well restored, and the level difference between different colors can be retained, making the picture details richer and effectively avoiding the problems of color distortion and detail loss in the color gamut compression process.
[0117] As an example, combining Figure 6 The color gamut compression scheme of this application is described as follows:
[0118] (1) Color gamut conversion.
[0119] To achieve color management, the sensor signal needs to be encoded into a standard color space, such as sRGB or bt2020. During the conversion process, colors that overflow the color gamut will appear, causing color cast and detail loss. Therefore, these overflow colors are processed through color gamut compression to restore the original colors and details.
[0120] (2) Algorithm enabling selection.
[0121] If it is not enabled, the overflow color will be directly truncated, which will lose some color information and cause some areas of the image to be oversaturated; if it is enabled, the subsequent color gamut compression step will be entered.
[0122] (3) Conversion of uniform color space: the conversion is divided into five steps:
[0123] This application uses the open source color space OKLab, which is calibrated based on the data set generated by the CAM16 and IPT models.
[0124] a) sRGB color space to XYZ color space.
[0125] Among them, CCM can be abstracted into the product of two matrices:
[0126]
[0127] in, Used to convert sRGB to XYZ, Used to convert XYZ to standard color gamut. Here, the target color gamut is obtained Inverse it and multiply it by the calibrated CCM to get :
[0128]
[0129] Then, The conversion from sRGB color space to XYZ color space can be achieved through:
[0130]
[0131] b) XYZ color space to LMS.
[0132] The LMS here is the LMS used with OKLab, not the commonly used LMS color space. The conversion process is as follows:
[0133]
[0134] Among them, here The matrix is obtained by iterating over datasets generated based on CAM16 and IPT space.
[0135] c) Perform nonlinearization on LMS.
[0136]
[0137] Among them, the above coefficient (i.e. 1 / 3) is derived based on a data set generated based on other uniform perception spaces, and the exponential law is also more consistent with the log curve law of the human visual system's brightness perception.
[0138] d) Nonlinear LMS to OKLab color space.
[0139]
[0140] in, It is obtained by iteratively performing datasets generated based on CAM16 and IPT space.
[0141] e) OKLab color space to LCH color space.
[0142]
[0143]
[0144] (4) Calculation of color gamut boundaries.
[0145] Compared with other solutions that use complex iterative solution algorithms based on the Halley method, this application simplifies the entire color gamut boundary calculation process through the LUT method, greatly optimizing the implementation cost. For example, taking the target color gamut as sRGB as an example, the point with the largest chroma is used as the tip of the color gamut boundary, and the tip point (C, L) under each equal hue surface is found. Finally, the two endpoints with brightness of 0 and 1 are combined to obtain the color gamut boundary.
[0146] The obtained color gamut boundary is stored in SRAM in the form of two 1D luts (check C_cusp according to H, check L_cusp according to H) for hardware use, which saves the expensive cost of using complex methods to calculate the color gamut boundary in hardware.
[0147] (5) Reshaping the color gamut boundaries.
[0148] After calculating the color gamut boundary, some colors may not be perfectly compressed. For example, if some colors need to retain some saturation, the color gamut boundary can be stylized. For example, the color gamut boundary with a hue of about 260 degrees can be adjusted through the Bezier curve to adjust the blue light suppression effect and make the overall color more saturated.
[0149] (6) Mapping of overflow colors into the color gamut.
[0150] The process is controlled by two parameters: base brightness L0 and shrinkage coefficient α. L0 determines the target brightness of the mapping, and the shrinkage coefficient determines the degree to which the mapping vector approaches the target brightness. The two degrees together determine the direction of the mapping.
[0151] (7) Convert the overflow color compression result back to sRGB.
[0152] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0153] Based on the same inventive concept, embodiments of the present application also provide a color gamut compression device for implementing the aforementioned color gamut compression method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more color gamut compression device embodiments provided below can be found in the above-described limitations of the color gamut compression method and will not be further elaborated here.
[0154] In one embodiment, Figure 7 As shown, a color gamut compression device is provided, including: a first transformation module 702, a second transformation module 704, a determination module 706, a mapping module 708 and an inverse transformation module 710, wherein:
[0155] A first conversion module 702 is configured to convert the encoded color data obtained by the sensor into the OKLab color space when encoding the original color data into the standard color space, thereby obtaining first color data; the first color data includes brightness, a first color component, and a second color component;
[0156] The second transformation module 704 is configured to perform a spatial transformation on the first color component and the second color component to obtain chroma and hue in an LCH color space; the chroma, hue, and brightness constitute second color data;
[0157] A determination module 706 is configured to use the endpoint with the maximum chroma in the LCH color space as the tip of the color gamut boundary, find the tip point under each isochromatic plane, and determine the color gamut boundary based on the tip point and the corresponding endpoint that meets the brightness condition;
[0158] A mapping module 708 is configured to map the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary;
[0159] The inverse transformation module 710 is configured to perform spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in a standard color space.
[0160] In the above embodiment, when the original color data obtained by the sensor is encoded into the standard color space, the obtained encoded color data is transformed into the OKLab color space to obtain the first color data; the first color component and the second color component in the first color data are spatially transformed to obtain the chroma and hue of the LCH color space; the chroma, hue and brightness constitute the second color data; the endpoint with the largest chroma in the LCH color space is taken as the tip of the color gamut boundary, the tip point under each equal hue surface is found, and the color gamut boundary is determined based on the tip point and the endpoint corresponding to the brightness condition; the second color data that overflows the color gamut boundary is mapped into the boundary to obtain the second color data within the color gamut boundary; the second color data within the reshaped color gamut boundary is spatially inversely transformed to obtain the target color data of the standard color space. The color gamut compression scheme of the present application is adopted. Since the color gamut compression is realized in a uniform color space, the original hue of the super-gamut color can be well restored, and the level difference between different colors can be retained, making the picture details richer and effectively avoiding the problems of color distortion and detail loss in the color gamut compression process.
[0161] In one embodiment, Figure 8 As shown, the device also includes:
[0162] An adjustment module 712 is configured to adjust the color gamut boundary to obtain a reshaped color gamut boundary;
[0163] The mapping module 708 is further configured to map the second color data that overflows the reshaped color gamut boundary into the boundary to obtain the second color data within the reshaped color gamut boundary.
[0164] In one embodiment, the adjustment module 712 is further configured to use a Bezier curve to adjust the color gamut boundary having a hue close to the target value to obtain a reshaped color gamut boundary.
[0165] In one embodiment, the mapping module 708 is further configured to determine a target brightness and a shrinkage coefficient based on the reshaped color gamut boundary; and to move the second color data that overflows the color gamut boundary toward the target brightness through the shrinkage coefficient to obtain the second color data within the reshaped color gamut boundary.
[0166] In the above embodiment, before mapping, the color gamut boundary is reshaped so that the saturation of some colors can be retained. For example, the color gamut boundary with a hue of about 260 degrees is adjusted to achieve the effect of suppressing blue light and make the overall color more saturated.
[0167] In one embodiment, the first transformation module 702 is used to encode the original color data obtained by the sensor into a standard color space to obtain encoded color data; use a first transformation matrix to perform spatial transformation processing on the encoded color data to obtain XYZ values in the XYZ color space; convert the XYZ values into color values that match the OKLab color space; perform nonlinear processing on the color values to obtain processed color values; and use a second transformation matrix to transform the processed color values into the OKLab color space to obtain first color data.
[0168] In one embodiment, Figure 8 As shown, the device also includes:
[0169] A conversion module 714, configured to convert the color gamut boundary into a first input-output pair and a second input-output pair;
[0170] A storage module 716 is used to store the color gamut boundary in the form of a first input-output pair and a second input-output pair in a memory for use by the hardware in the color gamut compression process;
[0171] Among them, the first input-output pair is an information pair with the hue on the color gamut boundary as input content and the saturation on the color gamut boundary as output content, and the second input-output pair is an information pair with the hue on the color gamut boundary as input content and the brightness on the color gamut boundary as output content.
[0172] Each module in the color gamut compression device described above can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0173] In one embodiment, a computer device is provided, which may be a server and includes a processor, a memory, an input / output (I / O) interface, and a communication interface. The processor, memory, and I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is configured to store color data. The I / O interface of the computer device is configured to exchange information between the processor and an external device. The communication interface of the computer device is configured to communicate with an external terminal via a network connection. When executed by the processor, the computer program implements a color gamut compression method.
[0174] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown. The computer device includes a processor, memory, input / output interface, communication interface, display unit and input device. The processor, memory and input / output interface are connected via a system bus, and the communication interface, display unit and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, it implements a color gamut compression method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0175] Those skilled in the art will understand that Figure 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0176] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the above-mentioned color gamut compression method when executing the computer program.
[0177] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned color gamut compression method are implemented.
[0178] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of the above color gamut compression method when executed by a processor.
[0179] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0180] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, database, or other media used in the embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as SRAM or DRAM. The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.
[0181] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0182] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A color gamut compression method, characterized in that: The method comprises: When encoding the original color data obtained by the sensor into a standard color space, the original color data is spatially transformed using a first transformation matrix to obtain XYZ values in an XYZ color space; the XYZ values are converted into color values that match the OKLab color space; the color values are nonlinearly processed to obtain processed color values; the processed color values are transformed into the OKLab color space using a second transformation matrix to obtain first color data; the first color data includes brightness, a first color component, and a second color component; the original color data is color data of the original color space of the sensor, and the original color space includes the Sensor RGB color space; Performing space transformation processing on the first color component and the second color component to obtain chroma and hue in an LCH color space; the chroma, the hue, and the brightness constitute second color data; Taking the endpoint with the maximum chroma of the LCH color space as the tip of the color gamut boundary, finding the tip point under each isochromatic plane, and determining the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition, the color gamut boundary corresponds to the color gamut boundary of the standard color space in the OKLab color space; Using a Bezier curve to adjust the color gamut boundary of the hue near a target value to obtain a reshaped color gamut boundary, wherein the target value is 260 degrees, so as to adjust the blue light suppression effect; mapping the second color data that overflows the reshaped color gamut boundary into the boundary to obtain the second color data that is within the reshaped color gamut boundary; Performing a spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in the standard color space.
2. The method according to claim 1, characterized in that The method further comprises: Converting the color gamut boundary into a first input-output pair and a second input-output pair; storing the color gamut boundary in the form of the first input-output pair and the second input-output pair in a memory for use by hardware in a color gamut compression process; Among them, the first input-output pair is an information pair with the hue on the color gamut boundary as input content and the chroma on the color gamut boundary as output content, and the second input-output pair is an information pair with the hue on the color gamut boundary as input content and the brightness on the color gamut boundary as output content.
3. The method according to claim 1, characterized in that The algorithm of the nonlinear processing includes: Wherein, k is a coefficient less than 1 and greater than 0, l′, m′, and s′ are the processed color values, and L, M, and S are the color values.
4. The method according to claim 1, wherein Mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the reshaped color gamut boundary includes: determining a target brightness and a shrinkage coefficient according to the reshaped color gamut boundary; The second color data that overflows the color gamut boundary is brought closer to the target brightness by the shrinkage coefficient, so as to obtain the second color data that is within the reshaped color gamut boundary.
5. The method according to claim 1, wherein The second transformation matrix is:
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: determining in sequence whether the current second color data is within the color gamut boundary; If so, no mapping process is required; Mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary includes: If not, the second color data that overflows the color gamut boundary is mapped into the boundary to obtain the second color data that is within the color gamut boundary.
7. A color gamut compression device, characterized in that: The device comprises: A first transformation module is configured to, when encoding raw color data obtained by the sensor into a standard color space, perform spatial transformation processing on the raw color data using a first transformation matrix to obtain XYZ values in an XYZ color space; convert the XYZ values into color values compatible with an OKLab color space; perform nonlinear processing on the color values to obtain processed color values; and transform the processed color values into an OKLab color space using a second transformation matrix to obtain first color data; the first color data includes brightness, a first color component, and a second color component; the raw color data is color data of the raw color space of the sensor, which includes a Sensor RGB color space; a second transformation module, configured to perform space transformation processing on the first color component and the second color component to obtain chroma and hue in an LCH color space; the chroma, the hue, and the brightness forming second color data; A determination module is configured to use the endpoint with the maximum chroma of the LCH color space as the tip of the color gamut boundary, find the tip point under each isohue plane, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition, wherein the color gamut boundary corresponds to the color gamut boundary of the standard color space in the OKLab color space; an adjustment module, configured to use a Bezier curve to adjust the color gamut boundary when the hue is near a target value to obtain a reshaped color gamut boundary, wherein the target value is 260 degrees, so as to adjust the blue light suppression effect; a mapping module, configured to map the second color data that overflows the reshaped color gamut boundary into the boundary, so as to obtain the second color data that is within the reshaped color gamut boundary; The inverse transformation module is used to perform spatial inverse transformation on the second color data within the color gamut boundary to obtain target color data in the standard color space.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Gamut adaptation
CN101543039A