Color curve dynamic adjustment method and device, equipment and storage medium

By dynamically dividing the color space into intervals and performing non-linear adjustments, the problems of loss of highlight details and abrupt interval transitions in color curve adjustments in existing technologies are solved, resulting in a more natural color effect that is more in line with visual perception.

CN121908146APending Publication Date: 2026-04-21AFIRSTSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
AFIRSTSOFT CO LTD
Filing Date
2026-01-19
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing color curve adjustment techniques are insufficient to meet the precise color adjustment needs in complex scenes, resulting in overexposure in highlight areas or stark black in shadow areas, abrupt transitions between areas, poor parameter adaptability, and difficulty in achieving natural and smooth color effects.

Method used

By employing a dynamic segmented parameter set, the image color values ​​are converted from a linear color space to a perceptual color space. The highlight area, bright area, dark area, and shadow area are dynamically divided, and a differentiated nonlinear adjustment algorithm is executed in each area. Finally, the image is converted back to a linear color space to generate a color adjustment curve.

Benefits of technology

It effectively preserves highlight details, suppresses shadow noise, and achieves natural and smooth tone transitions, improving the flexibility and adaptability of color adjustment and avoiding the problems of detail loss and color banding in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121908146A_ABST
    Figure CN121908146A_ABST
Patent Text Reader

Abstract

The invention discloses a color curve dynamic adjustment method and device, equipment and a storage medium. The method comprises the steps of obtaining an original color value of an image and setting a segmentation parameter set; the segmentation parameter set comprises a highlight value, a brightness adjustment value, a darkness adjustment value and a shadow value; converting the original color value from a linear color space to a perceptual color space; dynamically dividing a highlight area, a brightness adjustment area, a dark adjustment area and a shadow area in a perception color space according to the segmentation parameter set; respectively executing corresponding nonlinear adjustment algorithms in the highlight area, the brightness adjustment area, the dark adjustment area and the shadow area to obtain an adjustment perception space color value; and reversely converting the adjustment perception space color value to a linear color space to generate a color adjustment curve. According to the method, the segmentation parameter set which can be dynamically set is introduced to replace traditional fixed interval division, so that the method can be adaptive to brightness distribution of different images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and storage medium for dynamic adjustment of color curves. Background Technology

[0002] Color curve adjustment is one of the core technologies in the field of digital image processing and color correction. It is widely used in image editing software, display device calibration, camera image processing systems and other scenarios. Its core objective is to optimize the visual effect of an image by adjusting its brightness, contrast and color distribution, so as to meet the visual presentation needs of different scenarios.

[0003] Currently, the mainstream color curve adjustment techniques are mainly divided into the following two types: The first method is a global linear adjustment method, typically used in early versions of Adobe Photoshop as an example of the Linear Color Curve tool. The core logic of this method is to apply a uniform linear transformation to the entire color range of the image (0-255 pixel values). Specifically, it involves first obtaining the RGB color values ​​of all pixels in the image, calculating the overall average brightness, and then applying a uniform linear scaling to the brightness values ​​of all pixels according to the user-defined brightness adjustment parameters, ultimately outputting the adjusted image. The key feature of this method is its uniform adjustment rules, eliminating the need to differentiate between pixel brightness distributions, making its implementation simple and direct.

[0004] The second method is a simple segmented adjustment method, commonly found in some mobile photo editing apps, which often uses a three-segment adjustment mode (highlights, midtones, and shadows). The specific implementation process is as follows: A fixed range threshold is pre-set, dividing the color range into three fixed intervals: highlights (200-255 pixel values), midtones (50-199 pixel values), and shadows (0-49 pixel values). Then, the color values ​​of all pixels in the image are traversed, determining their respective intervals, and independent gain coefficients are applied to the pixels in different intervals for adjustment. The interval boundaries are defined using a hard thresholding method.

[0005] However, both of these mainstream technologies have significant drawbacks and are unable to meet the needs of accurate color adjustment in complex scenarios: Global linear adjustment methods, by applying a uniform adjustment strategy to the entire color gamut without considering the differences in human perception of different brightness areas, are prone to problems such as overexposure in highlights or complete darkness in shadows during the adjustment process. For example, when a user needs to increase the overall brightness of an image, highlight pixels that are already close to saturation (such as pixels in the sky area) will be directly pushed to the upper limit of 255 pixels, resulting in the loss of highlight details and the disappearance of tonal gradations; while when decreasing the overall brightness, the brightness values ​​of shadow pixels will be excessively suppressed, making dark textures indistinguishable. The root cause is that globally uniform linear adjustment cannot take into account the detail preservation needs of different brightness areas, resulting in extremely poor adjustment flexibility.

[0006] For simple segmented adjustment methods, the core shortcomings lie in two aspects: interval division and adjustment algorithm. On the one hand, the interval division uses a fixed threshold, resulting in abrupt boundary processing and poor adaptability of adjustment parameters to the color distribution of different images. For example, a fixed threshold (200 pixel value) between highlights and midtones causes abrupt changes in pixel brightness at the boundary, resulting in obvious color banding and affecting the overall harmony of the image. On the other hand, the shadow interval uses a fixed gain coefficient, which cannot adapt to the noise levels in the shadow areas of different images. For images with a lot of noise in the shadow areas, the fixed gain coefficient will directly amplify the noise and reduce image quality. In addition, this method only uses a single linear gain algorithm for adjusting each interval, which cannot cope with the color transition requirements in complex scenes and makes it difficult to achieve a natural and smooth color adjustment effect. Summary of the Invention

[0007] The purpose of this invention is to provide a method, apparatus, device, and storage medium for dynamic adjustment of color curves, aiming to solve the problems in the prior art such as easy loss of highlight and shadow details, abrupt transitions between color intervals, and poor parameter adaptability.

[0008] In a first aspect, embodiments of the present invention provide a method for dynamically adjusting a color curve, comprising: Obtain the original color values ​​of the image and set a segmented parameter set; the segmented parameter set includes highlight value, light tone value, dark tone value and shadow value; The original color values ​​are converted from the linear color space to the perceptual color space; Based on the segmentation parameter set, the highlight area, light tone area, dark tone area and shadow area are dynamically divided in the perceptual color space; In the highlight area, bright tone area, dark tone area and shadow area, the corresponding nonlinear adjustment algorithm is executed to obtain the adjusted perceptual space color value; The color values ​​in the adjusted perception space are converted inversely to the linear color space to generate a color adjustment curve.

[0009] Secondly, embodiments of the present invention provide a color curve dynamic adjustment device, comprising: An acquisition unit is used to acquire the original color values ​​of an image and set a segmented parameter set; the segmented parameter set includes highlight values, light tone values, shadow tone values, and shadow values; A conversion unit is used to convert the original color values ​​from a linear color space to a perceptual color space; The segmentation unit is used to dynamically divide the highlight area, light tone area, dark tone area and shadow area in the perceptual color space according to the segmentation parameter set; The adjustment unit is used to execute corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area and shadow area respectively to obtain the adjusted perceptual space color value; The generation unit is used to reverse the adjustment of the color values ​​in the perception space to the linear color space and generate a color adjustment curve.

[0010] Thirdly, embodiments of the present invention provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the color curve dynamic adjustment method described in the first aspect above.

[0011] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the color curve dynamic adjustment method described in the first aspect.

[0012] This invention discloses a method, apparatus, device, and storage medium for dynamic adjustment of color curves. The method includes: acquiring the original color values ​​of an image and setting a segmented parameter set; the segmented parameter set includes highlight values, brightness values, shadow values, and shading values; converting the original color values ​​from a linear color space to a perceptual color space; dynamically dividing the perceptual color space into highlight areas, brightness areas, shadow areas, and shading areas according to the segmented parameter set; executing corresponding nonlinear adjustment algorithms in the highlight areas, brightness areas, shadow areas, and shading areas respectively to obtain adjusted perceptual space color values; and reversing the adjusted perceptual space color values ​​back to a linear color space to generate a color adjustment curve. This invention replaces the traditional fixed interval division with a dynamically settable segmented parameter set, thereby enabling adaptive adjustment to the brightness distribution of different images. Furthermore, it employs differentiated nonlinear mapping algorithms for the four intervals of highlight, brightness, shadow, and shading, and performs adjustments within the color space perceived by the human eye, ensuring the monotonicity and continuity of the adjustment curve. This invention effectively overcomes the problems of detail loss caused by global adjustments and color banding caused by fixed segmentation, achieving preservation of highlight details, suppression of shadow noise, and natural and smooth tone transitions. The embodiments of this invention also provide a color curve dynamic adjustment device, a computer-readable storage medium, and a computer device, all possessing the aforementioned beneficial effects, which will not be elaborated further here. Attached Figure Description

