A color vision abnormality correction method based on color transformation

By using a color transformation-based method, combined with CIE Lab and LMS spatial models, the problem of color correction in complex scenes was solved. This method achieves a balance between enhanced local color discrimination and global color naturalness, avoids color flicker and artifacts, and ensures the continuity of the video stream.

CN122289405APending Publication Date: 2026-06-26INNER MONGOLIA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610345718.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-20
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing color vision abnormality correction methods struggle to balance enhancing the differentiation of locally confused colors with maintaining the naturalness of global image colors in complex scenes, and are prone to causing spatial boundary artifacts and temporal color flicker in continuous video stream processing.

Method used

By using a color transformation-based method and employing red-green visual aberration simulation models in the CIE Lab color space and LMS space, the degree of confusion is calculated by combining nonlinear distance weights and local spatial neighborhood aggregation, generating a target mapping curve. Then, pixel-level interpolation fusion is guided by local weight masks to construct a spatiotemporal joint optimization objective function, thereby achieving closed-loop constraints for hue compensation and constant brightness.

Benefits of technology

It effectively extracts local color confusion areas, maintains natural image transitions, avoids color abruptness and spatial boundary discontinuity, reduces hue shift and local exposure distortion in complex lighting scenes, and ensures the visual continuity of dynamic video streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289405A_ABST
    Figure CN122289405A_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer vision and image processing technology, and discloses a color vision anomaly correction method based on color transformation. The method includes: first, converting the input image to the CIE Lab space; calculating the color confusion degree of pixels using an LMS simulation model to generate a target mapping curve; extracting color components to calculate the relative chromaticity difference quotient, and obtaining smoothing mask weights through filtering; subsequently constructing hue constraint features based on RGB energy ratios, performing differential compensation on the red and green channels, and using the energy recovery coefficient for constant brightness closed-loop constraints; for continuous video streams, introducing prior values ​​of spatial smoothness and temporal continuity to construct a spatiotemporal joint optimization objective function and obtaining the optimal solution; finally, using a local weight mask in the HSV space to guide the smooth fusion of the original signal and the mapped signal. This invention effectively eliminates spatial boundary artifacts and video temporal flicker, enhancing the distinguishability of confused colors while maintaining the color naturalness and brightness constancy of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and image processing technology, specifically to a method for correcting color vision abnormalities based on color transformation. Background Technology

[0002] Color vision deficiency is a common visual impairment, mainly caused by abnormalities or absence of cone cells. P-type and D-type color vision deficiency, due to the loss of a* axis information, make it difficult to distinguish confusing colors such as red and green, causing numerous inconveniences in daily life and career development. Existing corrective technologies include gene therapy, optical correction, and image processing correction, among which image processing technology has become the mainstream approach due to its low cost and wide applicability.

[0003] However, existing image processing correction methods have significant shortcomings: some methods use global hue adjustment, resulting in loss of image naturalness; some methods are only suitable for simple scenes, and their correction effect on complex natural images is poor; and some methods struggle to balance the differentiation of confused colors with the color fidelity of the original image, failing to simultaneously meet the visual needs of individuals with color vision disorders and those with normal trichromatic vision. Therefore, there is an urgent need for a color vision disorder correction method that balances correction effectiveness and naturalness and is applicable to complex scenes. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a color vision anomaly correction method based on color transformation. This method solves the problems of existing color vision anomaly correction methods, which struggle to balance enhancing the differentiation of locally confused colors and maintaining the naturalness of global image colors when compensating for color in images. In continuous video stream processing, these methods are prone to spatial boundary artifacts and temporal color flicker, and they are also prone to hue shift and local exposure distortion when dealing with complex lighting scenes.

[0005] To address the above problems, the present invention provides the following technical solution: The present invention provides a method for correcting color vision abnormalities based on color transformation, comprising the following processing steps: The acquired input image is linearized and preprocessed and converted to the CIE Lab color space. At the same time, a color vision anomaly simulation image is generated using a red-green vision anomaly simulation model based on the LMS space. In the a*-b chromaticity plane, the color difference vector between pixels is calculated. A reference vector parallel to the a-axis is introduced and the included angle is calculated. The final confusion degree of each pixel is calculated by combining nonlinear distance weight and local spatial neighborhood aggregation. Using the confusion degree as a weighting factor, a confusion weighted histogram and cumulative distribution function are constructed for the discrete pixel values ​​of the target color channel to generate the target mapping curve. Extract the normalized color components of the source image in the RGB color space, calculate the relative chromaticity difference quotient of each pixel based on the absolute difference and intensity sum of the red and green antagonistic channels and the background suppression weight of the blue channel, combine global statistical features to solve the dynamic confusion judgment threshold to generate an initial soft mask, and obtain the smoothing mask weight through two-dimensional spatial smoothing filtering. The relative brightness benchmark of the original pixels is extracted, a hue constraint feature based on the energy ratio relationship between RGB channels is constructed and a dynamic hue loss compensation term is generated. Based on this compensation term, differential compensation is performed on the red and green channels. A constant brightness closed-loop constraint is performed by calculating the energy recovery coefficient. A spatiotemporal joint optimization objective function containing data fidelity, spatial smoothness and temporal continuity is constructed. The closed-form optimal solution is obtained by the analytical method of differentiation. Image data is converted to the HSV color space to extract hue features. The angular distance between the hue and the target hue center is calculated to generate a local weight mask. After morphological smoothing, the local weight mask is used to guide the original input signal and the mapped signal to perform pixel-level local tone interpolation and fusion. The output display driving color value is then achieved through a compensated linear quantization model.

[0006] The processing of the input image specifically includes: performing gamma correction on the R, G, and B pixel values ​​of the input image to achieve data linearization, normalizing the pixel values, and obtaining CIE XYZ color space data through a transformation matrix; using a nonlinear transformation function to transform the CIE XYZ color space data to the CIE Lab color space, obtaining the L channel pixel values ​​representing physical brightness and the a and b channel pixel values ​​of the chromaticity components; transforming the linear image data to the LMS color space, using a transformation matrix to simulate the visual response characteristics of color vision abnormalities to generate corresponding response values, performing confusion line projection processing on the color components in the LMS space to obtain restricted visual response data and performing boundary check clamping; inversely mapping the restricted visual response data back to the CIE Lab color space, restoring the tristimulus values ​​of the CIE XYZ color space by inverting the general LMS forward transformation matrix, and then nonlinearly mapping them to the CIE Lab color space to output a color vision abnormality simulation image.

[0007] The process of generating the target mapping curve includes: traversing the image pixel matrix, extracting the pixel values ​​in the target color channel, accumulating the associated final confusion level to the corresponding discretized frequency range to build a confusion weighted histogram; performing discrete integration on the histogram to obtain the cumulative distribution function; generating an adaptive target mapping curve through extreme value linear normalization calculation, and constraining the mapping output value within the physical dynamic range through hard truncation processing.

[0008] The specific process of channel reconstruction and brightness constraint includes: calculating the relative brightness reference value by fusing normalized color components according to the color space conversion standard; establishing the hue constraint feature value by calculating the intensity ratio of the blue channel and the red-green antagonistic channel; constructing a negative feedback function by combining the smoothing mask weight, the hue constraint feature value, and the global compensation intensity coefficient to solve the hue loss compensation term; extracting the difference between the original red and green channels, and performing differential compensation on the red and green channels by combining the hue loss compensation term and the gain control coefficient to obtain the initial remapped channel color value; calculating the relative brightness value in the current reconstruction state according to the color space conversion standard; calculating the quotient of the relative brightness reference value and the current reconstructed relative brightness value to solve the energy recovery coefficient, applying the energy recovery coefficient synchronously to the remapped channel and truncating and limiting it, and outputting the normalized output color value.

[0009] The local hue interpolation fusion and output process includes: converting the optimal output color value to the HSV color space, extracting the hue components and calculating the minimum angular distance to the target hue center; solving the initial weight mask using the Gaussian decay function; generating a filter based on the two-dimensional Gaussian distribution law and performing spatial low-pass filtering on the initial weight mask to obtain a smooth weight mask; using a weight-based linear interpolation model, the smooth weight mask guides the input signal and the nonlinearly transformed target mapping signal to perform a smooth transition fusion to obtain the local modulated color value; and mapping the local modulated color value to the hardware quantization bit depth space through a linear quantization model including a rounding compensation factor to obtain the digital drive level value.

[0010] This invention achieves compensation and reconstruction of images with color vision abnormalities through multidimensional feature correlation calculation and physical energy control. It utilizes an isolation judgment mechanism combining spatial smoothing filter masks and relative chromaticity difference quotients to effectively extract locally confused regions and output intervention weights with smooth transition characteristics, avoiding color abruptness and discontinuity phenomena caused by traditional hard threshold segmentation. This invention establishes an energy closed-loop constraint model based on a luminance benchmark. While performing differential compensation on the red-green antagonistic channels to expand color contrast, it uses energy recovery coefficients to synchronously scale and restore all channels. This mechanism ensures that local reconstruction does not deviate from the initial ambient illumination relationship, maintains the constancy of the image background color, and reduces the risk of color cast.

[0011] Furthermore, considering the characteristics of dynamic video streams, this invention converts historical frame buffer data and the local topological mean of the current pixel into static prior features, constructs a variable-free spatiotemporal joint optimization objective function, and directly obtains the optimal solution through analytical methods. This model balances hardware computational efficiency and maintains the visual continuity of moving targets at the time axis level, preventing flicker artifacts in smooth transition areas and edges of the image. Finally, it utilizes Gaussian distance as a metric to extract the target color channel in the color space and implement tone mapping fusion, achieving a balance between improving color recognition and maintaining image naturalness.

[0012] This invention provides a method for correcting color vision deficiencies based on color transformation. It has the following beneficial effects: 1. This invention constructs an isolation judgment mechanism with smooth transition characteristics by combining relative chromaticity difference quotient and spatial smoothing filter mask. This mechanism can effectively extract local color confusion regions and use local weight mask to guide pixel-level interpolation fusion between the original input signal and the target mapping signal. Compared with traditional hard thresholding segmentation methods, this invention avoids color abruptness and spatial boundary discontinuity after image processing, enhancing the distinguishability of locally confused colors while maintaining the natural transition of global image colors.

