Color gamut compression method and device, computer equipment, storage medium and program product
Through the processing method of using OKLAB color space and LCH color space during color gamut compression, determine the color gamut boundary and data mapping, solve the problem of color distortion and detail loss caused by color gamut compression in the existing technology, and achieve richer richer The picture details and accurate color restoration.
Patent Information
- Application Number
- CN202411962607.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing color gamut compression algorithms can easily lead to color distortion and detail loss during the process of color signal conversion from large color gamut to small color gamut.
Adopt a color gamut compression method, transform the original color data obtained by the sensor to the OKLAB color space, perform the color and tone processing of the LCH color space, determine the color gamut boundary, and map the data of the overflowing color gamut to the border. Finally, the space inverter is turned on to obtain the target color data.
Effectively avoid the problem of color distortion and detail loss during color gamut compression. It can well restore the original hue of the super color gamut color and keep the hierarchical differences between different colors, making the picture details richer.
Smart Images

Figure CN119383281A_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, device, computer equipment, storage medium and program product. Background Art
[0002] Color gamut compression is part of color management, and its purpose is to achieve end-to-end color reproduction more accurately. During the transmission process of color signals between light, cameras, screens and other devices, it may be necessary to adapt to multiple standards. For example, the camera encodes in a large color gamut (such as rec2020), while the screen expresses in a small color gamut (such as sRGB). In the process of color signals entering from a large color gamut to a small 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 the color gamut compression algorithm in ACES (Academy Color Encoding Specification), are mainly based on DaVinci Colorspace Transform Language (DCTL) for processing. The core idea is to determine the compression threshold in the Yxy color space to achieve color gamut compression. However, the use of this color gamut compression algorithm still causes color distortion and detail loss. Summary of the invention
[0004] Based on this, it is necessary to provide a color gamut compression method, apparatus, 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 color 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 that is 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 that is within the reshaped color gamut boundary comprises:
[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 through the contraction 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, transforming 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 an XYZ value in an XYZ color space;
[0023] Convert the XYZ value into a color value that matches 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 the 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 used to convert the obtained encoded color data into an OKLab color space when encoding the original color data obtained by the sensor into a standard color space, so as to obtain first color data; the first color data includes brightness, a first color component and a second color component;
[0032] A second transformation module is used 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 constitute second color data;
[0033] A determination module, configured to take 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 isochromatic color plane, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition;
[0034] A mapping module, used for 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;
[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 device further comprises:
[0037] An adjustment module, used for adjusting 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 boundary of the reshaped color gamut into the boundary to obtain the second color data that is within the boundary of the reshaped color gamut.
[0039] In one of the embodiments, the adjustment module is further used to use a Bezier curve to adjust the color gamut boundary near the target value of the hue to obtain a reshaped color gamut boundary.
[0040] In one of the embodiments, the mapping module is further used to determine a target brightness and a contraction coefficient based on the reshaped color gamut boundary; the second color data that overflows the color gamut boundary is moved closer to the target brightness through the contraction 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 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 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 device 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, used for 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;
[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, wherein the computer-readable storage medium stores a computer program, 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, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the color gamut compression method are implemented.
[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, transform the obtained encoded color data into the OKLab color space to obtain the first color data; perform 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; take the endpoint with the largest chroma of the LCH color space as the tip of the color gamut boundary, find the tip point under each equal hue surface, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition; map the second color data overflowing the color gamut boundary into the boundary to obtain the second color data within the color gamut boundary; perform 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. The color gamut compression scheme of the present application is adopted, because the color gamut compression is realized in a uniform color space, the original hue of the super color gamut color can be well restored, and the hierarchical differences between different colors are retained, so that the picture details are richer, and the problems of color distortion and detail loss in the color gamut compression process are effectively avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] FIG1 is a diagram showing an application environment of a color gamut compression method in one embodiment;
[0051] FIG2 is a schematic diagram of a flow chart of a color gamut compression method in one embodiment;
[0052] FIG3 is a schematic diagram of the color gamut boundary of sRGB in the OKLab color space in one embodiment;
[0053] FIG4 is a schematic diagram of color gamut boundary reshaping in one embodiment;
[0054] FIG5 is a schematic diagram of color gamut mapping in one embodiment;
[0055] FIG6 is a schematic flow chart of a color gamut compression method in another embodiment;
[0056] FIG7 is a structural block diagram of a color gamut compression device in one embodiment;
[0057] FIG8 is a structural block diagram of a color gamut compression device in another embodiment;
[0058] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present 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 in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0061] The color gamut compression method provided in the embodiment of the present application can be applied in the application environment shown in FIG1 . In which, the terminal 102 communicates with the server 104 through a network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers.
[0062] When encoding the original color data obtained by the sensor into the standard color space, the terminal 102 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 taken as the tip of the color gamut boundary, the tip point under each equal hue plane 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, 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 smart phone 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, a vehicle, etc.
[0064] Server 104 can be an independent physical server or a service node in a blockchain system. A peer-to-peer network is formed between the service nodes in the blockchain system. The peer-to-peer protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In addition, server 104 can also be a server cluster composed of multiple physical servers, and 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 (CDN), and big data and artificial intelligence platforms.
[0065] In one embodiment, as shown in FIG. 2 , a color gamut compression method is provided. The method may be executed by the server or the terminal in FIG. 1 , or by the server and the terminal in collaboration. The method is described by taking the terminal in FIG. 1 as an example, and includes the following steps:
[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 original color data may be color data of an original color space of a sensor, such as a Sensor RGB (RedGreenBlue) color space. The standard color space may be an sRGB (standard Red Green Blue) color space.
[0070] OKLab color space is an open source color space, which is calibrated based on the data set generated by CAM16 and IPT models. Among them, 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 compressed target boundary can be adjusted for different hues; 2) Since 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 hue (H) plane, and the super-gamut colors of the same hue are smoother after being mapped back to the target color gamut; d) The calculation of the conversion process is simpler than that of the CIELab color space, which is convenient for implementation 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 sRGB color space into the XYZ color space, and the second transformation matrix may be a matrix for converting the color data of the XYZ color space into the standard color gamut (ie, the OKLab color space).
[0077] When the color values are matched with the OKLab color space, a preset conversion matrix can be used to convert the XYZ values into color values that are matched with the OKLab color space.
[0078] For example, CCM (Color Correction Matrix) can be abstracted as the joint product of two matrices:
[0079]
[0080] in, represents the first transformation matrix, Represents the second transformation matrix. Based on the target color gamut (i.e., standard color space), Inverse it and multiply it on the left by the calibrated CCM to get , the corresponding expression is as follows:
[0081]
[0082] Then, by The conversion from sRGB color space to XYZ color space can be realized. The corresponding expression is as follows:
[0083]
[0084] Next, the XYZ value of the obtained XYZ color space is converted into a color value (LSM) 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 based on data sets generated based on CAM16 and IPT space. It can be:
[0087]
[0088] After obtaining the color value, the LSM can be subjected to nonlinear processing. The linearization processing can be performed in the following manner:
[0089]
[0090] Among them, k 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 by other uniform perception spaces, and the exponential law is also more consistent with the log curve law of the human visual system's perception of brightness.
[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 represented 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 of 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, which 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 the hue, with a value of 0° to 360°, so 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 color 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, take the endpoint with the largest chroma as the tip of the color gamut boundary, find the tip point (C, L) under each isochromatic plane, and finally combine the two endpoints with brightness of 0 and 1 to get the color gamut boundary, and then we can also get the color gamut boundary of sRGB in OKLab, as shown in Figure 3.
[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 in 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] The memory can be a static random access memory (SRAM) or a dynamic random access memory (DRAM). SRAM is a type of random access memory. As long as the static random access memory remains powered on, the data stored in it can be kept constant. When the power supply stops, the data stored in the SRAM will disappear. Correspondingly, the data stored in DRAM needs to be updated periodically.
[0105] For example, take the endpoint with the largest chroma as the tip of the color gamut boundary, find the tip point (C, L) under each equal-color plane, and combine the two endpoints with brightness of 0 and 1 to get the color gamut boundary; 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., check C_cusp according to H, check L_cusp according to H) for hardware use, thus avoiding the high cost of using complex methods to calculate the color gamut boundary in 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, so that some saturation may be retained for some colors, 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 a reshaped color gamut boundary. For example, as shown in Figure 4, the color gamut boundary with a hue of about 260 degrees is adjusted by the Bezier curve, and the suppression effect on blue light is adjusted to make the overall color fuller. Among them, Figure 4 (a) is a schematic diagram of the color gamut boundary from the perspective of brightness, and Figure 4 (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 into 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, as shown in FIG. 5 , so as to obtain the second color data within the reshaped color gamut boundary.
[0112] Specifically, the terminal determines the target brightness and the contraction coefficient according to the reshaped color gamut boundary; the second color data that overflows the color gamut boundary is moved closer to the target brightness through the contraction 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, so as to obtain the target color data of 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 of 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 overflowing 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, because the color gamut compression is realized in a uniform color space, the original hue of the super color gamut color can be well restored, and the hierarchical differences between different colors are retained, so that the picture details are richer, and the problems of color distortion and detail loss in the color gamut compression process are effectively avoided.
[0117] As an example, the color gamut compression scheme of the present application is described in conjunction with FIG. 6 , as follows:
[0118] 1. Color gamut conversion.
[0119] In order 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] (B) 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, it will enter the subsequent color gamut compression step.
[0122] (III) Conversion of uniform color space. The conversion is divided into five processes:
[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 joint product of two matrices:
[0126]
[0127] in, Used to convert sRGB to XYZ, Used to convert XYZ to the standard color gamut. Here, the Inverse it and multiply it on the left by the calibrated CCM to get :
[0128]
[0129] Then, by Then the conversion from sRGB color space to XYZ color space can be realized:
[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 the datasets generated based on CAM16 and IPT space.
[0135] c) Nonlinearize the LMS.
[0136]
[0137] Among them, the above coefficient (i.e. 1 / 3) is derived based on data sets generated based on other uniform perception spaces, and the exponential law is also more in line with the log curve law of the human visual system's perception of brightness.
[0138] d) Non-linear LMS to OKLab color space.
[0139]
[0140] in, It is obtained by iterating the datasets generated based on CAM16 and IPT space.
[0141] e) OKLab color space to LCH color space.
[0142]
[0143]
[0144] (iv) Calculation of color gamut boundaries.
[0145] Compared with other solutions that use complex iterative solution algorithms based on Halley's method, this application simplifies the entire color gamut boundary calculation process through LUT, 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 can save the expensive cost of using complex methods to calculate the color gamut boundary in hardware.
[0147] (V) Reshaping the color gamut boundaries.
[0148] After calculating the color gamut boundary, some colors may not be perfectly compressed. For example, some colors need to retain some saturation. In this case, 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, and the suppression effect on blue light can be adjusted to make the overall color fuller.
[0149] (vi) Mapping of overflow colors into the color gamut.
[0150] This process is 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.
[0151] (VII) 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 above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed 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 part of the steps or stages in other steps.
[0153] Based on the same inventive concept, the embodiment of the present application also provides a color gamut compression device for implementing the color gamut compression method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more color gamut compression device embodiments provided below can refer to the limitations of the color gamut compression method above, and will not be repeated here.
[0154] In one embodiment, as shown in FIG. 7 , a color gamut compression device is provided, including: a first transform module 702, a second transform module 704, a determination module 706, a mapping module 708 and an inverse transform module 710, wherein:
[0155] The first conversion module 702 is used to convert the obtained encoded color data into the OKLab color space when encoding the original color data obtained by the sensor into the standard color space, so as to obtain the 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 used to perform space transformation processing on the first color component and the second color component to obtain the chroma and hue of the LCH color space; the chroma, hue and brightness constitute the second color data;
[0157] A determination module 706 is used to take 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 isochromatic plane, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition;
[0158] A mapping module 708, configured to map 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;
[0159] The inverse transformation module 710 is used 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 of 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 overflowing 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, because the color gamut compression is realized in a uniform color space, the original hue of the super color gamut color can be well restored, and the hierarchical differences between different colors are retained, so that the picture details are richer, and the problems of color distortion and detail loss in the color gamut compression process are effectively avoided.
[0161] In one embodiment, as shown in FIG8 , the device further includes:
[0162] An adjustment module 712, 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 that is 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 near the target color value to obtain a reshaped color gamut boundary.
[0165] In one embodiment, the mapping module 708 is further used to determine the target brightness and the contraction coefficient according to the reshaped color gamut boundary; the second color data that overflows the color gamut boundary is moved closer to the target brightness by the contraction 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 the 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 the second transformation matrix to transform the processed color values into the OKLab color space to obtain first color data.
[0168] In one embodiment, as shown in FIG8 , the device further 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, 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 hue on the color gamut boundary as input content and chroma on the color gamut boundary as output content, and the second input-output pair is an information pair with hue on the color gamut boundary as input content and brightness on the color gamut boundary as output content.
[0172] Each module in the color gamut compression device can be implemented in whole or in part by 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 a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0173] In one embodiment, a computer device is provided, which may be a server, including a processor, a memory, an input / output interface (I / O for short) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store color data. 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 via a network connection. When the computer program is executed by the processor, a color gamut compression method is implemented.
[0174] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the 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 the 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, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a color gamut compression method is implemented. 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 covered on 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 the structure shown in FIG. 9 is merely a block diagram of a partial 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 arrangement of components.
[0176] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, 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 relevant laws, regulations and standards of relevant countries and regions.
[0180] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as SRAM or DRAM. The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0181] The technical features of the above embodiments may 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 only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached 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 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; 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 color plane, and determining the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition; 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; 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: Performing boundary adjustment on the color gamut boundary to obtain a reshaped color gamut boundary; 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 includes: 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.
3. The method according to claim 2, characterized in that The adjusting the color gamut boundary to obtain the reshaped color gamut boundary includes: The color gamut boundary with the hue near the target value is adjusted using a Bezier curve to obtain a reshaped color gamut boundary.
4. The method according to claim 2, characterized in that: Mapping the second color data that overflows the color gamut boundary into the boundary to obtain the second color data that is 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 through the contraction coefficient, so as to obtain the second color data that is within the reshaped color gamut boundary.
5. The method according to claim 1, characterized in that When encoding the original color data obtained by the sensor into the standard color space, transforming the obtained encoded color data into the OKLab color space to obtain the first color data includes: Encode the original color data obtained by the sensor into a standard color space to obtain encoded color data; Performing spatial transformation processing on the encoded color data using a first transformation matrix to obtain an XYZ value in an XYZ color space; Convert the XYZ value into a color value that matches the OKLab color space; Performing nonlinear processing on the color value to obtain a processed color value; The processed color value is transformed into the OKLab color space using a second transformation matrix to obtain first color data.
6. The method according to any one of claims 1 to 5, 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.
7. A color gamut compression device, characterized in that: The device comprises: A first conversion module is used to convert the obtained encoded color data into an OKLab color space when encoding the original color data obtained by the sensor into a standard color space, so as to obtain first color data; the first color data includes brightness, a first color component and a second color component; A second transformation module is used 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 constitute second color data; A determination module, configured to take 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 isochromatic color plane, and determine the color gamut boundary based on the tip point and the endpoint corresponding to the brightness condition; A mapping module, used for 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; 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
Semi-fixed-hue gamut compression
CN105164994A
Optimized spectrum gamut mapping method
CN107067444A
Image processing method and device, electronic equipment and readable storage medium
CN119011740A
Lamination and method
CN119175203A