[0013] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a flowchart illustrating the method for dynamically adjusting color curves. Figure 2 This is another flowchart illustrating the dynamic adjustment method for color curves. Figure 3 This is a schematic diagram of the sub-processes of the dynamic adjustment method for color curves; Figure 4 This is a schematic block diagram of a color curve dynamic adjustment device. Detailed Implementation

[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0016] It should be understood that, when used in this specification and the appended claims, the terms “comprising” and “including” indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more of its features, integrals, steps, operations, elements, components and / or collections thereof.

[0017] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0018] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the relevant listed items and all possible combinations, and includes such combinations.

[0019] Please see Figures 1-3 This embodiment provides a method for dynamically adjusting color curves, including: S101: Obtain the original color values ​​of the image and set the segmentation parameter set; the segmentation parameter set includes highlight value, light tone value, dark tone value and shadow value; The system obtains the original color value of each pixel from the digital image to be processed, typically in RGB format, and normalizes the luminance components of each channel to a linear space between 0 and 1, generating a normalized sequence of original luminance values. Subsequently, the system proceeds to the stage of setting the segmented parameter set.

[0020] Specifically, the segmentation parameter set includes: Receive raw values ​​input by the user; the raw values ​​include raw values ​​for highlights, highlights, shadows, and at least one raw value for a midtone control point; Constrain the original values ​​to generate ordered parameter values; Normalize ordered parameter values ​​to a preset numerical range to generate normalized parameter values; The normalized parameter values ​​are combined into a piecewise parameter set.

[0021] More specifically, it receives a series of raw values ​​directly input by the user through a graphical user interface or application programming interface. These raw values ​​explicitly correspond to the boundary definitions of intervals such as highlight value, luminance value, shadow value, and shading value, as well as one or more midtone control points for fine-tuning the curve shape.

[0022] Upon receiving the data, the system immediately performs constraint processing on the batch of raw input values. The core logic of this processing is to enforce an ordered relationship, namely, the raw value of shadow must not be greater than the raw value of dark tone, the raw value of dark tone must not be greater than the raw value of bright tone, and the raw value of bright tone must not be greater than the raw value of highlight. If the user-input values ​​do not conform to this order, the system will automatically adjust them according to preset rules, such as assigning a smaller value to the preceding parameter or a larger value to the following parameter, thereby generating a set of ordered parameter values ​​that conform to the logical order, ensuring the feasibility of subsequent interval division.

[0023] Next, the system maps this set of ordered parameter values ​​to their respective preset standardized working ranges, completing the normalization process. Specifically, the highlight value T h ∈ (0.8, 1.0], brightness tone value R m1 ∈ (0.5, 0.8], dark tone value R m2 ∈ (0.2, 0.5], shaded value T s ∈[0, 0.2], and the midtone control point parameter P c ∈[0,1]. This mapping typically employs a linear scaling algorithm, which preserves the magnitude and direction of the user input, but normalizes the numerical values ​​to the standard dimensions desired by the algorithm model.