[0013] 2. This invention introduces an energy closed-loop constraint model based on a brightness benchmark. After extracting the hue compensation term and performing differential compensation on the red-green antagonistic channels to enhance color contrast, the system calculates the energy recovery coefficient and uses this coefficient to synchronously scale and restore the color values ​​of all channels. This feature ensures that local color reconstruction does not deviate from the initial ambient illumination relationship, solving the problems of hue shift and local exposure distortion that are easily caused by existing methods when dealing with complex lighting scenes.

[0014] 3. This invention constructs a spatiotemporal joint optimization objective function for continuous video stream processing. By extracting the mean of the local neighborhood of the current pixel as a spatial smoothing prior value, and combining it with the output result of the same position in the previous video frame as a temporal continuity prior value, the optimal solution is directly obtained using the analytical derivative method. This design not only reduces the complexity of hardware computation, but also maintains the temporal continuity of color between frames, effectively eliminating color flicker and stroboscopic artifacts that are prone to occur in smooth transition areas and edges of dynamic video streams. Attached Figure Description

[0015] Figure 1 This is a flowchart of the present invention; Figure 2 This is the confusion-weighted histogram of the present invention; Figure 3 This is a schematic diagram of the target mapping curve of the present invention; Figure 4 The figure shows the comparison test results between the present invention and the traditional global compensation method. Detailed Implementation

[0016] The technical solutions in 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 embodiments of the present invention, and not all embodiments. 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.

[0017] See attached document Figure 1This invention provides a method for correcting color vision deficiency based on color transformation, comprising the following steps: S1. The acquired input image is linearized and preprocessed and converted to the CIE Lab color space with perceptual uniformity. At the same time, a color vision abnormality simulation image is generated using the red-green vision abnormality simulation model based on LMS space, which serves as a reference benchmark for subsequent quantification of the degree of confusion. S2, in The chromaticity plane calculates the color difference vector between pixels, introducing a parallel plane. The reference vector of the axis is calculated and the included angle is calculated. The final confusion degree of each pixel is calculated by combining nonlinear distance weight and local spatial neighborhood aggregation. The confusion degree is used as a weight factor to construct a confusion weighted histogram and cumulative distribution function for the discrete pixel values ​​of the target color channel, and generate the target mapping curve. S3. Extract the normalized color components of the source image in the RGB color space. Based on the absolute difference and intensity sum of the red and green antagonistic channels and the background suppression weight of the blue channel, calculate the relative color difference quotient (RCDQ) of each pixel. Combine global statistical features to solve the dynamic confusion judgment threshold to generate the initial soft mask. And obtain the smoothing mask weight through two-dimensional spatial smoothing filtering. S4. Extract the relative brightness benchmark of the original pixels, construct the hue constraint feature based on the energy ratio relationship between RGB channels and generate a dynamic hue loss compensation term; perform differential compensation on the red and green channels based on the compensation term, perform constant brightness closed-loop constraint by calculating the energy recovery coefficient, and then construct a spatiotemporal joint optimization objective function that includes data fidelity, spatial smoothness and temporal continuity, and directly obtain the closed-form optimal solution by the analytical method of differentiation. S5 converts the image data to the HSV color space to extract hue features, calculates the angular distance between the hue and the target hue center to generate a local weight mask, and after morphological smoothing, uses the mask to guide the original input signal and the mapping signal based on nonlinear Gamma transformation to perform pixel-level local tone interpolation fusion. Finally, the final display-driven color value is output through a compensated linear quantization model.

[0018] The above processing steps reconstruct the color distribution of an image through color space mapping, obfuscation feature quantization, region mask generation, and objective function optimization. This invention, through multi-dimensional parameter correlation analysis, enhances the distinguishability of obfuscated colors while maintaining the naturalness of image colors.

[0019] In the above method flow, the specific implementation process of image preprocessing, color space conversion, and color vision anomaly visual simulation in step S1 includes the following sub-steps: S101, the acquired input image is preprocessed, converting it from the RGB color space to the CIE XYZ color space. Since image data from conventional display devices often exhibits non-linear physical characteristics, to ensure that subsequent color calculations accurately reflect the linear superposition of light energy, gamma correction is applied to the R, G, and B pixel values ​​of the input image to achieve data linearization. The processed pixel values ​​are then normalized to the [0,1] value range to avoid numerical overflow in subsequent matrix operations. This gamma correction can be implemented using standard image algorithms known in the art. Subsequently, the gamma-corrected linear RGB data is linearly transformed using a conventional color conversion matrix to obtain CIE XYZ color space data. Preferably, this conversion matrix is ​​constructed based on the reference parameters of a standard test light source (e.g., a D65 light source), aiming to provide a unified objective reference system for color mapping from different viewing angles.

[0020] S102 converts the data from the CIE XYZ color space to the CIE Lab color space, which has perceived uniformity. Since the CIE XYZ space cannot directly reflect human color difference perception, a non-linear transformation function is used for mapping. The Euclidean distance between two points in the CIE Lab space is linearly positively correlated with the subjectively perceived color difference, providing an accurate measurement basis for subsequent color difference analysis. During the mapping process, the algorithm introduces the white point coordinates of the reference light source as the divisor denominator. To ensure logical completeness, when the input XYZ data approaches absolute black (i.e., coordinates are close to 0), the non-linear transformation function effectively avoids division anomalies caused by a denominator of 0 by setting a truncation threshold or employing a piecewise linear mapping mechanism. The specific conversion formula can be implemented using known technologies such as the International Commission on Illumination (ICI) standards and specifications.

[0021] Through nonlinear mapping, the physical brightness of the input image in the CIE Lab space is obtained. Channel pixel values, and orthogonally distributed chromaticity components. and The channel pixel values ​​constitute a three-dimensional color description vector.

[0022] S103, a simulation image is generated using a red-green color vision deficiency simulation model based on the LMS color space. To quantify the visual perception state of individuals with color vision deficiency, the linear image data from step S101 is converted to the LMS color space, which reflects the response of cone cells in the human eye. , , These correspond to the original response values ​​of cone cells in long-wave, medium-wave, and short-wavelength fields, respectively. Within the LMS space, a specific transformation matrix is ​​used to simulate the visual response characteristics of red-green color vision abnormalities, providing a reference for the subsequent construction of confusion histograms.