[0024] Finally, the system encapsulates and combines these constrained and normalized parameter values ​​according to a predetermined data structure format. A typical data structure can be a sequential array, where each element represents a highlight value, brightness value, shadow value, shading value, and midtone control points, forming a complete, standardized, and directly readable segmented parameter set by subsequent interval division and curve adjustment modules. For example, the parameter set is stored as an array [T h R m1 R m2 T s P c1 P c2 P c3 (e.g., [0, 0, 0, 0, 25, 50, 75], which need to be normalized).

[0025] S102: Convert the original color values ​​from the linear color space to the perceptual color space; In this embodiment, converting the original color values ​​from the linear color space to the perceptual color space includes: The original color values ​​are normalized to obtain the processed color values; The following formula is used to convert color values ​​from a linear color space to a perceptual color space: Where p(e) is the color value of the perceptual space; e represents the processed color value.

[0026] In this embodiment, the process of converting the raw color values ​​begins in the data preprocessing stage. The system first acquires the raw pixel data of the image, which is typically represented as RGB linear color values ​​with a bit depth of 8 bits or higher. Subsequently, the system normalizes these raw color values, that is, the integer values ​​of each color channel, for example, values ​​ranging from 0 to 255, are converted into floating-point numbers between 0.0 and 1.0 by dividing by the maximum value of that data type (such as 255). The result of this process is called the processed color value, which represents the relative brightness intensity in the linear color space.

[0027] After normalization, the system converts the processed color values ​​from a linear color space to a perceptual color space that conforms to the characteristics of human vision, according to a specific conversion formula. The conversion process is implemented using a piecewise function. When the processed color value e is less than or equal to 0.0031308, a linear transformation p(e) = 12.92·e is applied; when the processed color value e is greater than 0.0031308, a nonlinear transformation p(e) = 1.055·e^(1 / 2.4) - 0.055 is applied. This conversion model is based on the Gamma correction principle (Gamma values ​​are used to describe the conversion relationship between device-dependent linear RGB values ​​and a perceptual color space that conforms to the characteristics of human vision), and can map device-dependent linear RGB values ​​to a color space that conforms to the uniformity of human perception.

[0028] This conversion process has a clear physical meaning. The linear interval ensures the accurate representation of dark areas, while the non-linear part better simulates the human eye's perception of changes in brightness. The resulting perceptual space color value p(e) has numerical characteristics that better match the human visual system's response curve to brightness, allowing subsequent color adjustments to produce a more natural and visually perceptual effect. This mapping relationship from linear space to perceptual space is a crucial foundation for the entire color adjustment process, ensuring that subsequent interval division and non-linear adjustment operations can be performed within a space that conforms to visual characteristics.

[0029] The converted color values ​​in the perceived space will serve as input data for subsequent dynamic range division and piecewise nonlinear adjustment, providing an intermediate representation that conforms to the characteristics of human vision for the entire color curve dynamic adjustment method. This conversion step effectively solves the problem of the difference between the device-related color space and the visual perception space, laying the technical foundation for achieving accurate color adjustment.

[0030] S103: Dynamically divide the highlight area, light tone area, dark tone area and shadow area in the perceived color space according to the segmentation parameter set; In this embodiment, the dynamic division of the highlight area, light tone area, dark tone area, and shadow area in the perceptual color space according to the segmented parameter set includes: The area within the perceived color space where the perceived color value is greater than the highlight value and the perceived color value is less than or equal to 1 is defined as the highlight area; the highlight value is less than or equal to 1. The range where the perceived color value is greater than the brightness value and the perceived color value is less than or equal to the highlight value is defined as the brightness zone; the highlight value is greater than the brightness value. The range where the perceived color value is greater than the shadow value and the perceived color value is less than or equal to the highlight value is divided into the dark tone zone; the highlight value is greater than the shadow value. The area with a perceptual space color value greater than or equal to 0 and a perceptual space color value less than or equal to the shadow value is designated as the shadow area; the shadow value is greater than or equal to 0.

[0031] Specifically, obtain the segmented parameter set, which includes the highlight value T. h Brightness value R m1 Shadow value T s Key parameters, such as those specified above, have been normalized and their values ​​are strictly limited to between 0 and 1. Based on these parameter values, each perceptual color value p(e) in the perceptual color space is dynamically divided into intervals, thereby precisely defining four continuous intervals: highlight area, light tone area, dark tone area, and shadow area.

[0032] The segmentation operation is first performed on the highlight area, where the perceptual space color value is greater than the highlight value T. h The range less than or equal to 1 is defined as the highlight area, where the highlight value T h The value itself is less than or equal to 1, ensuring that the highlight area covers the brightest pixel area of ​​the image. Next, the bright tone area is divided, and the system will perceive color values ​​greater than the bright tone value R. m1 And less than or equal to the highlight value T h The range is defined as the bright tone area, where the highlight value T is... h It must be greater than the brightness value R m1 To ensure the logical consistency of the intervals, the system then processes the dark areas, perceiving color values ​​in the spatial color space that are greater than the shadow value T. s And less than or equal to the brightness value R m1 The range is designated as the dark tone zone, with a brightness value R. m1 It needs to be greater than the shaded value T s This maintains the interval order. Finally, the shadow area is defined, and the system will perceive a color value in the space that is greater than or equal to 0 and less than or equal to the shadow value T. s The area is defined as the shaded region, with a shaded value T. s Greater than or equal to 0, covering the darkest parts of the image. That is, the highlight area: (T h ,1]; Brightness zone: (R m1 T h Dark areas: (T) s R m1 ]; Shaded area: [0, T s ].

[0033] The entire segmentation process dynamically adapts to image characteristics, with parameter value T. h R m1 T sDerived from a segmented parameter set, its values ​​are adjusted based on the actual color distribution of the image, rather than a fixed threshold. This dynamic segmentation mechanism ensures that the boundaries of each interval can flexibly respond to the brightness characteristics of different images, thus providing a precise interval basis for subsequent segmented nonlinear adjustments. All interval segmentation operations are completed within the perceptual color space, fully utilizing the characteristics of this space that conform to human visual perception, making the segmentation results more in line with actual visual needs.

[0034] S104: Execute the corresponding nonlinear adjustment algorithm in the highlight area, bright tone area, dark tone area and shadow area respectively to obtain the adjusted perceptual space color value; In this embodiment, corresponding nonlinear adjustment algorithms are executed in the highlight area, bright tone area, dark tone area, and shadow area respectively to obtain adjusted perceptual space color values, including: For the highlight areas, a non-linear adjustment is performed using a decaying Sigmoid mapping algorithm to obtain adjusted perceptual space color values.

[0035] Specifically, when performing nonlinear adjustments within the highlight region, the system first obtains the perceptual space color value of each region assigned to the highlight area from the dynamic partitioning step, denoted as input value t. Subsequently, the system processes the values ​​in this region using a pre-defined attenuation-type Sigmoid mapping algorithm. The specific form of this algorithm is as follows: in, Indicates adjustment of the perceptual space color value; k h This is the highlight attenuation coefficient.

[0036] Furthermore, the highlight attenuation coefficient is determined by the highlight value T. h Dynamic calculation: This processing effectively preserves the detail and tonal range of highlight areas, avoiding overexposure caused by traditional linear adjustments. The adjusted color values ​​serve as intermediate results, preparing for subsequent color space restoration operations. Simultaneously, this highlight adjustment algorithm is closely integrated with the overall dynamic color curve adjustment process, its input data derived from the perceptual space color value t and highlight value T generated in previous steps. h The output is then passed to the subsequent space transformation module, forming a complete processing chain.

[0037] In this embodiment, executing corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area, and shadow area to obtain adjusted perceptual space color values ​​further includes: For the bright and dark areas, a nonlinear adjustment is performed using an interpolation algorithm based on cubic polynomials to obtain the adjusted perceptual space color values.

[0038] Specifically, when performing nonlinear adjustments within the highlight and shadow areas, the system first identifies the set of perceptual space color values ​​belonging to the current processing region based on the dynamic partitioning results, and obtains the boundary endpoint information corresponding to that region. For the highlight area, its endpoint coordinates are the lower bound highlight value R of the interval. m1 With upper limit highlight value T h For dark areas, the endpoints are the shadow values ​​T. s With brightness value R m1 Simultaneously, the system will call upon at least one intermediate control point parameter and its target value from the pre-set segmented parameter set that falls within the region. Based on these known endpoint coordinates and control point coordinates, the system employs a curve fitting method, typically solving a system of cubic polynomial equations that satisfies the boundary conditions and control point constraints. The cubic polynomial equation system is shown below: Where y represents the adjustment of the perceptual space color value; x represents the perceptual space color value within the current processing interval, i.e., x∈(R m1 ,T h (Taking the bright tone area as an example). The coefficients a, b, c, and d are obtained by fitting the interval endpoint values ​​with the mid-tone control points (e.g., the endpoint of the bright tone area is (R...). m1 ,p(R m1 )) and (T h ,p(T h The control point is (P) c1 ,p(P c1 ))).

[0039] Taking the highlight area as an example, it includes the left endpoint (R) m1 ,p(R m1 )) and right endpoint (T) h ,p(T h )), where R m1 and T h Derived from the piecewise parameter set, p(R) m1 ) and p(T h These thresholds are mapped to values ​​in the perception space. Simultaneously, the system introduces an intermediate tone control point (P). c1 ,p(P c1 Its position is determined by parameter P. c1 Specify for fine-tuning the curve shape.

[0040] To uniquely determine the cubic polynomial y=ax 3 +bx 2 The coefficients of +cx+d require four independent conditions for the system. In addition to the coordinate constraints at the three points, the system adds a derivative constraint with a slope of 1 at the left endpoint to ensure a smooth transition at the interval boundaries. Specifically, substituting the coordinates of the left endpoint into the polynomial yields the equation a·R.m1 3 +b·R m1 2 +c·R m1 +d=p(R m1 Substituting the coordinates of the right endpoint, we get a·T h 3 +b·T h 2 +c·T h +d=p(T h Substituting the coordinates of the control points into the equation, we get a·P. c1 3 +b·P c1 2 +c·P c1 +d=p(P c1 Furthermore, after differentiating the polynomial, substituting the left endpoint x=R... m1 Setting the derivative value to 1, we obtain 3a·R m1 2 +2b·R m1 +c=1.

[0041] The system organizes the four equations into a system of linear equations and solves for the coefficients a, b, c, and d using matrix operations or numerical methods. During the solution process, all parameters are normalized to ensure numerical stability. Once the coefficients are obtained, the cubic polynomial is fully determined and can be used to calculate the adjustment value y corresponding to any perceptual space color value x within the interval. This fitting method ensures that the interpolation curve passes through the specified points and satisfies boundary continuity, resulting in a natural and smooth color transition between highlight and shadow areas, avoiding the color discontinuity problem of traditional segmented adjustments.

[0042] In this embodiment, executing corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area, and shadow area to obtain adjusted perceptual space color values ​​further includes: For the shadow area, a gain-type exponential mapping algorithm is used for nonlinear adjustment to obtain the adjusted perceptual space color value.

[0043] Specifically, when performing non-linear adjustments within the shadow area, the system first extracts all perceptual space color values ​​ranging from 0 to the shadow value T based on the results of the dynamic interval division. s The pixel values ​​within the range constitute the input set of the shadow region to be processed. For each input value t in this region, the system processes it using a preset gain-type exponential mapping algorithm.

[0044] The calculation formula for the gain-type exponential mapping algorithm is as follows: in, This indicates adjustment of the perceptual space color value; This is the shadow gain coefficient.

[0045] Furthermore, the shadow gain coefficient is determined by T s Dynamic calculation: in, This represents the shading value.

[0046] This processing effectively preserves texture information in shadow areas while suppressing noise. The adjusted color values ​​serve as intermediate results, preparing for subsequent color space restoration operations and ensuring the consistency of the entire dynamic color curve adjustment process. This shadow area adjustment algorithm works in conjunction with the processing of highlight, bright tone, and dark tone areas to achieve precise optimization of image colors.

[0047] S105: Convert the adjusted perceptual space color values ​​in reverse to the linear color space to generate a color adjustment curve.

[0048] In this embodiment, the process of adjusting the color values ​​in the perceptual space and converting them inversely to the linear color space to generate a color adjustment curve includes: The color adjustment curve is generated by inversely converting the perceptual space color values ​​to the linear color space using the following formula: in, This represents linear color values.

[0049] The system then arranges and samples these linear color space values ​​in order from dark to light, typically generating a discrete mapping array of 256 elements, i.e., a color adjustment curve. Each array index corresponds to the input brightness level, and the array value corresponds to the adjusted output brightness value. This color adjustment curve is ultimately output to the image processing module for batch mapping and color correction of the original image pixels.

[0050] In some embodiments, it also includes: Obtain the scene type identifier of the input image, which includes at least one of landscape, portrait, still life, or night scene; The corresponding midtone control point parameter set is called from the preset parameter library according to the scene type identifier. The parameter library stores the mapping relationship between different scene types and midtone control point parameters. Among them, the portrait scene corresponds to the skin tone optimization parameter, and the landscape scene corresponds to the natural lighting optimization parameter. The color space mode of the input image is identified. When the color space mode is a multi-channel color space, the midtone control point parameters are synchronously adapted to the multi-channel color space, including mapping the parameters of the RGB space to the corresponding channels of the printing color mode space. Based on the adapted midtone control point parameters, a piecewise non-linear adjustment of the color curve is performed, where corresponding parameter settings are applied to each channel of the multi-channel color space.

[0051] This embodiment achieves intelligent parameter matching by automatically acquiring image scene type identifiers (such as landscape, portrait, still life, or night scene), avoiding the complexity of manual configuration by users. Based on the scene type, it calls a targeted set of midtone control point parameters from a preset parameter library to ensure accurate adaptation of skin tone optimization for portrait scenes and natural lighting optimization for landscape scenes. At the same time, by identifying color space modes and automatically mapping RGB parameters to corresponding channels in multi-channel color spaces such as printing color modes, it enables independent application of optimization parameters for each channel, effectively improving the compatibility of the method in multi-channel environments and the accuracy of parameter application.

[0052] Specifically, predefined scene type tags are directly read from the Exif information of the image file's exchangeable image file format or other embedded tags. If no valid identifier exists in the metadata, the system initiates a content-based scene analysis process: the raw image data is input into a pre-trained deep learning classification model, which extracts multi-dimensional visual features of the image, such as color distribution, texture complexity, subject outline, and spatial layout, and generates a feature vector. Subsequently, this feature vector is processed by a classifier, outputting a probability distribution for multiple predefined scene categories, including landscape, portrait, still life, and night scene. The system selects the category with the highest probability as the analysis result. Finally, whether the result is read directly from the metadata or obtained through analysis, the system formats it into a unified scene type identifier, such as SCENIC for landscape, PORTRAIT for portrait, STILL_LIFE for still life, and NIGHT for night scene. This identifier is encapsulated as a structured data object, stored in association with the raw image data, and serves as a key input parameter for subsequent intelligent parameter calling processes.

[0053] Next, multi-dimensional feature extraction is performed on the input image, including color histogram statistics, texture complexity calculation, and object semantic recognition. The system automatically determines whether the image belongs to a scene type such as landscape, portrait, still life, or night scene, generating a structured scene type identifier as the input for parameter calls. A preset parameter library stores the mapping relationship between scene types and midtone control point parameters in key-value pairs. The parameter set for portrait scenes includes skin tone balance coefficients, highlight softness values, and shadow detail enhancement values. These parameters are specifically used to optimize the natural tone of facial skin. For example, the skin tone balance coefficient controls the red-yellow ratio to avoid redness, the highlight softness value smooths the bright areas of the face to prevent overexposure, and the shadow detail enhancement value improves the clarity of skin texture in shadow areas. The parameter set for landscape scenes includes sky layer enhancement coefficients, ground detail optimization values, and illumination direction correction parameters, used to enhance the sense of depth in natural landscapes. For example, the sky layer enhancement coefficient optimizes the gradient effect of clouds, the ground detail optimization value highlights the texture features of grass and trees, and the illumination direction correction parameter matches the actual illumination angle to enhance the three-dimensionality of the image. Based on the generated scene type identifier, the system accurately retrieves the corresponding midtone control point parameter set from the preset parameter library. For example, when the scene type is identified as portrait, it automatically extracts the skin tone optimization parameter set; when identified as landscape, it automatically extracts the natural lighting optimization parameter set. The retrieved parameter set serves as the direct input for the midtone control point parameters, seamlessly connecting to the subsequent segmented non-linear adjustment process of the color curve. This ensures that each scene type can perform precise color adjustments based on the preset optimization parameters, achieving fully automated processing from parameter retrieval to color optimization.

[0054] In this embodiment, the complete process of color space identification, parameter adaptation, and adjustment is as follows: The system first loads the input image and parses the color space identifier in its embedded color profile or metadata to identify the color space mode used by the image, such as sRGB, AdobeRGB, or CMYK. When the system determines that the current color space mode is a multi-channel printing color mode, such as CMYK, it immediately initiates the parameter adaptation process. This process takes the set of midtone control point parameters obtained in the previous steps, based on the RGB color space definition, as input. The system calls a preset color space conversion and mapping model, which establishes a correspondence between RGB color values ​​and the contribution values ​​of each channel in the target CMYK based on color science principles. During mapping, the system decomposes and recalculates the desired overall color shift effect of each RGB space midtone control point into independent adjustment amounts for the four channels: cyan, magenta, yellow, and black, thereby generating a set of adapted, dedicated midtone control point parameters for each CMYK channel.

[0055] Subsequently, the system enters the adjustment execution phase for the multi-channel color space. The system separates the original CMYK image data by channel, and for each color channel (C, M, Y, K), loads the midtone control point parameters specifically adapted for that channel, generated in the previous steps. Then, following the core process of piecewise nonlinear adjustment, the system independently performs the adjustment within each channel: dynamically dividing intervals based on channel-specific parameters and applying corresponding nonlinear algorithms to each interval. This process is executed in parallel or sequentially on the four channels, ultimately generating a set of adjusted color values ​​for each channel. Finally, the system re-merges the adjusted data from each channel and outputs the final processed CMYK format image data.

[0056] In some embodiments, it also includes: Obtain the original data of the image to be adjusted and the initial segmentation parameter set, which includes highlight value, bright tone value, dark tone value, shadow value and midtone control point parameters; Based on the initial segmented parameter set, piecewise nonlinear color adjustment is performed on the original data to generate the first adjusted image; A visual quality score is calculated based on the visual attributes of the first adjusted image, including detail retention, smoothness of transitions, and color naturalness. An optimization model is established with the objective function of maximizing the visual quality score. The decision variables of the optimization model are the parameter values ​​of the piecewise parameter set. A first constraint and a second constraint are constructed. The first constraint is used to define the linkage between the highlight value, the brightness value, the shadow value and the shadow value. The second constraint is used to limit the adjustment range of each parameter value within a preset boundary. Solve the optimization model to obtain the optimal piecewise parameter set that satisfies the first and second constraints.

[0057] This embodiment clarifies and calculates the direction of image color optimization by defining visual quality as a comprehensive score encompassing detail retention, smoothness of transitions, and naturalness of color, setting it as the objective function. This eliminates the inefficient manual trial-and-error approach of traditional methods. Simultaneously, introducing the interrelationship between parameters as the first constraint ensures that the adjustment intensity of key areas such as highlights, bright tones, dark tones, and shadows changes synergistically, avoiding color imbalances or local distortions caused by unreasonable parameter combinations. Furthermore, the second constraint restricts the parameter values ​​within preset physical boundaries, fundamentally preventing color overflow or information loss caused by over-adjustment, thus guaranteeing the stability and reliability of the output results. Finally, by solving this constrained optimization model, the optimized piecewise parameter set is directly output. This not only achieves a high degree of systematization and automation in the adjustment process, significantly improving processing efficiency and consistency, but also, due to the mathematical clarity of the entire optimization framework, provides better interpretability of the basis for parameter decisions and the source of adjustment effects, laying a solid foundation for further algorithm debugging and performance improvement.

[0058] Specifically, the system acquires the raw data of the image to be adjusted by reading the pixel information of the image file. Specifically, it extracts the RGB color value of each pixel and normalizes these values ​​to a range of 0 to 1, forming linear color data for subsequent processing. Simultaneously, the system acquires an initial segmentation parameter set, which includes highlight threshold, brightness ratio, shadow ratio, shadow threshold, and midtone control point parameters. The highlight threshold is typically set between 0.8 and 1.0, the brightness ratio between 0.5 and 0.8, the shadow ratio between 0.2 and 0.5, the shadow threshold between 0 and 0.2, and the midtone control point parameters are within the range of 0 to 1. These parameters can be interactively input by the user through a graphical user interface. For example, users can adjust the highlight threshold to 0.9, the bright tone ratio to 0.6, the shadow tone ratio to 0.3, and the shadow threshold to 0.1 using sliders, and set multiple midtone control point parameters such as 0.25, 0.5, and 0.75 to define the shape of the color curve. Alternatively, the system can automatically load parameter sets from a preset scheme library. These preset schemes are optimized based on common image types such as portraits, landscapes, or low-light scenes. The acquired raw data and initial parameter set are then passed to the system's color conversion module for subsequent dynamic range division and non-linear adjustments, ensuring that the color adjustment process adapts to the specific characteristics of the image from the beginning and provides a basis for further optimization. The entire acquisition process integrates user interaction and automated processing, making parameter settings both flexible and repeatable, improving the efficiency and consistency of color adjustment.

[0059] Based on the acquired initial segmented parameter set, piecewise nonlinear color adjustment is performed on the original image data to generate the first adjusted image. This process begins with color space conversion, where the system maps the original linear RGB color data to a nonlinear space that conforms to human visual perception through a forward Gamma conversion function, laying the foundation for subsequent adjustments that conform to visual characteristics. Next, based on the highlight threshold, brightness ratio, shadow ratio, and shadow threshold in the initial parameter set, the system dynamically divides the normalized color range from 0 to 1 into four regions: highlight, brightness, shadow, and shadow. This division replaces the traditional fixed thresholds and better adapts to the brightness distribution of the current image. Subsequently, customized nonlinear mapping algorithms were employed for different regions: for highlight areas, a decaying sigmoid function was applied, with its decay coefficient dynamically calculated from the highlight threshold, aiming to suppress overexposure while preserving highlight details; for bright and dark areas, cubic polynomial interpolation based on the midtone control points of the initial parameter set was used to ensure smooth and natural transitions in midtones; for shadow areas, a gain-type exponential mapping was applied, with its gain coefficient dynamically determined by the shadow threshold, to enhance shadow details while suppressing noise amplification. All mapping algorithms strictly adhered to monotonicity, continuity, and boundary constraints to ensure the correctness of the adjusted color relationships and the reasonableness of the results. Finally, the system restored the processed perceptual space color values ​​to the linear RGB space through inverse Gamma conversion, generating the first adjusted image data containing the adjusted color values ​​of all pixels. This data can be directly used for display or as input for subsequent optimization processes. The entire adjustment process closely depends on the initial parameter set, achieving closed-loop processing from parameter input to image output.

[0060] Furthermore, a visual quality score is calculated based on the visual attributes of the first adjusted image. These visual attributes include detail retention, smoothness of transitions, and color naturalness. Obtain the first adjusted image generated through piecewise nonlinear color adjustment; Analyze the pixel gradient changes in the highlight and shadow areas of the first adjusted image to generate first visual attribute data representing the degree of detail preservation. Calculate the continuity of the first derivative of the color curve of the first adjusted image at the intersection of each interval, and generate second visual attribute data representing the degree of transition smoothness. The color distribution of the first adjusted image is compared with the standard color gamut to generate third visual attribute data that characterizes the degree of color deviation. Based on the first visual attribute data, the second visual attribute data, and the third visual attribute data, a fusion calculation is performed using a preset weighted scoring model to output the comprehensive visual quality score of the first adjusted image.

[0061] Specifically, the process of calculating a visual quality score based on the first adjusted image begins with acquiring the first adjusted image data after piecewise nonlinear color adjustment. Then, the system performs detail retention analysis, specifically targeting the highlight and shadow regions defined by the current parameter set in the image. It calculates the local gradient magnitude changes of pixels within these regions, and by comparing the gradient variance of the original and adjusted images in the corresponding regions, it quantifies the degree of detail loss or enhancement, generating a specific detail retention index as the first visual attribute data. Next, the system performs transition smoothness evaluation. By reading the final color adjustment curve used to generate the first adjusted image, it precisely calculates the first derivative of this curve at the intersection points of each interval: highlight and bright tones, bright tones and dark tones, and dark tones and shadows. It checks whether the derivative values ​​of adjacent intervals at the intersection points are equal or the difference is within an allowable minimum threshold, thereby determining whether there are any abrupt changes and outputting a smoothness index representing overall continuity as the second visual attribute data. Then, the system evaluates color naturalness by converting the first adjusted image to the Lab color space and comparing its color point distribution with a preset standard color gamut (such as sRGB or AdobeRGB). It then calculates the proportion of pixels falling outside the standard color gamut and their average color difference, generating an index characterizing the degree of color deviation as the third visual attribute data. Finally, the system inputs the obtained first, second, and third visual attribute data into a preset weighted scoring model. This model assigns weights based on visual perception importance to each attribute, calculating using linear weighting or non-linear fusion functions, and ultimately outputting a comprehensive, quantitative visual quality score. This score directly reflects the overall visual quality of the color adjustment under the current parameter set.

[0062] In some embodiments, an optimization model is established with the objective function of maximizing the visual quality score. The decision variables of the optimization model are the parameter values ​​of a piecewise parameter set. A first constraint and a second constraint are constructed. The first constraint defines the linkage between highlight values, tonal values, shadow values, and shading values. The second constraint limits the adjustment range of each parameter value within a preset boundary, including: Obtain the overall visual quality score to be optimized and the initial segmentation parameter set to be optimized. The initial segmentation parameter set includes highlight value, light tone value, dark tone value and shadow value. To maximize the overall visual quality score, an objective function is established regarding the parameter values ​​of the initial segmentation parameter set. Based on the preset functional relationship between highlight value, luminance value, shadow value and shadow value, the first constraint condition for defining the linkage relationship of parameters is constructed. Based on the preset numerical boundaries corresponding to each of the highlight value, luminance value, shadow value and shadow value, a second constraint condition is constructed to limit the range of parameter values. By combining the objective function, the first constraint, and the second constraint, a complete parameter optimization problem can be constructed. Solve the parameter optimization problem to obtain the optimized piecewise parameter set that satisfies the first and second constraints.

[0063] Specifically, the system obtains the comprehensive visual quality score to be optimized, output by the aforementioned quality assessment module, and the initial segmentation parameter set currently in use. This parameter set explicitly includes key decision variables such as highlight threshold, brightness ratio, shadow ratio, and shadow threshold. Subsequently, the system establishes a mathematical objective function with the sole optimization goal of maximizing this comprehensive visual quality score. This function expresses the visual quality score as a function of the aforementioned four parameter values. Next, the system constructs a first constraint condition based on the inherent physical and visual relationships between the parameters. For example, the highlight threshold must be greater than the brightness ratio, the brightness ratio must be greater than the shadow ratio, and the shadow ratio must be greater than the shadow threshold, thus forming an ordered set of linked constraints to ensure the logical correctness of the interval division. Simultaneously, the system constructs a second constraint condition based on the preset effective ranges of the parameters in the technical solution. For example, the highlight threshold is between 0.8 and 1.0, the brightness ratio is between 0.5 and 0.8, the shadow ratio is between 0.2 and 0.5, and the shadow threshold is between 0 and 0.2, setting strict upper and lower limits for each parameter variable. Then, the system combines the objective function that maximizes the visual quality score, the first set of inequality constraints defining the parameter linkage, and the second set of inequality constraints defining the parameter value boundaries to construct a complete, constrained nonlinear parameter optimization problem. Finally, the system uses numerical optimization algorithms such as sequential quadratic programming or interior point methods to iteratively solve the problem. Under the premise of simultaneously satisfying all constraints, it searches for the parameter combination that maximizes the objective function value, and finally outputs a set of optimized highlight thresholds, brightness ratios, shadow ratios, and shadow thresholds, constituting an optimized piecewise parameter set.

[0064] Next, the objective function and two sets of constraints are integrated to form a complete example of a constrained nonlinear programming problem. The system then uses a sequential quadratic programming algorithm for iterative solution. This algorithm approximates the nonlinear problem at the current parameter point (the initial point is the initial set of piecewise parameters) in each iteration as a quadratic programming subproblem. In each iteration, the algorithm calculates the gradient and Hessian matrix approximation of the objective function (i.e., the visual quality scoring model) based on the current parameter values, and rigorously checks whether the parameters satisfy the linkage relationship defined by the first constraint and the numerical boundary defined by the second constraint. Using this information, the algorithm solves the subproblem to determine a search direction and step size, thereby generating a new, updated set of candidate piecewise parameters. The system uses this candidate parameter set as input to re-execute the complete piecewise nonlinear color adjustment process and calculate its corresponding comprehensive visual quality score. This new score and parameter set are then fed back to the optimization algorithm to evaluate the improvement of the objective function and the satisfaction of constraints. This iterative process is repeated, with each set of intermediate parameters generated serving as the starting point for the next iteration and used for new score calculations, until the algorithm meets preset convergence conditions, such as the visual quality score improvement between two consecutive iterations being less than a set threshold, or reaching the maximum number of iterations. Finally, the system outputs the parameter set obtained at convergence, which simultaneously satisfies all linkage relationships and boundary constraints, as the final segmented parameter set after optimization.

[0065] In some embodiments, it also includes: In the Gamma color space, the input image is dynamically divided into intervals and piecewise nonlinearly adjusted based on a set of segmented parameters to generate the first adjusted image. The first adjusted image is converted from the Gamma color space to the Lab color space to generate the first Lab image; In the first Lab image, the brightness value of its L channel is finely adjusted based on the human eye perception model to generate adjusted L channel data. At the same time, the color balance of the a and b channels of the first Lab image is adjusted to generate adjusted a channel data and b channel data respectively. The adjusted L-channel data, a-channel data, and b-channel data are merged to generate a second Lab image; Convert the second Lab image from the Lab color space back to the RGB color space and output the final adjusted image.

[0066] This embodiment utilizes the Gamma space for basic, display-characteristic-compliant global and regional non-linear adjustments, ensuring the structure and efficiency of the adjustments. It then transitions to the Lab space, leveraging its ability to completely separate luminance (L channel) from color information (a and b channels). Fine-tuning of luminance in the L channel, more aligned with human visual non-linear luminance perception, is performed, while color balance correction is conducted independently in the a and b channels. This effectively avoids the color shift issues that are difficult to prevent when adjusting luminance in a single RGB or Gamma space, thus achieving more precise and independent control over image contrast and color tendencies.

[0067] Specifically, the system receives first adjusted image data processed in the Gamma color space, which exists as perceptual space color values ​​after non-linear adjustment. Subsequently, the system performs a conversion from Gamma-encoded RGB values ​​to the standard Lab color space. This conversion process first transforms the Gamma-encoded RGB values ​​back to linear light intensity RGB values ​​using an inverse Gamma function. Next, the system applies a color transformation matrix defined in the CIE standard to convert the linear RGB values ​​to the XYZ tristimulus color space. This conversion is accomplished using a 3x3 linear transformation matrix, with matrix coefficients determined according to the standard observer color matching function and the white point definition of the specific RGB color space. Then, the system further converts the resulting XYZ values ​​into three components of the Lab color space through a non-linear transformation: L (lightness), a (red-green axis), and b (yellow-blue axis). The calculation of the L component involves the ratio of the XYZ values ​​to a reference white point value, and a cube root function is applied to simulate the non-linear brightness perception of the human eye; the calculation of the a and b components is based on the non-linear differences between these ratios. The system performs the aforementioned series of calculations on each pixel in the first adjusted image, ultimately generating a new image composed of data from three channels: L, a, and b*, namely the first Lab image. This image fully preserves the overall brightness and color tendency of the previous Gamma space adjustment, while its data format has been transformed into a brightness and color contrast representation that better conforms to the characteristics of human visual perception, thus preparing the data for subsequent fine-grained independent channel adjustments in Lab space.

[0068] Furthermore, in the first Lab image, the brightness value of its L channel is finely adjusted based on a human eye perception model to generate adjusted L channel data. Simultaneously, color balance adjustments are performed on the a and b channels of the first Lab image, generating adjusted a channel and b channel data respectively, including: Acquire the first Lab image, which contains L-channel luminance data, a-channel color data, and b-channel color data; The L-channel brightness data is processed using a nonlinear mapping function based on the human eye perception model. The nonlinear mapping function is designed based on the visual characteristics of the human eye, which has increased sensitivity in the middle and decreased sensitivity in extremely bright and dark areas, to generate adjusted L-channel data. Color balance adjustment is performed in parallel on the color data of channel a and color data of channel b. The adjustment includes calculating the color offset based on the distribution centroid of the first Lab image on the ab color plane, and performing translation correction based on the offset and the preset neutral point. At the same time, a saturation constraint factor related to the brightness data of channel L is introduced to dynamically modulate the correction amplitude, and the adjusted channel a data and adjusted channel b data are generated respectively.

[0069] Specifically, the system acquires a first Lab image, which contains L-channel luminance data, a-channel color data, and b-channel color data. The L-channel represents the luminance component, typically ranging from 0 to 100, while the a and b channels represent the color components. The system first parses the Lab image data, extracting the luminance value sequence from the L-channel, which represents the image's brightness distribution. Next, the system applies a non-linear mapping function based on a human eye perception model to process the L-channel data. This function is specifically designed based on the characteristics of human vision: the human eye is highly sensitive to mid-tone luminance regions (e.g., L values ​​of 40-60), perceiving subtle changes, while sensitivity to extremely bright regions (L values ​​close to 100) and extremely dark regions (L values ​​close to 0) decreases significantly, resulting in reduced detail resolution. The mapping function uses an S-curve or similar variant, setting a steeper slope in the mid-tone region to enhance detail contrast, and a smooth transition in extremely bright and dark regions to compress the dynamic range and avoid overexposure or blackouts. During processing, the system inputs the brightness value of each L channel into a mapping function, and generates adjusted L channel data through mathematical calculations. The adjusted data maintains the same numerical range, but the brightness distribution is more in line with the characteristics of human eye perception, thereby improving the visual naturalness and detail discernibility of the image. The entire process is integrated into the color processing pipeline, and the adjusted L channel data can be recombine with the original a and b channel data for subsequent image output or further color adjustments.

[0070] Next, the complete dataset of the first Lab image is loaded, and the a-channel and b-channel color data are separated from it. Then, the system performs statistical analysis on the a and b values ​​of all pixels, calculating their centroid coordinates on the ab two-dimensional color plane. Specifically, the arithmetic mean of all a-values ​​and the arithmetic mean of all b-values ​​are calculated to determine the overall color shift tendency of the image. Next, the system compares these calculated centroid coordinates with the preset neutral point coordinates, calculating the difference between the two along the a-axis and b-axis, which are defined as the a-channel color shift and the b-channel color shift, respectively.

[0071] Next, the system performs translation correction on the original a and b values ​​of each pixel. This involves subtracting the a-channel color offset from the original a value and the b-channel color offset from the original b value to initially correct the overall color cast. Simultaneously, to prevent unnatural color saturation changes in bright or dark areas of the image during the correction process, the system introduces a saturation constraint factor related to the L-channel brightness data. This factor is a dynamically calculated weighted coefficient based on the current pixel's L value. Its design allows for a stronger correction amplitude in mid-tone areas (with moderate L values) to optimize color balance, while applying stronger constraints in extremely bright or dark areas (with L values ​​close to their extremes), thus significantly reducing the correction amplitude and preserving the color naturalness of these areas. The system multiplies the calculated dynamic constraint weights by the aforementioned translation correction amount, achieving independent modulation of the correction amplitude for each pixel. Finally, the system combines the modulated correction amount with the pixel's original a and b values ​​to calculate and output the adjusted a-channel and b-channel data.

[0072] Upon receiving the adjusted L-channel data, adjusted a-channel data, and adjusted b-channel data, these three independent data matrices are recombine according to the pixel position correspondence. Each pixel is assigned a triplet consisting of a new L-value, a-value, and b-value, thereby generating a complete image in the Lab color space, i.e., the second Lab image, in terms of data structure.

[0073] Subsequently, the system initiates a reverse conversion process from the Lab color space to the standard RGB color space. This process, performed according to the CIE color standard, first converts the L, a, and b values ​​of each pixel in the second Lab image back to XYZ tristimulus values ​​using a standard formula. This conversion involves non-linear calculations based on a reference white point, where the L value is used to recover the relative brightness of the Y stimulus value, and the a and b values ​​are used to calculate the X and Z stimulus values. After obtaining the XYZ values ​​for each pixel, the system applies a precise 3x3 inverse transformation matrix corresponding to the forward conversion to linearly convert the XYZ values ​​to linear RGB values. Finally, the system performs Gamma encoding on the resulting linear RGB values, mapping the linear light intensity values ​​to non-linear RGB values ​​for display or storage using the standard sRGB gamma correction function (or a corresponding function defined according to the target RGB color space). The system iterates through all pixels of the second Lab image, sequentially performing the above calculations, and finally outputs a set of standard RGB pixel data, constituting the final adjusted image.

[0074] In some embodiments, it also includes: Obtain the semantic content analysis results of the input image, and calculate the semantic score of the image content based on the semantic content analysis results; Based on the semantic score of image content, the first adjustment weight and the second adjustment weight are dynamically determined by a preset weight calculation function. The first adjustment weight is calculated by inputting the semantic score of image content into a sigmoid function, and the second adjustment weight is obtained by subtracting the first adjustment weight from the value 1. Perform a first color adjustment on the input image in the Gamma color space to generate a first adjusted image, and perform a second color adjustment on the input image or the first adjusted image in the Lab color space to generate a second adjusted image; The color data of the first adjusted image is weighted using a first adjustment weight, and the color data of the second adjusted image is weighted using a second adjustment weight. The color data of the first adjusted image after weighted processing is fused with the color data of the second adjusted image after weighted processing to generate and output the final adjusted image.

[0075] This embodiment achieves intelligent and adaptive image adjustment through semantic content analysis. It dynamically calculates sigmoid weights based on semantic scores, making the adjustment process smooth and natural, and avoiding abrupt changes caused by fixed parameters. At the same time, it combines the collaborative optimization of Gamma color space (suitable for brightness adjustment) and Lab color space (suitable for color adjustment), and by weightedly fusing the two adjustment results, it preserves brightness details and optimizes color performance. This multi-space, multi-dimensional adjustment mechanism can automatically adjust and optimize strategies for images with different semantic content, effectively improving the accuracy and visual effect of image processing, and avoiding the limitations of single adjustment methods in traditional methods.

[0076] In some embodiments, obtaining the semantic content analysis results of the input image and calculating the image content semantic score based on the semantic content analysis results includes: Obtain the raw pixel data of the input image, which includes the color values ​​and pixel coordinate information of each channel of the image, to obtain the raw pixel data of the input image; Based on the original pixel data of the input image, the semantic content features of the image are extracted through a multi-layer feature extraction network. The semantic content features include shallow texture features, mid-layer contour features and deep category features, resulting in a semantic content feature set of the input image. Based on the semantic content feature set of the input image, feature similarity matching calculation is performed with a preset semantic category library. The preset semantic category library stores preset semantic categories such as sky, grass, people, and buildings, as well as feature templates corresponding to each semantic category. The semantic content analysis result of the input image is obtained. The semantic content analysis result includes the matched main semantic category, the pixel proportion of each semantic category in the image, and the regional distribution information of the semantic subject in the image. The image content semantic scoring calculation rules are set, which include the basic scoring value table of the main semantic category, the weighting coefficient corresponding to the pixel proportion of each semantic category, and the calculation method of the semantic subject region distribution correction coefficient, thus obtaining the image content semantic scoring calculation rules. Based on the semantic content analysis results of the input image and the image content semantic scoring calculation rules, the basic score value matching the main semantic category is retrieved from the basic score value table of the main semantic category. The pixel proportion of each semantic category is multiplied by the corresponding weighting coefficient to obtain the proportion score contribution value of each semantic category. The region distribution correction coefficient is calculated based on the semantic subject region distribution information and the proportion score contribution value is corrected. The corrected proportion score contribution values ​​are summed and added to the basic score value of the main semantic category to calculate the image content semantic score of the input image.

[0077] Specifically, the system acquires the raw pixel data of the input image. This data is usually organized in the form of a multidimensional array, containing the value of each pixel in each color channel (such as the RGB three channels) and its corresponding coordinate information. The system obtains this structured raw data by decoding the image file or receiving the data stream.

[0078] Based on the acquired raw pixel data, the system extracts semantic content features of the image through a multi-layer feature extraction network. This network typically employs a convolutional neural network architecture. Its shallow convolutional layers primarily extract texture features of the image, such as edges and spots; the mid-layer network captures contour features, forming the approximate shape of objects; and the deep network abstracts high-level semantic features to identify the category to which the image belongs. The forward propagation process of the network aggregates these features from different levels to generate a semantic content feature set containing multi-layered information.

[0079] Subsequently, the system performs feature similarity matching calculations based on the extracted semantic content feature set and a pre-set semantic category library. The pre-set semantic category library stores feature templates for various categories such as sky, grass, people, and buildings. The matching calculation is performed by comparing the cosine or Euclidean distance between the input features and the features of each template, ultimately outputting the semantic content analysis results. These results not only include the matched main semantic categories (e.g., landscape, including sky and grass), but also the percentage of pixels occupied by each identified semantic category in the entire image, and the specific location distribution information of the semantic subject (e.g., the sky area) within the image.

[0080] To quantitatively evaluate image content, the system sets out semantic scoring rules for image content. These rules consist of several core components: a basic score value table for main semantic categories, assigning basic scores to different main categories such as people and landscapes; a mapping function, configuring corresponding weighting coefficients for the pixel proportion of each semantic category, typically with higher pixel proportions resulting in larger weighting coefficients; and an algorithm that calculates region distribution correction coefficients based on semantic subject region distribution information (such as whether it is located in the visual center).

[0081] Finally, based on the semantic content analysis results obtained earlier and the established scoring rules, the system performs the scoring calculation. The specific process is as follows: First, the system queries the basic score value corresponding to the matched main semantic category from the basic score value table; then, it multiplies the pixel proportion of each semantic category obtained from the analysis results by the corresponding weighting coefficient in the scoring rules to obtain the preliminary proportion score contribution value for each category; next, it corrects these preliminary contribution values ​​based on the correction coefficient calculated according to the semantic subject region distribution information; for example, topics located in the visual center will receive a coefficient bonus; finally, it sums all the corrected proportion score contribution values ​​and adds them to the basic score value of the main semantic category to obtain the image content semantic score of the input image.

[0082] Next, the semantic score of the input image content is obtained. This score, derived from the preceding semantic analysis step, is typically a normalized value ranging from 0 to 1, representing the semantic importance or feature strength of the image content. The system then processes this score using a pre-defined weight calculation function to dynamically determine the first adjustment weight. This weight calculation function is a sigmoid function, mathematically expressed as: the first adjustment weight equals 1 divided by 1 plus e^(-k) multiplied by the semantic score minus the power of threshold. Here, k is a pre-defined slope parameter controlling the steepness of the function curve, and threshold is a pre-defined threshold parameter used to adjust the center point of the function. By inputting the image content semantic score into this sigmoid function, the system calculates the first adjustment weight, which smoothly maps to the interval between 0 and 1, ensuring continuous and abrupt weight changes. Subsequently, the system generates a second adjustment weight through arithmetic operations. Specifically, the value 1 is subtracted from the first adjustment weight, making the second adjustment weight complementary to the first, with their sum always equal to 1. This dynamic weighting mechanism allows the system to adaptively balance the contributions of different adjustment strategies based on the image content. A higher weight for the first adjustment indicates a preference for one processing method, while a higher weight for the second adjustment favors another. The entire process ensures the automation and adaptability of weight calculation, providing reliable weight input for subsequent color adjustment stages.

[0083] The input image is then converted from its original color space to the Gamma color space, and adjustment algorithms targeting contrast and brightness characteristics are applied, including but not limited to Gamma correction and tone curve mapping operations, to generate a first adjusted image. Simultaneously or sequentially, a second color adjustment is performed on either the input image or the first adjusted image in the Lab color space. When adjusting the input image, the system converts it to the Lab color space; when processing the first adjusted image, it is first converted from the Gamma space to the Lab space, and then a color balance and saturation optimization algorithm based on human eye perception is applied in the Lab space to generate the second adjusted image.

[0084] Next, obtain the pre-calculated first adjustment weight and second adjustment weight. These two weight values ​​are calculated through semantic scoring and satisfy the constraint that the weight sum is 1. Use the first adjustment weight to perform scalar weighting on the color data of each pixel in the first adjusted image, that is, multiply each channel value by the first adjustment weight. Simultaneously, use the second adjustment weight to perform weighting on the corresponding pixel color data of the second adjusted image, with the weighting method being that each channel value is multiplied by the second adjustment weight.

[0085] The color data of the two weighted images are then fused pixel-by-pixel. For each pixel, the weighted color data of the first and second adjusted images are added channel-by-channel to generate a fused pixel value. During the fusion process, the color value range is ensured not to overflow; values ​​exceeding the standard range are limited. Finally, the system recombines the fused color data into a complete image matrix, converts it back to the target color space, and outputs the final adjusted image. This entire process, through dual-space adjustment and weighted fusion, fully utilizes the advantages of different color spaces to achieve image enhancement effects that better meet visual requirements.

[0086] This embodiment introduces a dynamically settable set of segmented parameters, replacing the traditional fixed interval division, thus enabling adaptive adaptation to the brightness distribution of different images. Based on this, differentiated nonlinear mapping algorithms are employed for the four intervals of highlights, light tones, shadows, and dark tones, and adjustments are performed within the color space perceived by the human eye, ensuring the monotonicity and continuity of the adjustment curve. This effectively overcomes the detail loss caused by global adjustments and the color banding problem caused by fixed segmentation, achieving highlight detail preservation, shadow noise suppression, and a natural and smooth tonal transition.

[0087] Please see Figure 4 This embodiment provides a color curve dynamic adjustment device 200, including: The acquisition unit 201 is used to acquire the original color values ​​of the image and set a segmentation parameter set; the segmentation parameter set includes highlight value, light tone value, dark tone value and shadow value; The conversion unit 202 is used to convert the original color value from a linear color space to a perceptual color space; The segmentation unit 203 is used to dynamically segment the highlight area, light tone area, dark tone area and shadow area in the perceptual color space according to the segmentation parameter set; The adjustment unit 204 is used to execute corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area and shadow area respectively to obtain the adjusted perceptual space color value; The generation unit 205 is used to reverse the adjustment of the color values ​​in the perception space to the linear color space and generate a color adjustment curve.

[0088] Furthermore, the acquisition unit 201 includes: A receiving subunit is used to receive raw values ​​input by the user; the raw values ​​include raw values ​​for highlights, highlights, shadows, and at least one raw value for a midtone control point. The constraint subunit is used to constrain the original values ​​and generate ordered parameter values; The parameter value normalization subunit is used to normalize the ordered parameter values ​​to a preset numerical range to generate normalized parameter values. The combination subunit is used to combine the normalized parameter values ​​into a piecewise parameter set.

[0089] Furthermore, the conversion unit 202 includes: The color value normalization subunit is used to normalize the original color value to obtain the processed color value; A spatial transformation subunit is used to transform the processed color values ​​from a linear color space to a perceived color space according to the following formula: Where p(e) is the color value of the perceptual space; e represents the processed color value.

[0090] Furthermore, the partitioning unit 203 includes: The first dividing subunit is used to divide the range within the perceived color space where the perceived color value is greater than the highlight value and the perceived color value is less than or equal to 1 into a highlight area; the highlight value is less than or equal to 1. The second dividing subunit is used to divide the range where the perceived spatial color value is greater than the brightness value and the perceived spatial color value is less than or equal to the highlight value into a brightness zone; wherein the highlight value is greater than the brightness value. The third dividing subunit is used to divide the range where the perceived spatial color value is greater than the shadow value and the perceived spatial color value is less than or equal to the highlight value into a dark tone area; where the highlight value is greater than the shadow value. The fourth dividing subunit is used to divide the range where the perceived spatial color value is greater than or equal to 0 and the perceived spatial color value is less than or equal to the shadow value into a shadow area; wherein the shadow value is greater than or equal to 0.

[0091] Furthermore, the adjustment unit 204 includes: The first adjustment subunit is used to perform nonlinear adjustment on the highlight area using a decaying Sigmoid mapping algorithm to obtain an adjusted perceptual space color value.

[0092] Furthermore, the adjustment unit 204 includes: The second adjustment subunit is used to perform nonlinear adjustments on the bright and dark areas using an interpolation algorithm based on cubic polynomials to obtain adjusted perceptual space color values.

[0093] Furthermore, the adjustment unit 204 includes: The third adjustment subunit is used to perform nonlinear adjustment on the shadow area using a gain-type exponential mapping algorithm to obtain the adjusted perceptual space color value.

[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0095] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, can implement the methods provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0096] The present invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the methods provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.

[0097] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.

[0098] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusivity.

[0099] The term "comprises" implies that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for dynamically adjusting color curves, characterized in that, include: Obtain the original color values ​​of the image and set a segmented parameter set; the segmented parameter set includes highlight value, light tone value, dark tone value and shadow value; The original color values ​​are converted from the linear color space to the perceptual color space; Based on the segmentation parameter set, the highlight area, light tone area, dark tone area and shadow area are dynamically divided in the perceptual color space; In the highlight area, bright tone area, dark tone area and shadow area, the corresponding nonlinear adjustment algorithm is executed to obtain the adjusted perceptual space color value; The color values ​​in the adjusted perception space are converted inversely to the linear color space to generate a color adjustment curve.

2. The method for dynamically adjusting color curves according to claim 1, characterized in that, The segmentation parameter set includes: Receive raw values ​​input by the user; the raw values ​​include raw values ​​for highlights, highlights, shadows, and at least one raw value for a midtone control point; The original values ​​are constrained to generate ordered parameter values; The ordered parameter values ​​are normalized to a preset numerical range to generate normalized parameter values; The normalized parameter values ​​are combined into a piecewise parameter set.

3. The method for dynamically adjusting color curves according to claim 1, characterized in that, The step of converting the original color value from the linear color space to the perceptual color space includes: The original color values ​​are normalized to obtain the processed color values; The processed color values ​​are converted from the linear color space to the perceptual color space according to the following formula: Where p(e) is the color value of the perceptual space; e represents the processed color value.

4. The method for dynamically adjusting color curves according to claim 1, characterized in that, The step of dynamically dividing the color space into highlight, light tone, dark tone, and shadow regions based on the segmented parameter set includes: The range within the perceived color space where the perceived color value is greater than the highlight value and the perceived color value is less than or equal to 1 is defined as the highlight area; the highlight value is less than or equal to 1. The range in which the perceived spatial color value is greater than the brightness value and the perceived spatial color value is less than or equal to the highlight value is divided into a brightness zone; the highlight value is greater than the brightness value. The range where the perceived spatial color value is greater than the shadow value and the perceived spatial color value is less than or equal to the highlight value is divided into the dark tone zone; the highlight value is greater than the shadow value. The range where the perceived spatial color value is greater than or equal to 0 and the perceived spatial color value is less than or equal to the shadow value is divided into shadow areas; where the shadow value is greater than or equal to 0.

5. The method for dynamically adjusting color curves according to claim 1, characterized in that, The step of executing corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area, and shadow area to obtain adjusted perceptual space color values ​​includes: For the highlighted area, a nonlinear adjustment is performed using a decaying Sigmoid mapping algorithm to obtain the adjusted perceptual space color value.

6. The method for dynamically adjusting color curves according to claim 1, characterized in that, The step of executing corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area, and shadow area to obtain adjusted perceptual space color values ​​includes: For the bright and dark tones, a nonlinear adjustment is performed using an interpolation algorithm based on cubic polynomials to obtain the adjusted perceptual space color values.

7. The method for dynamically adjusting color curves according to claim 1, characterized in that, The step of executing corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area, and shadow area to obtain adjusted perceptual space color values ​​includes: For the shadow area, a gain-type exponential mapping algorithm is used for nonlinear adjustment to obtain the adjusted perceptual space color value.

8. A color curve dynamic adjustment device, characterized in that, include: An acquisition unit is used to acquire the original color values ​​of an image and set a segmented parameter set; the segmented parameter set includes highlight values, light tone values, shadow tone values, and shadow values. A conversion unit is used to convert the original color values ​​from a linear color space to a perceptual color space; The segmentation unit is used to dynamically divide the highlight area, light tone area, dark tone area and shadow area in the perceptual color space according to the segmentation parameter set; The adjustment unit is used to execute corresponding nonlinear adjustment algorithms in the highlight area, bright tone area, dark tone area and shadow area respectively to obtain the adjusted perceptual space color value; The generation unit is used to reverse the adjustment of the color values ​​in the perception space to the linear color space and generate a color adjustment curve.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the color curve dynamic adjustment method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the color curve dynamic adjustment method as described in any one of claims 1 to 7.