[0023] For long waves ( For P-type color vision deficiency (i.e., red-blindness or red-weakness) caused by the absence or abnormal response of cone cells, this embodiment uses the following transformation matrix to generate its simulated image data: ; in, , , These represent the corresponding response values ​​under the simulated visual state of type P color vision deficiency after transformation. The coefficients in the first row of this transformation matrix forcibly take over the original values. Channel response, reconstruct it as Channel and The linear combination of channels is used to accurately replicate the visual information loss state of individuals with P-type anomalies at the mathematical level.

[0024] For type D color vision deficiency, also known as green blindness or green weakness, the physiological characteristics are the absence or weakening of mid-wavelength cone cells. Correspondingly, the following transformation matrix is ​​used to generate simulated image data for type D color vision deficiency: ; Similarly, this matrix is ​​correlated Channel and Reconstructing from channel data The value was removed, eliminating the green feature dimension from the original image. The visual data generated by the above simulation model is used to intuitively and quantitatively reflect the color feature information lost by individuals with color vision deficiencies, establishing specific compensation boundaries and objective function basis for guiding subsequent steps of hue compensation and brightness adjustment.

[0025] Based on the acquired raw response data of the LMS space, the system performs dimensionality reduction projection to establish a visual perception model for individuals with color vision deficiencies, as detailed below: S104 performs obfuscated line projection processing on the color components in the LMS space to obtain restricted visual response data. The transformation matrix from S103 is then used to transform the pixels... , , The components are weighted. This operation simulates the loss of specific cone cell signals and is an irreversible dimensionality reduction operation in linear space. The projected response value may deviate from the normal image coding range. To ensure numerical stability, the system introduces a boundary constraint mechanism to adjust the calculated response value. , , Boundary checks are performed to force the values ​​to be clamped within the normalized interval [0,1]. If matrix multiplication and addition produce tiny negative values ​​due to floating-point precision deviations, they are directly set to 0 to ensure that the generated sensing data strictly conforms to the physical addressing characteristics of the optical display device.

[0026] S105, the simulated visual response data is inversely mapped back to the CIE Lab space to construct a reference image for color vision anomaly perception. After establishing the constrained LMS response, it needs to be converted back to a physical color space with perceptual uniformity to establish a unified quantization contrast dimension with the original image. This conversion process relies on the inverse transformation calculation from LMS space to CIE XYZ space, as shown in the following formula: ; In the formula, , , Represents the virtual tristimulus values ​​under simulated visual conditions; This represents the standard inverse transform matrix, which is pre-obtained by inverting the general LMS forward transform matrix. After restoring the tristimulus values ​​using this formula, the data is further nonlinearly mapped to the CIE Lab color space using reference white point parameters that are completely consistent with those in the original input image processing stage. Considering that this nonlinear mapping formula includes a division term with the reference white point value as the denominator, to prevent numerical singularities caused when the input image is in an extremely low brightness region, a zero-prevention constant is added to the denominator in this embodiment. The constant The value range is set to 10. -8 Up to 10 -6 This avoids program errors without affecting color accuracy. The final calculated output is the simulated luminance component. With simulated chromaticity components and .

[0027] S106 integrates the converted channel data and outputs a color vision deficiency simulation image as a reference for subsequent correction. Through spatial inverse mapping, the system generates a simulation image whose spatial resolution is perfectly aligned with the original input image, objectively reflecting the limited perceptual state of a specific color vision deficiency individual in the current scene. The luminance and chromaticity channel data of this simulation image do not directly replace the original image, but rather serve as a reference for subsequent quantification of color confusion and construction of the objective function. By maintaining the data correspondence between the original and simulation images within a unified CIE Lab color space, the algorithm can clearly define the hue compensation boundary, thus providing the necessary prior conditions for subsequent calculation of the inter-pixel difference vector.

[0028] See attached document Figure 2 and attached Figure 3 CIE Color space The chromaticity plane directly maps the physiological response of human vision to the antagonistic red-green and yellow-blue channels. To quantify the relative color relationships between spatially adjacent pixels, the system extracts the color values ​​of image pixels in... The color features of the plane are analyzed, and the color difference vector between any two pixels is calculated. The specific implementation steps are as follows: S201, Extract image pixels in CIE The system calculates the numerical difference between pixel pairs across different chromaticity channels, based on the chromaticity components of the color space. Since the color distribution of adjacent pixels typically exhibits physical continuity, the system extracts information about abrupt changes in these continuous variations from each pixel. and Channel pixel value. For any two given pixels in the image. and Calculate the difference between the two chroma channels respectively. For those with The input image contains 10 pixels. By traversing the entire image or selecting pixel pairs within a defined local neighborhood window, the color gradient distribution within a spatial range is obtained. The formula for calculating the channel difference is as follows: ; ; In the formula, and These represent any two distinct pixels in the input image, and their corresponding coordinates in the image's two-dimensional coordinate system. and ; and Representing pixels With pixels of Channel pixel values; and Representing pixels With pixels of Channel pixel values; This represents the projection difference between two pixels along the red and green axes; This represents the projection difference between two pixels along the yellow and blue axes. This physical difference quantifies the absolute offset between pixels along the orthogonal chromaticity axes, providing the basic computational dimension for subsequently constructing a two-dimensional color difference vector with directional characteristics.

[0029] S202, a two-dimensional color difference vector is constructed based on the aforementioned channel differences, and the magnitude of this vector is calculated. After obtaining the component differences of each pixel pair on the chromaticity plane, these two difference data are combined to form a directional metric. This metric not only includes the absolute magnitude of color change but also reflects the evolution trend of color in the color spectrum. The system uses pixels... Starting point, pixel A color difference vector is constructed for the endpoint, and the magnitude of this vector is calculated using the Euclidean distance formula. This magnitude physically represents the objective color difference between two pixels under normal visual perception, and its specific calculation formula is as follows: ; In the formula, Represents pixels With pixels The resulting color difference vector; This represents the magnitude of the color difference vector. As a preferred method, when determining the magnitude... When the noise level is less than the preset noise threshold, the system combines the spatial distance between the two pixels with the brightness channel. The difference rate is evaluated using a multi-dimensional joint approach. Here, spatial distance is defined as pixels. With pixels Geometric Euclidean distance between If the spatial Euclidean distance between the pixel pairs is... Greater than the set local neighborhood radius And its brightness component and If the relative difference rate is less than 5%, the system marks the pixel pair as a visually identical color region. In this embodiment, the aforementioned noise floor threshold is typically set to a range of 0.5 to 1.5, primarily used to filter random background noise generated during image sensor acquisition; local neighborhood radius The value range is set to a span of 3 to 5 pixels, which is determined based on the basic bandwidth of the texture of a normal natural image. Through the above multi-dimensional joint determination, meaningless subsequent calculations can be avoided for pixels with extremely small color differences or similar pixels at a great distance.

[0030] S203, introducing parallel to Using the unit vector of the axis as a reference vector, the angle between the color difference vector and the reference vector is calculated. To determine whether the objective color difference between two pixels falls within the confusion region of color vision deficiencies, given that the confusion line for red-green color vision deficiencies is in the CIE... spatial It exhibits a specific aggregation orientation on the plane, and is mainly approximately parallel to... Axis distribution, in this embodiment, is based on this. A unit reference vector is established in the plane, aligning its direction with the statistical direction of the standard obfuscation line. Then, vector operations are used to calculate the angle between the color difference vector and this reference vector. The magnitude of this angle directly reflects the degree to which the current pixel deviates from the typical obfuscation direction in terms of color gradient. The specific calculation logic is as follows: ; ; In the formula, Indicates the set unit reference vector; This indicates that the reference vector is relative to The angle of the positive half-axis of the axis. To make the reference vector parallel to... The axis is used to accurately fit the red-green visual deficit feature; in this embodiment, the angle is... Set as At this point, the reference vector simplifies to the coordinate representation (1,0). Represents the color difference vector With reference unit vector The spatial angle between them. In practical engineering calculations, considering the singularity of the denominator being zero in division operations, when the vector magnitude is... When the angle approaches 0, the system no longer executes the angle calculation logic, but directly assigns the angle value to a preset constant to indicate that there is no actual color confusion trend in that spatial direction. This zero-truncation mechanism ensures the numerical robustness of program execution and avoids system malfunctions caused by dividing extremely small noise by extremely small modulus.

[0031] After obtaining the color difference vector and its angle with the reference vector, the system models the confusion weights of local neighboring pixels based on colorimetric principles to quantify the degree of visual confusion caused by the lack of red-green perception. The specific steps are as follows: S204, construct a nonlinear weighting function based on the magnitude of the color difference vector. Based on the nonlinear characteristics of human eye color difference perception: when two pixels are in CIE... When the Euclidean color difference in the color space is too small, it is considered imperceptible background noise; when the color difference is too large, even if the evolution direction is close to the confusion line, people with color vision deficiencies can still effectively distinguish them based on lightness or residual chromaticity. Based on this perceptual principle, this embodiment uses a distance decay model based on a Gaussian distribution to construct a nonlinear weighting function, aiming to assign higher confusion weights to pixel pairs in the medium color difference range. The calculation logic of this function is as follows: ; In the formula, Represents pixels With pixels Color difference vector magnitude The calculated distance weight values; This represents the expected confusion center value for color difference; This represents the standard deviation of the color difference, which controls the width of the color difference weight attenuation. In this embodiment, it is based on the NBS (National Bureau of Standards) color difference evaluation standard. The value range is set to 10.0 to 15.0, which represents the significant color difference frequency band that people with color vision deficiencies are prone to having difficulty recognizing in everyday scenes; The value range is set to 5.0 to 8.0 to smoothly control the decaying gradient of the weight function. By introducing the above nonlinear mapping, the algorithm mathematically suppresses the interference of excessively large or small color differences on the confusing quantization model.

[0032] S205, calculate the local confusion of a single pixel pair by combining the spatial angle and the distance weight value. After determining the distance weight value, the system introduces the spatial angle obtained in step S203 to solve for the local confusion between single pixel pairs. From a physical geometry perspective, the smaller the angle between the color difference vector and the reference unit vector, the closer the local color gradient direction is to the physiological confusion line. Therefore, this embodiment uses a cosine projection function to multiply the direction offset by the distance weight value. The formula for calculating the local confusion is as follows: ; In the formula, Represents pixels With pixels Local confusion between them; Represents the color difference vector With reference unit vector The spatial angle between them; The absolute cosine value of the spatial angle was extracted. When the color difference vector is completely parallel to the confusion line, the absolute cosine value reaches a maximum of 1, and the local confusion is entirely determined by the distance weight value; when the two are orthogonal, the absolute cosine value is 0, indicating that the color change in that direction does not trigger the corresponding visual confusion. This mathematical model transforms the geometric angle features into scalar multipliers by introducing trigonometric function mapping, making the confusion quantification process physically directional selective.

[0033] S206 aggregates and normalizes the confusion levels within the local spatial neighborhood to obtain the final confusion level of the central pixel. Considering that the visual system's color perception is influenced by the combined effects of local spatial frequencies, relying solely on isolated pixels to evaluate extreme values ​​can easily lead to inaccurate region identification. Therefore, the system uses pixels... Centered on a central pixel, the local confusion values ​​of adjacent pixels are aggregated within a predefined two-dimensional spatial neighborhood window to calculate the final confusion level of the central pixel. The formula for calculating the final confusion level is as follows: ; In the formula, Represents the pixels in the input image The final level of confusion; Represented in pixels The set of local two-dimensional spatial neighborhoods centered on the image. As a preferred approach, the size of this neighborhood window is set to 5×5 or 7×7 pixels to cover the local texture primitives of a regular natural image. Indicates spatial distance weight; The normalization coefficient is equal to the set of local two-dimensional spatial neighborhoods. All spatial distance weights The sum of .

[0034] Furthermore, to ensure spatial smoothness, the aforementioned spatial distance weights... Calculated using the Gaussian decay function: ; in, This is a spatial scale constant. To ensure the weight distribution matches the defined neighborhood window, Typically, this value is taken as one-third of the physical radius of the neighborhood window. Furthermore, to avoid singularity issues caused by the denominator approaching zero during calculations of locally smoothed regions of the same color, a zero constant is used. Set to 10 -6 The aforementioned neighborhood aggregation mechanism integrates color difference distribution and image spatial topological features, avoiding engineering errors from single-dimensional evaluation and providing a reliable multi-dimensional data foundation for subsequent construction of confusion histograms.

[0035] After quantifying the pixel confusion level within the local spatial neighborhood, it needs to be transformed into a global color compensation strategy for the image. Conventional histogram equalization only stretches pixels based on objective pixel frequencies. To establish an adaptive compensation mechanism for individuals with color vision deficiencies, this embodiment constructs a confusion-weighted histogram, using the final pixel confusion level as a frequency statistical weighting factor, so that the dynamic range allocation adaptively tilts towards highly confused color regions. The specific implementation steps are as follows: S207, Construct a confusion-weighted histogram for the target color channel. A discretized statistical mapping relationship needs to be established first for the feature distribution of the target color channel. In the discretized digital image coding space, color components are expressed using specific local depth quantization intervals. The system traverses the pixel matrix of the entire image, extracts the pixel values ​​within the target color channel, and accumulates the final confusion level associated with that pixel into the frequency interval to which that value belongs. The statistical calculation formula is as follows: ; In the formula, Indicates the target color channel at the quantization level The obfuscation weights are statistically frequent at the location; This represents the total number of pixels in the two-dimensional space of the input image; Represents pixels The final level of confusion; Represents pixels Discrete pixel values ​​within the target color channel; The Kronecker delta is defined if and only if the discrete pixel values Equal to the current quantization level The function takes a value of 1 when the condition is met, and 0 otherwise.

[0036] In CIE In color space, and The raw physical values ​​of a channel often contain negative numbers (such as the common range of [-128, 127]). To adapt to hardware array indexing and the conventional 8-bit color depth physical standard, this embodiment performs a uniform linear offset (e.g., adding 128) on the raw chromaticity values ​​before frequency statistics, shifting and fixing the quantization level v to the non-negative integer range [0, 255]. This statistical model intuitively reflects the contribution of a specific color frequency band to the overall visual confusion characteristics.

[0037] S208, calculate the cumulative distribution function of the confusion-weighted histogram. To transform local probability density data into a continuous and monotonically increasing mapping, the system performs a discrete integration operation on the histogram. The cumulative distribution function represents the total cumulative confusion weights for color values ​​less than or equal to a certain quantization level: for any given quantization level... The corresponding cumulative confusion frequency Defined as from the initial quantization level 0 to the current quantization level All Discrete Confusion Weight Statistical Frequency The arithmetic sum ( (This refers to the discrete independent variable that iterates through the interval). After this discrete accumulation operation, the color interval with high confusion weight exhibits a steep slope on the cumulative distribution curve. This geometric change directly indicates the color compensation area that needs to be allocated more heavily for dynamic rendering in the subsequent process.

[0038] S209 transforms the cumulative distribution function into a target mapping curve for color compensation. After establishing the global cumulative characteristics, they need to be practically applied to the numerical adjustment of local pixels. At this point, the system maps the calculated cumulative confusion frequency to the physical dynamic range of the target color channel. Specifically, the system performs linear normalization calculation based on extrema to generate the final adaptive mapping curve, the calculation formula of which is as follows: ; In the formula, Indicates the input value being quantized The target mapping output value obtained by solving; and These represent the maximum and minimum dynamic boundary values ​​that the target color channel is allowed to be rendered on the physical device, which are set to 255 and 0 respectively in this embodiment; and Let each represent the cumulative distribution function of the current input image. The global maximum and minimum values. Considering the large areas of a single background color in the original image, the range of the cumulative distribution function... The result will approach 0, at which point performing division will trigger a division-by-zero exception in the hardware arithmetic unit. To ensure the algorithm's numerical robustness under extreme conditions, this embodiment introduces a zero-prevention constant in the normalized denominator. To ensure consistent arithmetic precision across contexts, this zero-prevention constant... Consistent with the minimum value setting in spatial neighborhood aggregation calculation, its value is fixed at 10. -6 .

[0039] Based on this, to prevent the introduction of a zero constant Or, a deviation in floating-point arithmetic might cause the target mapping output value to go out of bounds, and the system will then recalculate the calculated value. Execute multi-dimensional hard truncation decision logic. Specifically, when a decision is made... At that time, a mandatory order When judged At that time, a mandatory order .

[0040] The above formula outputs Essentially, this constitutes the stretching operator in the hue remapping process. Its technical purpose is to project the nonlinear characteristics of the cumulative distribution curve onto the physical color space through normalization, thereby forcibly widening the absolute difference in color gradients that cause confusion for individuals with color vision deficiencies. To ensure that this global quantization feature can accurately guide local color reconstruction, the system will extract the target mapping curve. The sequence is used as a global mapping reference and input into the mask-driven local tone modulation module in subsequent step S5 to construct or replace local nonlinear mapping operators. For the underlying floating-point approximation rounding operation, those skilled in the art can implement it using conventional digital signal processing instruction sets; its basic arithmetic logic is well-known in the field and will not be elaborated upon here.

[0041] After obtaining the global color compensation mapping relationship, to achieve accurate local pixel-level correction, it is necessary to further extract the antagonistic features between color components within a single pixel. By introducing the Relative Chromaticity Difference Quotient (RCDQ) model, the physical sensitivity of the current pixel in triggering red-green visual confusion is quantified in multiple dimensions. This local evaluation mechanism effectively compensates for the deficiency that relying solely on global statistical features can easily lead to local correction distortion. The specific steps are as follows: S301, linear normalization is performed on the color components of the source image. Since the original channel intensity values ​​of a digital image are limited by a specific hardware bit depth (such as 8-bit or 16-bit integers), these discrete absolute values ​​with physical dimensions are difficult to directly compare the relative weights between color components. To eliminate dimensional differences, this embodiment maps the values ​​of each pixel in its independent channel to a continuous floating-point closed interval. The specific calculation formula is as follows: ; In the formula, Represents pixels In color channels Normalized output values; Representing a specific color channel, in this embodiment, it specifically refers to the three independent color channels of the digital image: red (R), green (G), and blue (B). This indicates that the pixel is in the color channel. The original channel strength value; and These represent the current source image in the color channels. The global maximum and minimum statistical extreme values ​​within the range. To ensure the rigor of the computational logic and prevent hardware division-by-zero errors in extreme cases where the image is completely flat and monochrome (i.e., the maximum value equals the minimum value within a specific channel), a zero-prevention constant is introduced in the denominator. To ensure consistent arithmetic precision across contexts, this zero-prevention constant... The value is fixed at 10. -6 After this processing step, all the original color components of the image are uniformly constrained to the [0,1] interval, thus establishing a standardized data benchmark for subsequent relative proportion analysis.

[0042] S302, extract the target color components to establish the absolute difference and sum of intensity of the antagonistic channels. According to color antagonism theory, the core deficiency of red-green visual aberration lies in the lack of effective recognition of visual stimuli along the red-green antagonistic axis. To characterize this phenomenon, the system extracts the normalized red and green components and calculates their absolute difference and sum of intensity. For a specific pixel... Normalize its red channel output value Normalized output value of green channel The absolute value of the difference between the two is defined as the absolute difference between the red and green antagonistic channels of that pixel. Simultaneously, the normalized output values ​​of the two channels are arithmetically summed, defined as the sum of the red-green antagonistic channel strengths. Absolute difference This reflects the degree of relative purity separation of red and green colors within a pixel; while the total intensity... This represents the combined brightness stimulation level on the retina after the two color components are superimposed.

[0043] S303, a relative chromaticity difference quotient calculation model is constructed by fusing difference values ​​and multi-channel features. After obtaining the absolute antagonistic features within a single pixel, using only isolated differences for visual confusion judgment can easily lead to biased evaluation errors in complex background areas. To improve the multi-dimensional joint judgment capability, the system combines the absolute difference values ​​and intensity sums of antagonistic channels with background information from auxiliary channels to construct a ratio-based judgment index, thereby calculating the relative chromaticity difference quotient of each pixel. Its mathematical model is as follows: ; In the formula, Represents pixels The final calculated Relative Color Difference Quotient (RCDQ) is strictly constrained to the range of [0,1]. and These are the intermediate feature variables obtained from the preceding steps; To prevent the constant from becoming zero, it is set to 10. -6 This measure aims to ensure the continuity of division operations in scenes with all-black pixels (i.e., where both red and green components are close to 0).

[0044] Preferably, the model introduces a background brightness suppression weight to the right of the quotient. Specifically defined as ,in This is the normalized output value for the blue channel. The physical basis for this is that when the blue component dominates (such as in the short-wavelength regions of a pure blue sky or the deep sea), individuals with red-green color vision deficiencies rarely experience perceptual confusion. By superimposing a linearly inversely proportional attenuation factor on this blue component, the algorithm can accurately filter out safe background colors that do not require correction.

[0045] Under this logic, the output RCDQ index is a dimensionless scalar with physical direction selectivity. The closer the RCDQ value is to 1, the greater the difference between red and green components after filtering out the blue background (i.e., high-purity red or green), which is precisely the highly sensitive area where red-green anomalies are easily confused. Conversely, the lower the value, the closer the red and green components are (e.g., neutral colors like yellow or gray), belonging to a safe visual perception zone. This quantization index provides accurate data support for the subsequent generation of adaptive correction masks. The underlying operation of splitting the image into independent color channel matrices can be directly obtained by calling the data pointers of standard image processing libraries, which is a well-known technique in the field and will not be elaborated upon here.

[0046] After calculating the Relative Chromaticity Difference Quotient (RCDQ) of each pixel, the system constructs a numerical matrix characterizing the global confusion sensitivity of the image. However, relying solely on this continuous quantization index cannot directly generate local control signals suitable for physical display devices. To establish a reliable mapping from quantization features to rendering instructions, this embodiment introduces an adaptive dynamic decision-making and mask smoothing mechanism. The core purpose of this mechanism is to dynamically strip the target pixels that need compensation based on the local statistical content of the image, and ensure that the visual boundaries of the compensation area present a natural transition, thereby avoiding color banding caused by hard segmentation. The specific implementation steps are as follows: S304, Calculates a dynamic confusion threshold based on global statistical features. In conventional image processing logic, if a fixed hard threshold is used to determine sensitive pixels, distortion problems such as missed detection or overcorrection often occur when encountering variable conditions such as low saturation or high contrast. To overcome this deficiency, this embodiment constructs an adaptive judgment threshold based on the statistical principle of normal distribution by extracting the global mean and standard deviation. The calculation formula is as follows: ; In the formula, This represents the dynamic obfuscation threshold for the current input image; It represents the global arithmetic mean of the relative chromaticity difference quotients of all pixels in the entire image, and characterizes the overall red-green antagonism baseline level of the current image; This represents the global standard deviation of the relative chromaticity difference quotient matrix, reflecting the degree of dispersion of color differences between pixels; This is the sensitivity adjustment coefficient. In this embodiment, this sensitivity adjustment coefficient... The value range is set to [0.5, 1.5], and its specific value is determined based on the empirical benchmark of color difference perception tolerance (JND) of the human visual system. The purpose of introducing the standard deviation as a dynamic compensation term is to enable the judgment threshold to adaptively float with the fluctuation of color differences within the image, thereby accurately isolating pixels that exhibit significant red-green antagonism anomalies.

[0047] Considering extreme operating conditions (e.g., inputting a panoramic view in a safe neutral color), at this time... and All values ​​approach 0, and without intervention, this will lead to... This can lead to failure and amplify underlying computational noise. Therefore, this embodiment adds a hard truncation lower limit protection after dynamic threshold calculation. Specifically, a lower limit protection threshold is set. When judged At that time, a mandatory order As a preferred method, It is set to 0.15 to ensure the physical silence of the algorithm against a clean background.

[0048] S305, Construct an initial soft mask matrix based on a logistic function. After obtaining the dynamic threshold, the system faces the technical challenge of generating smooth transition weights. Conventional binarization segmentation methods produce a step-like hard boundary at the junction of the compensating region and the safe background. This physical discontinuity manifests as severe color artifacts on the display terminal. Based on the progressive response characteristics of biological vision, this embodiment constructs an initial soft mask matrix based on a logistic function. By introducing a Sigmoid nonlinear mapping, the system transforms the relative difference into continuous probability weights between 0 and 1. The calculation logic is as follows: ; In the formula, Represents pixels The initial soft mask weights generated at that location; This is the relative chromaticity difference quotient corresponding to that pixel. The dynamic confusion determination threshold obtained in step S304; This is a gain control parameter used to adjust the steepness of the curve at the threshold boundary. As a preferred method, The value is set to 10. This model implements a flexible selection mechanism at the physical level: when the relative chromaticity difference quotient of pixels is much greater than the judgment threshold, the initial soft mask weight gradually approaches 1, indicating that the region needs to be given full color compensation; when the difference fluctuates around the threshold, the output has a moderate weight with gradient; when it is much lower than the threshold, the weight converges to 0, keeping the original image color undisturbed.

[0049] To ensure the numerical stability of the underlying hardware when performing exponential operations and to prevent floating-point overflow, this embodiment performs a step-by-step analysis on the input difference variable before substituting it into the logic function. A bidirectional absolute clamping operation was performed. Specifically, clamping boundary parameters were set. When the difference is greater than Cut it into Less than Time cutoff Considering that the output of the Sigmoid function is highly saturated when the absolute value of the independent variable is greater than 10, this embodiment clamps the boundary parameter. The value is fixed at 10. This parameter avoids the risk of hardware overflow while fully preserving the effective dynamic transition range of the mapping curve.

[0050] S306, spatial smoothing filtering is performed on the initial mask matrix. Although continuity is achieved in the numerical domain through nonlinear mapping, isolated noise points or edge spikes are still prone to appear in the mask matrix in two-dimensional space due to the inherent random high-frequency noise of the image sensor. To solve the spatial continuity problem, this embodiment performs spatial smoothing filtering on the initial mask matrix. Based on the principle of spatial local correlation, the system uses a low-pass filtering mechanism to perform two-dimensional discrete convolution on the initial soft mask weights. The mathematical calculation model is as follows: ; In the formula, Represents pixels The final output smoothing mask weights; The computational radius of the spatial filtering window defines the physical boundary for neighborhood fusion. This indicates the corresponding relative offset coordinates. Normalized Gaussian weight coefficients at the location; The initial soft mask weights are defined within the neighborhood. The original Gaussian weight coefficients used to calculate the normalized coefficients are calculated using the following formula: ; In the formula, This indicates the corresponding relative offset coordinates. The original Gaussian weight coefficients at the location; The standard deviation of the spatial distribution determines the smoothing strength of the filtering operation. To avoid division-by-zero anomalies, the standard deviation of the spatial distribution... It must be strictly greater than 0, and in this embodiment it is set to 1.0; at the same time, the calculation radius... It is usually set to 2 or 3.

[0051] Because discretization of continuous spatial functions can cause a deviation in the total energy of the Gaussian kernel, the system must convert the original Gaussian weight coefficients into normalized Gaussian weight coefficients to ensure the conservation of global weight energy in the mask matrix before and after smoothing. The specific computational logic is as follows: for specific relative offset coordinates... Its normalized Gaussian weight coefficients Defined as the current original Gaussian weight coefficients Divide by the dimensions of the entire filter window (i.e., both horizontal and vertical directions from...). to The arithmetic sum of all original Gaussian weight coefficients and the zero-prevention constant. The summation. Where, the zero constant is... In this embodiment, the value is consistent with the preceding steps and is set to 10. -6 Through the aforementioned two-dimensional discrete convolution operation, locally anomalously high response points are diluted by the surrounding safe background, while continuous compensatory regions achieve smoother degradation gradients at the edges. For cases where matrix edge pixels exceed the physical boundaries of the image during convolution operations, those skilled in the art can employ common mirror reflection filling or edge pixel duplication strategies for numerical alignment. The underlying boundary processing logic is well-known in the field and will not be elaborated upon here.

[0052] The smoothing mask weights output by this series of dynamic decisions and smoothing mechanisms constitute the core weighted operator for subsequent color channel remapping. It not only indicates whether a specific spatial location needs correction, but also mathematically defines the gradient ratio of the correction, laying the data structure foundation for achieving seamless color compensation rendering.

[0053] After obtaining the smoothing mask weights representing the local correction gradient, directly performing linear increment / decrement operations on the red and green channels of sensitive pixels often disrupts the original color balance of the pixels. Based on the universal physical law of color constancy, in order to maximize the preservation of the original physical light and dark structure and color tendency of the image while increasing the red-green contrast, the system needs to further calculate the hue loss compensation term. The core technical purpose of this compensation term is to establish a constraint operator with adaptive feedback capability to prevent large-scale color compensation from causing irreversible hue shift distortion. The specific implementation steps are as follows: S401, extracting the relative brightness maintenance benchmark of the source pixels. The human visual system is far more sensitive to high-frequency brightness details than to chromaticity changes. Based on this physiological characteristic, before formally implementing the color reconstruction operation, the system extracts the brightness features fused from multiple channels as a conservation benchmark for subsequent calculations. The technical purpose of this is to ensure that the physical luminous intensity before and after color compensation is constrained within a reasonable range, thereby avoiding unexpected bright and dark patches in the correction area. The calculation formula is as follows: ; In the formula, Represents pixels The relative brightness reference value at that location; , and Representing pixels The normalized red, green, and blue channel values, calculated in the previous steps and strictly aligned in spatial coordinates, are then used. As a preferred approach, the weighting coefficients of this linear combination are determined according to the standard ITU-R BT.601 color coding protocol. These coefficients not only strictly satisfy the energy conservation condition that the arithmetic summation equals 1, but also accurately fit the relative spectral sensitivity of human eye cone cells to different wavelengths of light at a physical level. By preserving this relative brightness reference value, the algorithm can implement brightness constraints independently of the chromaticity dimension in subsequent reconstruction.

[0054] S402, constructing hue constraint features based on the proportional relationship between channels. After extracting the relative brightness reference value, considering that simple color channel superposition will change the vector angle of the original pixels in the three-dimensional color space, thus causing a shift in visual perception of warm and cool tones, the system establishes hue constraint features by calculating the intensity ratio between the non-ambiguous blue channel and the red-green antagonistic channel. The calculation logic is as follows: ; In the formula, Represents pixels The calculated hue constraint eigenvalues; To prevent division-to-zero anomalies, the zero-prevention constant is set to 10 in this embodiment, consistent with the aforementioned steps. -6 This ensures that division operations maintain numerical continuity even in extreme dark regions where both normalized red and green channel values ​​approach zero. From a physical causal perspective, the eigenvalue constraint essentially quantifies the energy dominance of cool tones relative to warm tones in the current pixel. A high hue constraint value indicates that the pixel is dominated by short-wavelength light such as blue, belonging to a safe hue gamut that does not require depth intervention; conversely, a low value indicates that the pixel is in a broadband yellow-green-red spectral band that easily causes visual confusion, requiring more compensatory space.

[0055] It is important to note that under extreme conditions (e.g., when both red and green components are zero in a pure blue pixel), the denominator is only constrained by a tiny anti-zero constant, leading to significant numerical distortion in the calculated hue constraint feature value. Directly substituting this distorted value into subsequent exponential operations will cause floating-point underflow in the underlying hardware. Therefore, the system implements upper limit truncation protection for the calculated hue constraint feature value. In this embodiment, the truncation upper limit threshold is set to... When judging At that time, a mandatory order Considering that when the eigenvalue ratio is greater than 10, the subsequent exponentially decaying weights have converged to a minimum value, possessing sufficient physical suppression effectiveness, the upper threshold will be truncated in this embodiment. The value is fixed at 10. This protection logic effectively ensures the robustness of numerical analysis on any hardware platform.

[0056] S403, merging smooth mask weights to generate a dynamic hue loss compensation term. After establishing local brightness and hue constraints, to achieve joint control of multi-dimensional features, the system fuses spatial decision signals with color attribute features to construct a negative feedback coefficient for final channel reconstruction, i.e., the hue loss compensation term. Its mathematical calculation model is as follows: ; In the formula, Represents pixels The final calculated hue loss compensation item; The pixels output by the previous step The smoothing mask weights at the point are used to provide adjusted gradients in the spatial domain; For pixels The hue constraint characteristic value after truncation protection; This represents the global compensation strength coefficient, which determines the basic range of the compensation amount. In this embodiment, the global compensation strength coefficient... The value range is constrained to the interval [0.2, 0.8]. Specifically, this global compensation strength coefficient... The score from an externally input color vision deficiency medical scale is obtained through a direct proportional linear interpolation mapping. That is, when the user has mild color weakness... Approaching 0.2; when the user is severely colorblind, Mapped to 0.8. This adaptive mapping mechanism ensures the adaptability of compensatory strength under different physiological conditions.

[0057] The physical significance of this compensation model lies in constructing a direction-selective suppression valve by utilizing the smooth decay characteristic of the natural exponential function. When a pixel is dominated by blue tones, the hue constraint feature value is extremely high, and the exponential term quickly converges to 0, forcibly shutting off color intervention at the current position. When a pixel is in a significant red-green antagonistic region, and the smooth mask weight indicates that this region is a highly sensitive area, the exponential term approaches 1, and the hue loss compensation term reaches its maximum efficiency. This output logic, based on the joint calculation of multi-dimensional features such as spatial gradient weighting and hue structure feedback, effectively avoids the local color banding problem caused by relying solely on a single extreme value for correction.

[0058] To ensure high consistency between time and operating conditions, the system verifies the temporal alignment of the matrix formed by the smoothing mask weights and the matrix formed by the hue constraint eigenvalues ​​using the frame buffer timestamp before performing multiplication operations, and also verifies whether their spatial resolution dimensions are perfectly matched. The underlying parallel computation logic for spatial alignment and synchronous multiplication of the aforementioned multi-channel feature matrices can be implemented by calling standard matrix element-wise multiplication instructions in hardware accelerators, and its basic data alignment mechanism is a well-known technology in the field, which will not be elaborated upon here.

[0059] After calculating the color loss compensation term, the system in this embodiment then enters the core color reconstruction stage. For individuals with color vision deficiencies, increasing the physical emission spacing of the red and green channels is a key way to improve detail recognition. However, in the process of directly adjusting the gain of specific channels, the original pixel emission energy balance will inevitably be disrupted. Based on the general physical laws of color constancy and brightness conservation, a rigorous brightness closed-loop optimization mechanism must be introduced in the channel reconstruction stage. The core technical purpose of constructing this energy constraint model is to force the reconstructed pixel emission intensity to strictly approximate the original relative brightness reference while amplifying the physical contrast between red and green, thereby completely avoiding physical distortions such as overall overexposure or local darkening in the final displayed image. The relevant specific implementation steps are as follows.

[0060] S404, calculate the initial remapped channel color values. Utilizing the antagonistic color theory in physiology, red-green color vision abnormalities primarily stem from the overlapping absorption peaks of cone cells in response to medium- and long-wavelength spectra. Based on this principle, to broaden the user's spectral perception limits without increasing the display hardware's power consumption, this embodiment employs a differential energy transfer strategy for compensation. Specifically, the system does not inject color energy out of thin air, but directly extracts the difference between the original red and green channels as the compensation base, thereby precisely adjusting the visual confusion area. Based on the hue loss compensation term obtained in the previous steps, the system performs differential compensation on pixel channels exhibiting red-green antagonistic confusion characteristics, calculating the transient channel color values. The corresponding mathematical logic is as follows: ; ; ; In the formula, , and Representing pixels The initial remapping red channel value, initial remapping green channel value, and initial remapping blue channel value are calculated at point C; , and Representing pixels Normalized red channel values, normalized green channel values, and normalized blue channel values ​​that are strictly aligned in spatial coordinates; For pixels Hue loss compensation item that is strictly aligned in space and time; and These represent the red gain control coefficient and the green gain control coefficient, respectively.

[0061] As a preferred method, and The sign and specific value of this parameter are determined by the user's color vision deficiency type parameter input externally. For example, for users with red-weak (protanomaly), the system needs to enhance red light and appropriately suppress green light, hence the setting... and For users with a "deuteranomaly" (weak green) rating, a reverse setting logic is used. In this embodiment, and The absolute value of is constrained to the range of [0.5, 1.5] to ensure that the magnitude of differential compensation is within the linear response range of the physical display color gamut. The technical purpose of this calculation step is to use the inherent physical contrast between channels as the compensation benchmark to avoid color banding caused by injecting color energy out of thin air.

[0062] S405, calculate the physical brightness in the transient reconstruction state. After the differential compensation operation described above, the red and green channels are introduced with asymmetric gain changes, causing the overall luminous energy of the pixel to deviate from the original safe state. To quantify this deviation, the system must evaluate the physical offset of the overall brightness caused by the current remapping operation. Following the spectral perception benchmark of the human visual system, the system calculates the physical brightness in the current transient reconstruction state using the same color coding protocol as the initial steps. The calculation formula is as follows: ; In the formula, Represents pixels The transient relative brightness value is calculated at this point. In this step, since the blue channel does not participate in differential compensation (i.e., retains its original value), the physical root cause of the brightness shift is entirely caused by the energy recombination of the red and green channels. The extracted transient relative brightness value itself is not directly used for screen rendering, but serves as a state probe, providing a necessary comparison benchmark for subsequent energy recovery and closed-loop constraints.

[0063] S406, Construct a constant brightness optimization objective function and calculate the energy recovery coefficient. To eliminate transient bias, the system constructs a brightness constraint model based on ratio calculation. Since the digital adjustment of pixel brightness in the underlying hardware is manifested as a proportional linear scaling of the luminous drive intensity of each channel, the system can directly calculate a digital scaling multiplier for global energy synchronization restoration, i.e., the energy recovery coefficient, by solving for the quotient of the relative brightness reference value and the transient relative brightness value. The calculation logic is as follows: ; In the formula, Represents the calculated pixel points Energy recovery coefficient at the location; For pixels The relative brightness reference value at that location; For the calculated pixels The transient relative brightness value at the location; To prevent the brightness from reaching zero constant, it is set to 10 in this embodiment. -6 .

[0064] In practical digital image processing, if the original image contains extremely dark areas (such as the edge of a pure black background), the transient relative brightness value will be extremely close to zero. Directly performing division in this case will not only cause severe numerical distortion of the energy recovery coefficient, but will also amplify the underlying quantization noise exponentially. To ensure the absolute stability of digital signal processing, this embodiment introduces a two-way truncation protection mechanism for the calculated energy recovery coefficient. Specifically, a lower threshold for the energy recovery coefficient is set. With upper limit threshold of energy recovery coefficient Considering that digital images typically use 8-bit or 10-bit color depth quantization, excessive digital gain can lead to color burnout in bright areas, while insufficient attenuation can result in loss of detail in dark areas. Therefore, based on engineering safeguards to prevent quantization noise amplification and color overflow, this embodiment sets a lower limit threshold for the energy recovery coefficient. Set to 0.5, the upper limit threshold for the energy recovery coefficient. Set to 2.0. When the calculated value is lower than... At that time, forced truncation is When it is higher than When, it is forcibly truncated to .

[0065] After calculating the safe energy recovery factor, the system applies it synchronously to the three initial remapping channels, outputting the final display color drive value: ; In the formula, Representative color channel set Any element in; Represents the final calculated pixel points The normalized output color value of the corresponding channel; Represents set elements The corresponding initial remapping values ​​for the red channel, green channel, or blue channel are used. The min and max functions in this step combine to form a hard clamping operator, forcibly constraining the final calculated physical drive signal within the standard normalized closed interval [0,1]. The physical significance of this operation is that while achieving proportional scaling of color channel energy, it absolutely ensures that the reconstructed pixels do not exceed the physical light emission limit of the hardware. For the above-mentioned underlying parallel truncation operation and clamping processing logic, those skilled in the art can directly call the saturation arithmetic instructions built into general-purpose graphics processors or application-specific integrated circuits to implement it. Its underlying implementation mechanism is well-known in the field and will not be elaborated upon here.

[0066] The preceding pixel-level brightness constraint mechanism can provide color compensation that satisfies energy conservation for static images. However, when facing continuous video stream signals, since the above brightness constraint is based on isolated pixel-independent calculations and does not establish a correlation between pixels and the surrounding spatiotemporal environment, small fluctuations in the calculations can easily manifest as spatial contour artifacts in smooth transition regions or induce color flicker on the timeline of high-frequency motion scenes. In order to maintain a smooth visual experience under dynamic display conditions, this embodiment constructs a smoothing mechanism that takes into account both temporal viscosity and spatial low-pass filtering. The relevant specific implementation steps are as follows.

[0067] S407, Extracting Spatiotemporal Constraint Reference Prior States. Before constructing the global optimization objective function, to avoid subsequent solutions getting bogged down in complex matrix simultaneous calculations, the system employs an engineering decoupling strategy. Specifically, the system does not directly establish physical constraints between the variables to be solved, but instead generates a static reference frame in advance based on existing data. In the spatial dimension, the system extracts the mean color distribution of the current pixel and its local neighborhood as a spatial smoothing prior; in the temporal dimension, the system reads the output result at the same coordinate position of the previous frame from the frame buffer as a temporal continuity prior. The corresponding prior state extraction logic is as follows: ; In the formula, Represents pixels Spatial smoothing prior value of the corresponding channel; Let be the side length of the square neighborhood window, and satisfy . ; This indicates the offset position calculated in the previous steps relative to the local coordinates. The corresponding normalized output color value. As a preferred method, considering the capacity limitations of the hardware line buffer and the real-time requirements of the algorithm, the neighborhood radius... The value of is usually set to 1 or 2. The technical purpose of this spatial smoothing prior value is to condense the solved state of surrounding pixels into a constant anchor point to suppress isolated noise points. In the processing of pixels at the physical boundary of the image, those skilled in the art can use the edge mirroring extension strategy to prevent array out-of-bounds reading. The underlying memory address mapping rules are well-known in the art and will not be elaborated here.

[0068] At the same time, define The previous video frame at pixel point The corresponding channel's optimized output color value. For multi-source data fusion, before reading the previous frame's cached data, the system rigorously compares the timestamp of the current frame with the cached frame and the display resolution. If the timestamp span exceeds the single-frame refresh cycle threshold, or if a dynamic resolution switch occurs, the system will trigger a protection mechanism, forcibly... This prevents erroneous historical states from interfering with the optimization of the current frame. In this embodiment, the determination of the single-frame refresh cycle threshold is dynamically configured based on the hardware refresh rate of the display device. For example, at a refresh rate of 60Hz, if the difference between the timestamps of consecutive frames exceeds the usual 16.67 milliseconds plus the allowable system jitter tolerance (such as a total exceeding 20 milliseconds), it is determined that a frame drop or screen switching has occurred.

[0069] S408, Constructing a joint spatiotemporal optimization objective function and performing a fast analytical solution. After establishing accurate prior states, the system constructs a smooth optimization objective function based on least squares estimation. This objective function is a linear combination of a data fidelity term, a spatial smoothness penalty term, and a temporal continuity penalty term, and its mathematical structure is as follows: ; In the formula, This represents the global smoothing optimization objective function constructed for the current channel; This indicates that the summation is performed by iterating over and summing the coordinates of all pixels in the entire image. The final pixel points calculated in the preceding steps The normalized output color value of the corresponding channel; For the pixel point to be solved ( The optimal output color value for the corresponding channel; These are the space regularization weight coefficients; This is the weighting coefficient for time continuity.

[0070] In conventional image smoothing algorithms, since adjacent pixels are often unknown variables, minimizing such an objective function inevitably requires large-scale sparse matrix inversion operations, which is a computational burden that display driver chips cannot bear. However, thanks to the implementation of this embodiment in step S407, and All variables are fixed as known constants, and the mathematical coupling between individual pixels is completely severed. In practical implementation, the system only needs to adjust the objective function with respect to the variables to be determined. Find the partial derivative and set it to zero. Since each pixel is mathematically decoupled into an independent quadratic term in this function, the system can directly derive the closed-form analytical update formula, which is very easy to implement in hardware: ; Through this closed-form solution, the system effectively integrates global spatiotemporal smoothing characteristics while maintaining the accuracy of independent pixel compensation. It is worth noting that, due to the physical constant 1 and the existence of non-negative weighting coefficients, the denominator of this division formula is always greater than or equal to 1. This effectively avoids the risk of hardware division-by-zero overflow caused by the denominator approaching zero from a mathematical and physical perspective, greatly improving the robustness of the algorithm.

[0071] As a preferred approach, spatial regularization weight coefficients The value range is set to [0.1, 0.3], and the time continuity weighting coefficient is... The value range is set to [0.3, 0.7]. This specific weighting input parameter is chosen based on common sense from psychophysical experiments on human vision: the human visual system is extremely sensitive to abrupt changes in the time dimension (i.e., image flicker), therefore a time continuity weighting coefficient needs to be assigned. A larger proportion is used to enhance the inter-frame stickiness effect; however, excessive spatial constraints can cause high-frequency edge details in the image to become blurred, so the spatial regularization weight coefficients must be adjusted. Strict constraints are maintained at a low level. This multi-dimensional weighted logic avoids motion blur and loss of sharpness caused by relying solely on single temporal filtering or spatial blur.

[0072] In the process of color compensation and reconstruction of digital images, performing global tone mapping on the entire image area often leads to unexpected shifts in the natural colors of non-target recognition areas. To enhance the contrast of a specific target color gamut while preserving the color constancy of the background area, this embodiment introduces a mask-driven local tone modulation transformation mechanism. This mechanism generates a spatial weight mask by extracting numerical features of a specific color space, thereby guiding the local application of the tone mapping function in the form of soft boundaries. The specific implementation steps are as follows.

[0073] The system extracts color features after spatiotemporal joint optimization and calculates the initial weight mask. Local modulation requires the construction of a reasonable color separation dimension. Since the human visual system perceives color more by hue attributes than by single red, green, or blue brightness values, the system employs lower-level features based on color space transformation and Gaussian distribution similarity evaluation. Specifically, the system extracts the optimal output color value from step S408, which already possesses spatiotemporal smoothing characteristics. The system converts the RGB color space to the HSV color space and extracts the hue components. Considering that hue data mathematically and physically presents as a closed ring structure, direct algebraic subtraction would lead to severe numerical truncation errors at the beginning and end of the ring. Therefore, the system calculates the shortest angular distance between the current pixel's hue value and the target hue center, and uses this as the input variable for the Gaussian decay function. The corresponding mathematical logic is as follows: ; ; In the formula, Represents pixels The shortest physical angular distance between the hue value and the center of the target hue; For pixels The input hue value at the location has a range of [0°, 360°); The target modulation hue center is set for the system; This represents the standard deviation of hue tolerance. Represents the calculated pixel points The initial weight mask at the location is strictly constrained to the range of [0,1].

[0074] As a preferred method, the target hue center With hue tolerance standard deviation The specific values ​​are dynamically assigned based on external business needs. For example, in local compensation scenarios targeting the red-weak group, it is usually necessary to intervene in the distribution of the red-orange color scheme. Set to 0° (or the equivalent 360°). The value range is set to 15° to 30°. The technical purpose of this calculation step is to construct a numerical weight field for distinguishing the target from the background by assigning high weights (close to 11) to pixels close to the target hue and low weights (close to 0) to pixels deviating from the target hue using a Gaussian distance metric. For the aforementioned nonlinear conversion algorithm from RGB color space to HSV color space, those skilled in the art can directly use existing general color conversion protocols; its underlying mapping logic is well-known in the field and will not be elaborated upon here.

[0075] S502 performs spatial two-dimensional smoothing filtering and morphological boundary softening. After obtaining the initial weight mask, if it is directly used as the basis for subsequent color modulation, the original small noise or high-frequency edge dispersion in the image can easily cause discrete jumps in the mask area. These jumps will eventually solidify into obvious color level breaks in the image. To solve this spatial visual coherence problem, the system needs to perform spatial low-pass filtering on the initial weight mask to eliminate high-frequency noise and soften the modulation boundaries. The system performs smoothing operations based on the principle of local convolution, and its engineering calculation logic is as follows: ; To make the above convolution operation physically feasible, the system generates core weight coefficients based on a two-dimensional Gaussian distribution, and its discretized analytical expression is defined as: ; In the formula, Represents the number of pixels output after filtering. Smoothing weight mask at the location; The set convolution filter radius; and This refers to the spatial offset coordinate variable within the local neighborhood. This indicates the offset position calculated in the previous steps relative to the local coordinates. The corresponding initial weight mask; Spatial offset coordinates The corresponding Gaussian kernel coefficients at that location; To determine the spatial standard deviation of the spatial smoothness intensity; To prevent the mask from becoming zero, it is set to 10 in this embodiment. -6 .

[0076] The above filtering formula extracts a square neighborhood window around the center pixel and uses a Gaussian kernel to perform a weighted sum of the mask values ​​within the neighborhood. The normalization operation in the denominator ensures that the smoothing process does not change the overall energy distribution of the original mask. The introduction of this feature mathematically avoids hardware overflow failures caused by division by zero in completely black or low-weight backgrounds. When performing the aforementioned two-dimensional convolution operation, for missing coordinate regions where the filtering window extends beyond the physical boundaries of the image, the system employs an edge mirroring strategy to fill in the missing coordinates, ensuring the safe execution of memory read instructions. In this embodiment, the filtering radius... The spatial standard deviation is typically set to 3 to 5. The filter radius is typically set between 1.0 and 2.5 to achieve an engineering balance between a smooth transition and preserving the effective boundary.

[0077] S503, perform mask-guided nonlinear local tone blending. After obtaining a smooth weighted mask with soft-boundary characteristics, the system employs a weighted linear interpolation model on the input signal of this modulation module (i.e., the optimal output color value from step S408). A pixel-level smooth transition and fusion is performed between the signal and the preset target tone mapping signal. The corresponding mathematical analytical structure is as follows: ; In the formula, Representative color channel set Any element in; Represents the final calculated pixel points The local modulation color value of the corresponding channel; Indicates the pixel points input to this modulation module. The initial color driving value for the corresponding channel; This represents the preset global tone mapping operator.

[0078] The technical logic behind this formula lies in constructing a smooth transition mechanism with mutually exclusive weights. When the smooth weight mask of a certain pixel... When the value approaches 0 (i.e., it is located in a non-target region), the second half of the formula is suppressed, and the current pixel retains the original input to the greatest extent possible. This ensures the constancy of the background color; conversely, when the mask value approaches 1 (i.e., within the core intervention area), the formula is mainly affected by the preset mapping function. This dominates, thereby achieving tonal reconstruction of the target area.

[0079] Regarding the functional technical terms involved In the specific implementation of the lower-level features, the system directly calls the target mapping curve generated in step S209. It can be used as a lookup table (LUT) reference, or a nonlinear Gamma transform can be employed as the tone mapping operator. If a Gamma transform is used, its expansion form is: ; In the formula, This is a Gamma modulation parameter set for a specific channel. It is set when it's necessary to darken neutral grayscale and increase contrast for a specific channel. When you need to brighten details in shadows, set... Because the exponential Gamma transformation is extremely sensitive to the domain of the base variable, the system uses hardware or software-level data clamping logic to ensure the input signal is secure before executing this nonlinear operator. It has been strictly clamped within the standard normalized closed interval [0,1]. This verification and protection mechanism fundamentally eliminates the risk of overflow amplification caused by negative bases leading to complex number anomalies or values ​​greater than 1. By embedding this nonlinear transformation as a target mapping operator into the linear interpolation framework, the system achieves highly controllable local color reshaping while maintaining the safe closure of the physical luminescence boundary of the image.

[0080] S504 performs physical quantization and digital signal output at the display end. It acquires locally modulated color values ​​after local tone blending. Subsequently, since the underlying display driver IC can only receive discrete integer level signals, the system must ultimately map the results of continuous-domain operations to a specific physical bit-depth space. To avoid the accumulation of quantization errors caused by directly truncating decimal places, this embodiment employs a linear quantization model with rounding compensation. Its engineering calculation logic is as follows: ; In the formula, This represents the number of pixels ultimately output to the display panel. The digital drive level value corresponding to the channel; The hardware quantization bit depth for the display panel; symbol This represents the floor function. The introduction of the constant 0.5 enables rounding compensation at the digital logic level, ensuring color fidelity during the digital-to-analog conversion process. Before outputting to the register, the system performs a hardware-level bitmask locking operation to force the calculation result to be clamped to a valid hardware range. The underlying register assignment and the communication handshake protocol with the display panel are well-known technologies in the field and will not be elaborated upon here.

[0081] In one embodiment, Figure 4This is a two-dimensional coordinate graph, where the horizontal axis represents the time axis of the video stream, and the vertical axis represents the absolute color offset of the non-target background area in the output image.

[0082] Reference Figure 4 The figure contains the following elements: a horizontal dashed line, marked as the fidelity threshold. This line represents a preset compliance threshold at which the human eye perceives distortion of natural background features and causes visual discomfort. A dashed line, marked as the traditional global compensation method. This curve represents the change in the offset of the non-target background region in a system that does not employ the mask-based local feature fusion and brightness constraint method of this invention. Before time T1, the value of the dashed line is below the fidelity threshold. After time T1, because the system forcibly stretches the global feature space to improve the contrast of local targets, its value rises rapidly and exceeds the range defined by the fidelity threshold for a period of time (manifesting as severe background distortion or local overexposure on the display). It then slowly decreases and returns to below the threshold as the target moves out of the frame. A solid line, marked as the method of this invention. This curve represents the change in the offset of the non-target background region in a system employing the method described in this invention. Throughout the entire time axis, the value of the solid line remains below the limit defined by the fidelity threshold. Around time T1, the curve shows only very small, gentle fluctuations before quickly returning to a stable state.

[0083] Figure 4 The document also marks two specific time points: Time point T0: This represents the moment when the system extracts the bottom-level components of the source image and calculates the relative difference quotient of the local region, which significantly exceeds the dynamic confusion judgment threshold (corresponding to a burst of high-density confused pixels). The method described in this invention immediately initiates the generation of smoothing mask weights, the calculation of loss compensation terms, and the calculation of spatiotemporal joint optimization decisions after time T0. Time point T1: This represents the moment when the high-confusion pixel features detected at time T0, as the video frames progress or the target moves, massively enter and occupy the core visual area of ​​the display device.

[0084] The figure illustrates that, when addressing the same dynamic, highly confusing scene impact, the traditional global compensation method (shown by the dashed line) suffers from severe background distortion exceeding the standard after a large area of ​​the confused target arrives (after T1) due to the lack of spatial isolation and energy conservation mechanisms. In contrast, the method of this invention (shown by the solid line) detects antagonistic channel features upstream at time T0 and executes predictive local cooperative control based on mask guidance and energy recovery coefficient. This ensures that the offset of the non-target background region remains below the fidelity standard threshold when the confused scene impact arrives (at time T1) and thereafter. This solves the problem that existing technologies cannot effectively balance global constancy and sudden local distortion when correcting visual anomalies.

Claims

1. A method for correcting color vision deficiency based on color transformation, characterized in that, Includes the following steps: The input image is converted to the CIE Lab color space, and the input image is processed using a color vision anomaly simulation model to generate a simulation image; The color difference vector is calculated by comparing the chromaticity components of the input image and the simulation image, and the final confusion degree is calculated by combining spatial aggregation. Based on the final confusion degree, a cumulative distribution function is constructed to generate the target mapping curve. The normalized red, green and blue color components of the input image are analyzed to calculate the relative chromaticity difference quotient. The dynamic confusion judgment threshold is calculated by combining global statistical features, and a soft mask matrix is ​​generated and filtered to obtain smooth mask weights. Based on the normalized red, green and blue color components, a relative brightness benchmark is calculated to construct hue constraint features. Combined with the smooth mask weights, a hue loss compensation term is generated and differential compensation is performed. A constant brightness constraint is applied through the energy recovery coefficient. The spatiotemporal joint optimization objective function is solved to obtain the optimal output color value. The optimal output color value is converted to the HSV color space to generate a local weight mask. The local weight mask is used to guide the initial color driving value and the mapping signal generated based on the target mapping curve to perform local hue interpolation and fusion, and the final display driving color value is quantized and output.

2. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The steps of converting the input image to the CIE Lab color space and processing the input image using a color vision anomaly simulation model to generate a simulation image include: The input image is subjected to inverse gamma correction to calculate linear red-green-blue data; The linear red-green-blue data are mapped to the CIE XYZ color space through a positive transformation matrix to calculate the true tristimulus values, and the true tristimulus values ​​are then converted to the CIE Lab color space via a nonlinear mapping function. The linear red-green-blue data is converted to the LMS color space, and the original response values ​​of each color channel are parsed out. The original response value is subjected to confusion line projection processing using a preset transformation matrix to generate restricted visual response data, and boundary constraints within the normalization interval are applied to the restricted visual response data. The restricted visual response data is mapped back to the CIE XYZ color space using an inverse transformation matrix to calculate virtual tristimulus values. These virtual tristimulus values ​​are then nonlinearly mapped to the CIE Lab color space using a zero-prevention constant, and the simulated image is output.

3. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The steps of calculating the color difference vector by comparing the chromaticity components of the input image and the simulated image, and then calculating the final level of confusion by combining spatial aggregation, include: Perform color channel separation operations on the input image and the simulation image in the CIE Lab color space to resolve the real a component and the real b component of the input image, and the simulation a component and the simulation b component of the simulation image. The first difference is calculated by subtracting the corresponding pixel value of the real a component from the corresponding pixel value of the simulated a component, and the second difference is calculated by subtracting the corresponding pixel value of the real b component from the corresponding pixel value of the simulated b component. The first difference and the second difference form a two-dimensional color difference vector, and the magnitude of the color difference vector is calculated. Calculate the spatial angle between the color difference vector and the unit reference vector parallel to the a-component coordinate axis; Based on the Gaussian distribution distance decay model, the magnitude of the color difference vector is transformed into a nonlinear distance weight value, and the distance weight value is multiplied by the absolute value of the cosine of the spatial angle to calculate the local confusion of a single pixel pair. Within a two-dimensional spatial neighborhood window, the local confusion amount is spatially aggregated and normalized by combining spatial distance weights based on a Gaussian decay function, and the final confusion degree of the center pixel is calculated.

4. The method for correcting color vision abnormalities based on color transformation according to claim 3, characterized in that, The step of constructing the cumulative distribution function and generating the target mapping curve based on the final level of confusion includes: The final level of confusion is used as a weighting factor and accumulated into the frequency range to which the discrete pixel values ​​of the target color channel currently being processed belong, thereby constructing a confusion-weighted histogram. Perform a discrete integral operation on the confusion-weighted histogram to calculate the cumulative confusion frequency of each quantization level and generate the cumulative distribution function; The input extrema of the cumulative distribution function are combined with the zero-prevention constant and mapped to the physical dynamic range of the target color channel. The target mapping curve for color compensation is generated through hard truncation decision logic.

5. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The step of parsing the normalized red, green, and blue color components of the input image to calculate the relative chromaticity difference quotient includes: Separate the red and green components from the normalized red-green-blue color components, calculate the absolute difference between the corresponding pixels of the red and green components, and use it as the target molecule; Calculate the sum of the intensities of the red component and the green component; The difference between constant 1 and the blue component is used as the background brightness suppression weight, and the background brightness suppression weight is multiplied by the anti-zero constant to calculate the brightness compensation term; Add the sum of the intensities to the brightness compensation term to obtain the target denominator; Divide the target numerator by the target denominator to calculate the relative chromaticity difference quotient for each pixel.

6. The method for correcting color vision abnormalities based on color transformation according to claim 5, characterized in that, The steps of calculating the dynamic confusion determination threshold by combining global statistical features, generating a soft mask matrix, and filtering to obtain smooth mask weights include: The arithmetic mean of the relative chromaticity difference quotients of all pixels and the global standard deviation are calculated as the global statistical feature; The dynamic confusion judgment threshold is generated and truncated by linearly combining the arithmetic mean and the global standard deviation through a sensitivity adjustment coefficient. Calculate the difference between the relative chromaticity difference quotient and the dynamic confusion determination threshold, substitute the difference into an S-shaped logic function with a gain control parameter, generate an initial soft mask weight with a value between zero and one, and construct the soft mask matrix from the initial soft mask weights of all pixels. Construct a two-dimensional filter kernel composed of normalized Gaussian weight coefficients; The two-dimensional filter kernel is slid pixel by pixel on the soft mask matrix, and the initial soft mask weights within the coverage area of ​​the two-dimensional filter kernel are multiplied one by one with the corresponding normalized Gaussian weight coefficients to calculate each product; The smoothed weight value of the center pixel position is calculated by summing all the products within the coverage area of ​​the two-dimensional filter kernel and traversing all pixels of the soft mask matrix.

7. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The steps of constructing hue constraint features based on the normalized red, green, and blue color components relative brightness benchmark, and generating hue loss compensation terms in combination with the smoothing mask weights, include: The red, green, and blue components are extracted from the normalized red, green, and blue color components. The red, green, and blue components are multiplied by their respective preset brightness weights and summed to calculate the relative brightness benchmark. Calculate the sum of the red component and the green component, and divide the blue component by the sum to calculate the initial color contrast value; An upper limit truncation protection operation is performed on the initial hue value, and the truncated value is used as the hue constraint feature; Obtain the negative of the hue constraint feature, and use the negative as the exponent of the natural base to calculate the natural exponential function term; The hue loss compensation term is calculated by sequentially multiplying the preset global compensation strength coefficient, the smoothing mask weight, and the natural exponential function term.

8. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The steps for obtaining the optimal output color value by performing differential compensation using the hue loss compensation term, applying constant brightness constraints through the energy recovery coefficient, and solving the spatiotemporal joint optimization objective function include: Based on the hue loss compensation term and the preset gain control coefficient, the difference between the original red and green channels is calculated as the compensation basis, the initial remapped channel color value is solved, and the transient relative brightness value corresponding to the initial remapped channel color value is calculated. Calculate the quotient of the relative brightness reference and the transient relative brightness value, truncate it, and then calculate the energy recovery coefficient. The energy recovery coefficient is synchronously multiplied by the color value of each of the initial remapped channels and a hardware latching operation is performed to complete the constant brightness constraint; Extract the local spatial smoothness prior value of adjacent pixels, and read the temporal continuity prior value of the previous frame image; Calculate the difference between the target color variable to be optimized and the initial remapped channel color value, and use the difference to construct a data fidelity term; Calculate the spatial gradient difference between the target color variable and the local spatial smoothing prior value, and construct a spatial smoothing penalty term using the spatial gradient difference; Calculate the temporal fluctuation difference between the target color variable and the prior value of temporal continuity, and construct a temporal continuity penalty term using the temporal fluctuation difference; The data fidelity term, the spatial smoothness penalty term, and the temporal continuity penalty term are multiplied by their respective constraint weights and then added together to construct the spatiotemporal joint optimization objective function. The partial derivative of the target color variable in the spatiotemporal joint optimization objective function is calculated and set to zero. The optimal output color value is then directly calculated using closed-form analytical logic.

9. The method for correcting color vision abnormalities based on color transformation according to claim 1, characterized in that, The step of converting the optimal output color value to the HSV color space to generate a local weight mask includes: Perform channel separation operation on the optimal output color value after conversion to HSV color space, analyze the hue component, and calculate the shortest physical angular distance between the hue component and the set target hue center. Substitute the shortest physical angular distance into a Gaussian decay function based on the standard deviation of hue tolerance to calculate the initial weight mask. The initial weight mask is subjected to spatial low-pass filtering based on edge mirror extension using a two-dimensional discrete Gaussian kernel to generate the local weight mask with smooth transition characteristics.

10. The method for color vision abnormality correction based on color transformation according to claim 1, the step of using the local weight mask to guide the initial color driving value and the mapping signal generated based on the target mapping curve to perform local hue interpolation fusion, and quantizing and outputting the final display driving color value includes: The initial color driving value input to the display modulation module is read, and the initial color driving value is nonlinearly processed through the target mapping curve to calculate the mapping signal; The difference between the constant and the local weight mask is used as the base weight. The base weight is then multiplied by the initial color driving value to calculate the base color components. The local weight mask is multiplied by the corresponding mapping signal to calculate the mapped color components; The base color component is added to the mapped color component to calculate the local modulated color value, thus completing the local hue interpolation fusion. The final display driver color value is calculated by multiplying the local modulation color value by the maximum integer level corresponding to the hardware quantization bit depth, adding a compensation constant, and then rounding down.