A method for color correction of a diagnostic image
By analyzing the brightness distribution of the tongue image during and after exposure, a brightness mapping function was constructed, which solved the problem of color detail recovery in ISP compressed images and achieved high-contrast color correction of visual diagnosis images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DALIAN ZHIDRIVE TECH CO LTD
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies cannot accurately recover tongue color details from images compressed by ISP algorithms without introducing additional hardware, resulting in the loss of texture detail contrast in visual examination images.
By acquiring images of the tongue during and after exposure, analyzing the brightness distribution, constructing a morphological difference measurement matrix, determining the brightness mapping function, and using a gain coefficient for color correction.
Without adding hardware, it significantly improves the contrast of key pathological features in visual diagnostic images and accurately restores the color details of the tongue.
Smart Images

Figure CN122243842A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image enhancement technology, and specifically to a method for color correction in visual diagnosis image acquisition. Background Technology
[0002] In the field of digital-assisted diagnosis and treatment in traditional Chinese medicine, using smart terminals to collect images of patients' tongues has become the mainstream data acquisition method. In practical application scenarios, in order to obtain high-quality visual diagnosis images, it is usually required to shoot in a well-lit environment. Existing mobile imaging devices generally adopt automatic exposure (AE) and automatic white balance (AWB) strategies, and have built-in image signal processors (ISPs) optimized for portrait photography. When the lens is pointed at the red tongue, which occupies the main part of the image, the ISP often determines that the red channel is about to be oversaturated, and then automatically triggers highlight suppression and tone mapping algorithms. Although this non-linear dynamic range compression prevents the overall photo from being overexposed, for tongue diagnosis images, it will cause the color layers of high-saturation areas such as the red tongue and frenulum to be smoothed out, so that the texture details that originally have important pathological significance lose contrast in the final image.
[0003] Existing physical color chart correction schemes are cumbersome to operate and are affected by oral cavity shadows; while simple exposure lock schemes can preserve the original signal, but introduce a lot of shot noise on moving sensors, affecting image clarity; therefore, existing technologies cannot recover sufficient tongue color details from ISP algorithm compressed images without introducing additional hardware. Summary of the Invention
[0004] To address the technical problem of existing technologies failing to accurately recover tongue color details from ISP algorithm-compressed images without introducing additional hardware, the present invention aims to provide a color correction method for visual diagnosis image acquisition. The specific technical solution adopted is as follows: Retrieve the exposed tongue image and the stable tongue image after exposure from the oral medical database; The brightness levels of the exposed tongue image are truncated to obtain a truncated tongue image; the original brightness distribution curve is determined based on the brightness distribution of the truncated tongue image; and the stable brightness distribution curve is determined based on the brightness distribution of the stable tongue image. Based on the brightness distribution offset between the original brightness distribution curve and the stable brightness distribution curve, a morphological difference measurement matrix is constructed; based on the element value distribution of the morphological difference measurement matrix, optimization is performed to determine all original curve brightnesses that match the brightness of each stable curve in the stable brightness distribution curve in the original brightness distribution curve; based on the stable curve brightness and its matching original curve brightness, a brightness mapping function is constructed. Based on the brightness variation of the brightness mapping function, the gain coefficient corresponding to each brightness level is determined, and the gain coefficient is used for color correction of visual image acquisition.
[0005] Furthermore, the method for obtaining the truncated tongue image includes: In the exposed tongue image, all brightness levels greater than the preset truncation threshold are used as the filter brightness levels; all pixels whose corresponding brightness belongs to the filter brightness level are removed to determine the truncated tongue image.
[0006] Furthermore, the method for obtaining the preset truncation threshold includes: Sort all brightness levels in the exposed tongue image from smallest to largest to determine the exposure brightness level sequence; use the brightness level at the 90th percentile position in the exposure brightness level sequence as the preset truncation threshold.
[0007] Furthermore, the method for obtaining the original brightness distribution curve includes: Using all brightness levels in the truncated tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference original brightness distribution curve; the reference original brightness distribution curve is then standardized to obtain the original brightness distribution curve.
[0008] Furthermore, the method for obtaining the stable brightness distribution curve includes: Using all brightness levels in the stable tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference stable brightness distribution curve; the reference stable brightness distribution curve is then standardized to determine the stable brightness distribution curve.
[0009] Furthermore, the method for constructing the morphological difference measurement matrix includes: A morphological difference measurement matrix is constructed, wherein the rows of the morphological difference measurement matrix represent the brightness of each stable curve in the stable brightness distribution curve, and the columns of the morphological difference measurement matrix represent the brightness of each original curve in the original brightness distribution curve; each element in the morphological difference measurement matrix is the absolute value of the difference between the value of the stable curve brightness in the corresponding row of the stable brightness distribution curve on the stable brightness distribution curve and the value of the original curve brightness in the corresponding column of the original brightness distribution curve on the original brightness distribution curve.
[0010] Furthermore, the process of determining the brightness of each stable curve in the stable brightness distribution curve that matches the brightness of all original curves in the original brightness distribution curve includes: The element at the top left corner of the morphological difference measurement matrix is taken as the starting point for optimization. In the morphological difference measurement matrix, each column of the morphological difference measurement matrix is taken as the endpoint column, and the last row of the morphological difference measurement matrix is taken as the endpoint row. Based on the endpoint row and each endpoint column, each optimization reference endpoint is determined. Using the morphological difference metric matrix as input, a dynamic time warping algorithm is employed to perform optimization between the optimization starting point and each optimization reference endpoint to determine the global optimal path; based on the global optimal path, all original curve brightnesses that match the brightness of each stable curve in the stable brightness distribution curve in the original brightness distribution curve are determined.
[0011] Furthermore, the method for constructing the luminance mapping function includes: The optimal reference endpoint corresponding to the global optimal path is taken as the optimization endpoint; within the original curve brightness range covered between the optimization start point and the optimization endpoint, the stable curve brightness is taken as the independent variable, and the mean of all original curve brightness that matches the stable curve brightness is taken as the dependent variable. The reference brightness mapping function is constructed by cubic spline interpolation. Outside the original curve brightness range covered between the optimization start point and optimization end point, calculate the terminal slope of the reference brightness mapping function, and linearly extend the terminal of the reference brightness mapping function along the direction of the terminal slope to determine the brightness mapping function.
[0012] Furthermore, the method for determining the gain coefficient corresponding to each brightness level includes: If the brightness level is greater than the preset brightness threshold, then the positive integer 1 will be used as the gain coefficient corresponding to the brightness level. If the brightness level is less than or equal to the preset brightness threshold, the function value of the brightness mapping function at that brightness level is used as the numerator, and the sum of the corresponding brightness level and the preset minimum constant is used as the denominator. The gain coefficient corresponding to the brightness level is calculated by ratio operation.
[0013] Furthermore, the process of color correction for visual diagnosis image acquisition includes: Obtain the R component value of each pixel in the stable tongue image in the RGB space corresponding to the R channel; use the gain coefficient of the brightness level corresponding to the R component value as the corresponding pixel gain; The product of the R component value and the corresponding pixel gain of each pixel in the stable tongue image is rounded down to determine the reference R component value; the minimum value between the reference R component value and the preset R component threshold is taken as the corrected R component value; the corrected R component value of each pixel is combined with the G channel and B channel of the corresponding pixel to determine the color-corrected visual image.
[0014] The present invention has the following beneficial effects: This invention addresses the limitation of existing technologies in accurately recovering color details in ISP-compressed images without introducing additional hardware. First, it acquires tongue images during and after exposure, pinpointing the core carriers of diagnostic pathology information at the source and providing a low-dynamic-range compressed data foundation for subsequent analysis. Second, it analyzes the brightness distribution of the tongue images during and after exposure, determining brightness distribution curves to intuitively quantify the brightness distribution morphology of the tongue region under low-dynamic-range and ISP compression responses. Then, it compares the offsets of the brightness distribution curves during and after exposure, analyzing the mapping relationship between each post-exposure brightness and the corresponding pre-exposure brightness. This allows for the reconstruction of a full-domain continuous mapping curve from steady-state brightness to original brightness using two frames without adding hardware. Finally, it obtains gain coefficients and executes a targeted enhancement strategy, significantly improving the contrast of key pathological features in the diagnostic image while maintaining overall white balance and clarity, accurately recovering the tongue color details in the diagnostic image. Attached Figure Description
[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart of a color correction method for visual diagnosis image acquisition provided in one embodiment of the present invention. Detailed Implementation
[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of a color correction method for visual image acquisition based on the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0019] The specific scheme of the color correction method for visual diagnosis image acquisition provided by the present invention will be described in detail below with reference to the accompanying drawings.
[0020] Please see Figure 1The diagram illustrates a flowchart of a color correction method for visual image acquisition according to an embodiment of the present invention, the method comprising: Step S101: Obtain the exposed tongue image and the stable tongue image after exposure from the oral medical database.
[0021] Existing imaging devices (such as smartphones) generally employ automatic exposure and automatic white balance strategies when capturing images or videos. The built-in image signal processor (ISP) optimizes the original exposed image to eliminate overexposed areas and outputs a processed image. However, after highlight suppression (i.e., after exposure), the contrast of highly saturated areas in the tongue image decreases, resulting in a loss of detail in the tongue image output by the imaging device. In practice, images acquired by imaging devices are all after exposure; these tongue images lack detail and cannot be used for tongue diagnosis. Similarly, images taken during exposure, without highlight suppression (as exposure is in progress), contain numerous overexposed areas and cannot be directly used for tongue diagnosis. Therefore, it is necessary to acquire both the initial exposed tongue image and the initial stabilized tongue image after exposure. Based on the initially stabilized tongue image, the correspondence between it and the initial exposed tongue image can be analyzed to inversely recover the color details of the initially stabilized tongue image, resulting in a highly detailed diagnostic image.
[0022] As an example, in a specific implementation of this invention, the process of obtaining the initial exposed tongue image and the initially stabilized tongue image from the oral medical database is as follows: First, the system reads the tongue preview video stream of the target object captured by the camera from the oral medical database (taking a 30fps tongue preview video stream as an example); second, the system initializes a fixed-length... A circular frame buffer is configured, where N can be set to 15. This length can cover approximately 0.5 seconds of historical data while controlling memory usage. The buffer is configured to receive the tongue preview video stream from the camera of the shooting device, continuously storing the image data (RGB format) of each frame and its corresponding ISP metadata. The ISP metadata includes at least the gain of the red channel (R channel). and exposure time Then, the system runs a mouth key point detection algorithm in real time to analyze the preview stream. When it detects that the target object's mouth is open and the tongue protrusion exceeds a preset trigger threshold (e.g., 30% of the mouth area), it is determined to be a trigger event. To prevent the system from becoming unresponsive due to prolonged lack of triggering, a timeout logic is set: if no trigger event is detected within a preset time window (e.g., 3 seconds), it is forcibly triggered. The mouth detection algorithm is a well-known technique in the art and will not be described or limited here. Finally, after the trigger event is triggered, the system pauses buffer writing and performs the following operations: For the initial exposed tongue image during exposure, traverse the buffer... Frame history data, calculate the total exposure volume for each frame: ,in, This represents the total exposure product of the i-th frame in the buffer; This represents the gain of the red channel in the i-th frame of the buffer; This represents the exposure time of the i-th frame in the buffer. The system selects the frame with the largest total exposure product value as the initial exposure image of the tongue body. This is because the initial exposure image of the tongue body at this exposure time is in the stage where the ISP has not yet fully reduced the exposure parameters. It is the initial reference image with less dynamic range compression by the ISP and serves as a linear reference for subsequent derivation of the compression law. It should be noted that the initial exposure image of the tongue body at this exposure time is an RGB image that has undergone demosaicing and basic white balance processing, but has not yet undergone non-linear tone mapping processing. For the initially stabilized tongue image after exposure, after acquiring the initial exposed tongue image, the system resumes preview stream monitoring and waits for ISP parameter convergence. When the total exposure volume change rate of three consecutive frames is less than 1%, it is considered that the parameters are stable. At this time, the current frame (i.e., the third frame in the three consecutive frames) is captured as the initially stabilized tongue image after exposure. This initially stabilized tongue image after exposure has high clarity and low noise, but the highlight texture of its red channel has been suppressed by the dynamic range compression algorithm of the ISP. Therefore, it is used as the target substrate for color restoration. The method for calculating the total exposure volume change rate is as follows: calculate the absolute value of the difference between the total exposure volume of the current frame and the total exposure volume of the previous frame, divide the absolute value of the difference by the total exposure volume of the previous frame, and obtain the total exposure volume change rate of the current frame. It should be noted that the length N of the buffer and the preset trigger threshold can be set by the implementer according to the specific implementation scenario, and are not limited here. It should be further noted that at the initial stage of system startup, since the first frame image does not have a previous frame, the system is forced to set the total exposure volume change rate of the first frame to 0, in order to avoid computational crashes.
[0023] There is a time difference between the exposure time and the acquisition time after exposure. During this time difference, on the one hand, the head of the target object may be displaced, causing the overall position of the tongue in the tongue image to change; on the other hand, the tongue, as soft tissue, itself is subject to non-rigid deformation, such as slight scaling and edge creep, which can cause pixels at the same location to represent different meanings in the tongue images during and after exposure (for example, the same pixel represents the tongue in the initial exposure image of the tongue during exposure, but represents the lips in the initial stable exposure image of the tongue after exposure). If the initial exposure image of the tongue during exposure and the initial stable exposure image of the tongue after exposure are directly used for subsequent calculations and analyses, it will lead to large errors in the calculation results. Therefore, this embodiment of the invention aligns the initial exposure image of the tongue during exposure and the initial stable exposure image of the tongue after exposure, which can eliminate the errors caused by the translation of the target object's head and the deformation of the tongue, and provide a reliable data foundation for subsequent analysis.
[0024] As an example, in a specific implementation of this invention, the following method is used to align the initial exposed tongue image and the initial stabilized tongue image after exposure: For situations where the target object's head displacement causes a change in the overall position of the tongue in the tongue image: First, convert the initially stabilized tongue image after exposure to the HSV color space, and set the hue threshold range for the tongue color (e.g., The system performs binarization segmentation on the tongue image to generate an initial binary mask containing only the tongue region (white pixels represent the tongue region, and black pixels represent other regions outside the tongue region). Next, it calculates the average coordinates of all white pixels in the initial binary mask as the centroid of the tongue in the initially stabilized tongue image after exposure. Then, based on the calculation principle of the centroid of the tongue in the initially stabilized tongue image after exposure, it simply replaces the initially stabilized tongue image after exposure with the initial exposed tongue image at the time of exposure to obtain the centroid of the tongue in the initial exposed tongue image at the time of exposure. Finally, it subtracts the centroid of the tongue in the initially stabilized tongue image after exposure from the centroid of the initial exposed tongue image at the time of exposure to obtain a displacement vector. The system then uses this displacement vector to represent the initial value of the tongue in the initially stabilized tongue image after exposure. The binary mask is translated along the displacement vector to determine the translated binary mask, so that it is initially aligned with the initial exposed tongue image in the coordinate system. The reason for using the initial binary mask of the initially stabilized tongue image after exposure for initial alignment is that the initially stabilized tongue image after exposure has higher spatial resolution and edge fidelity, and can provide a more reliable tongue morphology benchmark. This initial alignment can eliminate the overall positional shift of the tongue caused by the displacement of the target object's head, and provide a spatially consistent image benchmark for further processing of non-rigid deformation of the tongue, avoiding interference of overall positional deviation on deformation analysis, and improving the spatiotemporal consistency and computational reliability of the tongue image. Binarization segmentation is a well-known technique and does not need to be elaborated or limited here. Regarding the non-rigid deformation of the tongue itself: After the initial alignment described above, although the effects of head translation are eliminated, the problem of non-rigid deformation of the tongue as soft tissue (such as micro-scaling and edge creep) cannot be solved. If the translated mask (i.e., the translation binary mask mentioned above) is used directly for sampling, pixels of the lip or oral cavity background may be incorrectly sampled in the initial exposed tongue image, resulting in subsequent statistical distributions no longer being homogeneous. Therefore, the system performs morphological erosion on the translation binary mask, setting the erosion kernel radius to K (e.g., K is 10 pixels). This operation is equivalent to shrinking the edge of the translation binary mask inward. Each pixel generates a final tongue region mask. The tongue region on this final tongue region mask is aligned with both the initial exposed tongue image and the stabilized tongue image after exposure, eliminating the influence of the tongue's own non-rigid deformation. After this morphological erosion step, the system forcibly removes all edge regions that may be misaligned due to deformation, retaining only the pixels in the center of the tongue. Since the tissue texture in the center of the tongue has statistical stationarity, even if a small deformation occurs, the shape of the brightness probability density distribution in this region remains basically unchanged, ensuring that the brightness extracted from the initial exposed tongue image and the stabilized tongue image after exposure is statistically strictly homologous. It should be noted that morphological erosion is a well-known technique and will not be elaborated here.
[0025] After the above translational alignment and morphological erosion alignment, a final tongue region mask is obtained. Using this final tongue region mask, the exposed tongue image is extracted from the initial exposed tongue image during exposure, and the stable tongue image is extracted from the initial stable tongue image after exposure. The exposed tongue image and the stable tongue image only contain the tongue region. The above morphological alignment operation is only used to define the sampling area of the statistical histogram and does not perform pixel-level spatial point-to-point mapping between the two frames, which can provide reliable input data for subsequent calculation and analysis processes.
[0026] Step S102: Perform truncation screening in the brightness levels of the exposed tongue image to obtain a truncated tongue image; determine the original brightness distribution curve based on the brightness distribution of the truncated tongue image; determine the stable brightness distribution curve based on the brightness distribution of the stable tongue image.
[0027] The exposed tongue image is acquired during exposure and may contain overexposed areas. The brightness level of the pixels in these overexposed areas represents the area where the sensor is physically saturated, meaning that the sensor's analog-to-digital converter (ADC) has reached its quantization limit. At this point, the brightness signal output by the sensor is no longer a valid linear response signal. Using the brightness level of these overexposed pixels will reduce the accuracy of subsequent analysis results. Therefore, it is necessary to truncate and filter the exposed tongue image to determine a truncated tongue image that can eliminate abnormal brightness levels caused by sensor overexposure.
[0028] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the truncated tongue image includes: In the exposed tongue image, all brightness levels greater than the preset truncation threshold are used as the filter brightness levels; all pixels whose corresponding brightness belongs to the filter brightness level are removed to determine the truncated tongue image.
[0029] Abnormal brightness caused by sensor overexposure manifests as extremely high brightness levels, meaning that pixels in the overexposed area all output a maximum brightness in the sensor. Therefore, a cutoff threshold needs to be preset to remove all brightness levels greater than the preset cutoff threshold. The remaining brightness levels are the effective original brightness of the pixels in the unexposed area. This can completely isolate the erroneous information that was originally converted into a maximum value due to sensor saturation, so that all subsequent calculations and analyses are based on a true, effective, and continuous response signal.
[0030] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the preset truncation threshold includes: Sort all brightness levels in the exposed tongue image from smallest to largest to determine the exposure brightness level sequence; use the brightness level at the 90th percentile position in the exposure brightness level sequence as the preset truncation threshold.
[0031] The 90th percentile was chosen as the preset cutoff threshold because the brightness distribution of the red channel of the tongue has a clear statistical boundary in terms of physiology and imaging physics: about 90% of the pixels in the tongue region are real, unsaturated linear response signals (tongue body + tongue coating + normal blood vessels), while the highest 10% of brightness pixels are mainly composed of two types of non-ideal signals: sensor saturation cutoff data (false peak at brightness 255) and extreme high-brightness areas such as saliva reflection and puncture tips; therefore, using the 90th percentile as the threshold can achieve the best balance between maximizing the preservation of effective linear signals and completely eliminating saturation artifacts.
[0032] It should be noted that there is no need to truncate or filter the stable tongue image. This is because the stable tongue image is acquired after exposure, and there are no overexposed areas in the tongue image at this time. Therefore, the stable brightness level of all pixels in the stable tongue image can represent the effective response output of the sensor.
[0033] On the one hand, the limited number of pixels in both the truncated and stable tongue images results in a limited number of brightness levels. Specifically, the brightness levels in the truncated (stable) tongue image may not include all brightness levels within the range [0, 255], making it impossible to fully analyze the corresponding brightness level in the truncated tongue image for each brightness level in the stable image. On the other hand, the brightness levels in the truncated (stable) tongue image are discrete and discontinuous. Histogram analysis of these discrete brightness levels produces jagged noise, and discrete histograms cannot be finely differentiated. Therefore, based on the brightness distribution of the truncated tongue image, an original brightness distribution curve can be determined, and based on the brightness distribution of the stable tongue image, a stable brightness distribution curve can be determined. Both curves include every brightness level within the range, and both curves remain continuous, effectively solving the problems of brightness level gaps and discrete brightness caused by limited samples.
[0034] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the original brightness distribution curve includes: Using all brightness levels in the truncated tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference original brightness distribution curve; the reference original brightness distribution curve is then standardized to obtain the original brightness distribution curve.
[0035] The brightness level distribution of the tongue is essentially a continuous and smooth physical signal, while the brightness level in the truncated tongue image is a discrete and finite sample. Using a preset smoothing kernel function for probability density estimation can achieve the best balance between respecting the real data distribution and suppressing discrete holes, effectively restoring the reference original brightness distribution curve that conforms to physical reality.
[0036] In one specific implementation of this invention, a Gaussian kernel function is used to construct a reference original brightness distribution curve, specifically by using each brightness level within the brightness range as an independent variable. ( For each brightness level within the domain The brightness distribution value is calculated using the Gaussian kernel function: in, This represents the brightness distribution value corresponding to brightness level v on the original reference brightness distribution curve; N represents the number of original brightness levels truncated in the truncated tongue image. This represents the k-th original brightness value (i.e., brightness level) of the truncated tongue image. `pi` represents the mathematical constant π; `exp()` represents an exponential function with the natural constant as the base; `h` represents the bandwidth parameter, set to 2. The bandwidth parameter determines the smoothness of the curve. Values that are too large (e.g.) The curve will become too smooth, causing the bimodal features to merge and resulting in the loss of texture detail distribution information. Values that are too small (e.g.) The curve will retain a lot of random sampling noise, which will cause jitter in subsequent matching. The value of 2 is an engineering balance between preserving distribution characteristics and suppressing noise.
[0037] In conventional calculations, the integral area of the probability density function (i.e., the original brightness distribution curve) is usually normalized to 1. However, because a large amount of overexposed data (which should have been distributed in the bright areas) is removed from the truncated tongue image, the probability density of the remaining data is numerically amplified (because the denominator N becomes smaller). In contrast, overexposed data is not removed from the stable tongue image, so the amplitude of the reference original brightness distribution curve will be larger. This overall deviation in amplitude will lead to significant deviations in subsequent analysis. Therefore, it is necessary to standardize the reference original brightness distribution curve to obtain an original brightness distribution curve that can eliminate the amplitude deviation caused by the difference in sample size (the reduction of N due to the removal of overexposed data).
[0038] In one specific implementation of this invention, the standardization process is as follows: Obtain the maximum value on the reference original luminance distribution curve, and divide each value on the reference original luminance distribution curve by the maximum value to determine the original luminance distribution curve.
[0039] The maximum value on the original brightness distribution curve represents the most significant and stable morphological feature of the curve. Standardization based on the peak value (i.e. the maximum value) can unify the amplitude scale of the curve with minimal information loss while preserving the waveform shape, so that subsequent calculations are no longer misled by the magnitude of the absolute probability value.
[0040] Through the above standardization process, the system eliminates the overall amplitude impact caused by differences in the total number of samples and data truncation. At this point, the original brightness distribution curve is distributed on the vertical axis. Within the interval, subsequent calculations and analyses will only focus on the waveform profile of the curve (such as the position and relative shape of the peaks and troughs), and will no longer be affected by the magnitude of the absolute probability values. This allows the distribution pattern of the remaining 70% of the data to be accurately matched even if the original data is truncated by more than 30%.
[0041] Preferably, in some possible implementations of the embodiments of the present invention, the method for obtaining the stable brightness distribution curve includes: Using all brightness levels in the stable tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference stable brightness distribution curve; the reference stable brightness distribution curve is then standardized to determine the stable brightness distribution curve.
[0042] The brightness distribution of the red channel (R channel) of the tongue is essentially a continuous and smooth physical signal, while the brightness levels in the stable tongue image are discrete and finite samples. Using a preset smoothing kernel function for probability density estimation can achieve the best balance between respecting the real data distribution and suppressing discrete holes, effectively recovering the reference stable brightness distribution curve that conforms to physical reality. Based on the calculation principle of the original brightness distribution curve, the stable brightness distribution curve can be obtained by simply replacing the truncated tongue image with the stable tongue image, replacing the reference original brightness distribution curve with the reference stable brightness distribution curve, and repeating the method for obtaining the original brightness distribution curve.
[0043] Step S103: Construct a morphological difference measurement matrix based on the luminance distribution offset between the original luminance distribution curve and the stable luminance distribution curve; perform optimization based on the element value distribution of the morphological difference measurement matrix to determine all original curve luminances that match the luminance of each stable curve in the stable luminance distribution curve in the original luminance distribution curve; construct a luminance mapping function based on the stable curve luminance and its matching original curve luminance.
[0044] The brightness distribution shift between the original brightness distribution curve and the stable brightness distribution curve represents the distribution similarity between the brightness of each original curve in the original brightness distribution curve and the brightness of each stable curve in the stable brightness distribution curve. The smaller the brightness distribution shift, the higher the distribution similarity between the brightness of the original curve in the original brightness distribution curve and the brightness of the stable curve in the stable brightness distribution curve. That is, the more likely the brightness level in the stable tongue image is to be reverse-recovered to the corresponding brightness level in the truncated tongue image. Conversely, the more severe the brightness distribution shift, the lower the distribution similarity between the brightness of the original curve in the original brightness distribution curve and the brightness of the stable curve in the stable brightness distribution curve. That is, the less likely the brightness level in the stable tongue image is to be reverse-recovered to the corresponding brightness level in the truncated tongue image. Therefore, by constructing a morphological difference metric matrix, the distribution similarity between any brightness value in the stable tongue image and any brightness value in the truncated tongue image can be accurately quantified.
[0045] Preferably, in some possible implementations of the embodiments of the present invention, the method for constructing the morphological difference measurement matrix includes: A morphological difference measurement matrix is constructed, wherein the rows of the morphological difference measurement matrix represent the brightness of each stable curve in the stable brightness distribution curve, and the columns of the morphological difference measurement matrix represent the brightness of each original curve in the original brightness distribution curve; each element in the morphological difference measurement matrix is the absolute value of the difference between the value of the stable curve brightness in the corresponding row of the stable brightness distribution curve on the stable brightness distribution curve and the value of the original curve brightness in the corresponding column of the original brightness distribution curve on the original brightness distribution curve.
[0046] Both the stable brightness distribution curve and the original brightness distribution curve are obtained by estimating the brightness levels of the stable tongue image and the truncated tongue image using the probability density of the Gaussian kernel function. Therefore, the range of the independent variables of the two curves (i.e., the range of the brightness of the stable curve and the range of the original curve) are [0, 255]. By constructing a morphological difference metric matrix using the brightness of the stable curve and the brightness of the original curve that include all brightness levels, we can intuitively compare the distribution similarity between each brightness of the stable curve and each brightness of the original curve in the entire brightness level range, ensuring the completeness and global optimality of the subsequent brightness mapping relationship solution.
[0047] The absolute value of the difference between the stable curve brightness value on the stable brightness distribution curve and the original curve brightness value on the original brightness distribution curve clearly and intuitively reflects the distribution similarity between any brightness level in the stable tongue image and any brightness level in the truncated tongue image. The smaller the absolute value of this difference, the closer the probability density of the stable curve brightness (i.e., the value on the stable brightness curve) is to the probability density of the original curve brightness, and there is a potential correspondence between the two. This means that although the imaging system has undergone nonlinear compression by ISP, the stable curve brightness still retains the distribution traces of its original response characteristics in terms of statistical features. Therefore, the stable curve brightness is more likely to form a real mapping relationship with the corresponding brightness level in the truncated tongue image (i.e., the original curve brightness) at the physical level. That is, the stable curve brightness is a credible candidate point mapped from the original curve brightness after ISP compression.
[0048] It should be noted that since the independent variable ranges of both curves (i.e., the range of brightness of the stable curve and the range of the original curve) are both [0, 255], the size of the morphological difference measurement matrix is [0, 255]. Furthermore, the brightness of the stable curve corresponding to each row of the morphological difference measurement matrix increases from 0 to 255 from top to bottom, and the brightness of the original curve corresponding to each column of the morphological difference measurement matrix increases from 0 to 255 from left to right.
[0049] After constructing the morphological difference measurement matrix, it can be seen that each element in the morphological difference measurement matrix is the absolute value of the difference between the value of the stable curve brightness in the corresponding row on the stable brightness distribution curve and the value of the original curve brightness in the corresponding column on the original brightness distribution curve. The smaller the absolute value of the difference, the more likely there is a potential correspondence between the stable curve brightness (i.e., the brightness in the stable tongue image) and the corresponding original curve brightness (the brightness corresponding to the truncated tongue image). Therefore, it is necessary to analyze the distribution of the element values of the morphological difference measurement matrix and match the stable curve brightness and the original curve brightness corresponding to the element with the smaller element value. This can screen out the brightness matching candidate points with the most similar statistical distribution and the most reliable physical correspondence from the global range, laying the foundation for the subsequent construction of a complete, continuous and physically realistic brightness mapping from the stable tongue image to the truncated tongue image.
[0050] Preferably, the process of determining the brightness of each stable curve in the stable brightness distribution curve that matches the brightness of all original curves in the original brightness distribution curve includes: The element at the top left corner of the morphological difference measurement matrix is taken as the starting point for optimization. In the morphological difference measurement matrix, each column of the morphological difference measurement matrix is taken as the endpoint column, and the last row of the morphological difference measurement matrix is taken as the endpoint row. Based on the endpoint row and each endpoint column, each optimization reference endpoint is determined. Using the morphological difference metric matrix as input, a dynamic time warping algorithm is employed to perform optimization between the optimization starting point and each optimization reference endpoint to determine the global optimal path; based on the global optimal path, all original curve brightnesses that match the brightness of each stable curve in the stable brightness distribution curve in the original brightness distribution curve are determined.
[0051] In physical optical imaging, there exists a physical law that black corresponds to black: that is, areas in a scene that do not reflect light at all (brightness 0) will always have a brightness of 0 in the imaging result, regardless of whether they are compressed by ISP. This constraint provides a unique and definite starting point for dynamic time warping search, fundamentally ensuring that the mapping function obtained by subsequent inverse solution conforms to the basic physical laws and avoiding global offsets without any theoretical significance.
[0052] Because the truncated tongue image contains truncated highlight data due to sensor saturation, meaning the brightness value is forcibly clamped to the 90th percentile brightness level, while the actual physical light intensity may be much higher than the sensor saturation threshold, if the forced optimization endpoint is the lower right corner of the morphological difference metric matrix (i.e., the endpoint of the standard dynamic time warping algorithm is the lower right corner of the matrix), i.e., (255, 255), it is equivalent to arbitrarily assuming that the steady-state highlight necessarily corresponds to the original highlight. This does not conform to the physical fact of sensor saturation and will lead to a serious underestimation of the ISP highlight compression rate, causing the color correction of key pathological features such as red tongue and punctures to significantly fail. Therefore, this embodiment of the invention adopts relaxed endpoint constraints, that is, in the last row of the difference metric matrix, the system is allowed to autonomously search for the column corresponding to the global minimum cumulative cost as the path endpoint. That is, all the element positions in the last row are used as optimization reference endpoints in turn, and the column corresponding to the minimum global cumulative cost can be found among all the global cumulative costs. In other words, the data adaptively finds the brightest area in the stable tongue image and determines to which brightness level it is truncated in the truncated tongue image.
[0053] In a specific implementation of this invention, the method for obtaining the original curve brightness matching each stable curve brightness using the dynamic time warping algorithm is as follows: The system constructs a cumulative cost matrix D to search for the globally optimal path (each path point in the globally optimal path represents the stable curve brightness of the corresponding row and all the original curve brightnesses of its corresponding column). Based on the physical monotonicity of the photoelectric response (i.e., as the input light intensity increases, the output gray value should not decrease), the path can only extend to the right, down, or down to the right (i.e., optimization can only be performed to the right, down, or down to the right from the optimization starting point to the optimization ending point). The recursive formula is: ,in, This represents the cost in the i-th row and j-th column of the cumulative cost matrix; This represents the value of the element in the i-th row and j-th column of the morphological difference measurement matrix; This represents the cost in the (i-1)th row and jth column of the cumulative cost matrix; This represents the cost in the i-th row and j-1-th column of the cumulative cost matrix; This represents the cost in the (i-1)th row and (j-1)th column of the cumulative cost matrix; This term represents finding the minimum cost at the three positions. The aim is to select the node with the minimum cumulative cost from all legal predecessor nodes that can reach the current position (i,j) as the next step in the path, thus ensuring that the cumulative cost of the entire path from the optimization starting point (0,0) to any node (i,j) is globally minimized. Finally, by traversing the entire morphological difference metric matrix, each globally optimal reference path and its corresponding globally cumulative cost between the optimization starting point and each optimization reference endpoint can be obtained. The system selects the globally optimal reference path with the minimum globally cumulative cost as the globally optimal path. The globally optimal path includes the brightness of each stable curve and its matching original curve brightness. The above recursive formula is the recursive formula in the dynamic time warping algorithm, and no further elaboration or limitation is needed here.
[0054] The brightness of each stable curve and its matching original curve brightness may be discrete and non-uniform. Therefore, in order to facilitate subsequent calculations, it is necessary to transform them into continuous functions, that is, to construct a brightness mapping function.
[0055] Preferably, in some possible implementations of the embodiments of the present invention, the method for constructing the luminance mapping function includes: The optimal reference endpoint corresponding to the globally optimal path is taken as the optimization endpoint. Within the original curve brightness range covered between the optimization start point and the optimization endpoint, the stable curve brightness is taken as the independent variable, and the mean of all original curve brightness that matches the stable curve brightness is taken as the dependent variable. A reference brightness mapping function is constructed using cubic spline interpolation. The cubic spline interpolation method is a technique well known to those skilled in the art, and there is no need to elaborate or limit it here.
[0056] Outside the original curve brightness range covered between the optimization start point and optimization end point, calculate the terminal slope of the reference brightness mapping function, and linearly extend the terminal of the reference brightness mapping function along the direction of the terminal slope to determine the brightness mapping function.
[0057] It should be noted that the globally optimal path obtained above includes the brightness of each stable curve and its matching original curve brightness. The brightness value range of each stable curve is [0, 255]. This is because the optimization starting point is in the first row of the morphological difference metric matrix and the optimization ending point is in the last row of the morphological difference metric matrix. Therefore, the stable curve brightness interval between the optimization starting point and the optimization ending point covers the entire brightness level. However, for the original curve brightness matching each stable curve brightness, since the optimization ending point is obtained by traversing and comparing each element position of the last row as the optimization reference ending point, the optimization ending point may not be in the lower right corner of the morphological difference metric matrix. Therefore, the original curve brightness interval between the optimization starting point and the optimization ending point may not cover the entire brightness level from 0 to 255. This embodiment of the invention takes into account these two situations and therefore performs segmented processing when constructing the brightness mapping function. Specifically, in one specific implementation of this invention, firstly, for the original curve brightness range covered between the optimization start point and the optimization end point, the system uses the stable curve brightness as the independent variable and the mean of all original curve brightness matching the stable curve brightness as the dependent variable. Cubic spline interpolation (PCHIP) is used to generate a continuous function, denoted as the reference brightness mapping function. The interpolation method is preset to be monotonic, avoiding the use of ordinary polynomial fitting, aiming to prevent oscillations or reversals in the function curve, i.e., avoiding the physical fallacy that increasing brightness leads to a decrease in the mapping value. It should be noted that after optimization using the dynamic time warping algorithm, each stable curve brightness may correspond to multiple original curve brightnesses. In this case, curve fitting is not possible; therefore, the mean of all original curve brightness matching the stable curve brightness is used as the reference brightness mapping function. The dependent variable can transform multi-valued mapping relationships into single-valued mapping relationships, while preserving the overall trend of the original curve brightness in a statistical sense. Then, for the original curve brightness interval covered between the optimization start point and optimization end point, the system calculates the terminal slope of the reference brightness mapping function, and linearly extends the terminal of the reference brightness mapping function along the direction of the terminal slope until the original curve brightness reaches 255. The reference brightness mapping function and the line segment generated by the linear extension along the direction of the terminal slope are combined to jointly determine a brightness mapping function. The reason why the terminal of the reference brightness mapping function can be linearly extended along the direction of the terminal slope is that in the extremely bright region, the compression curve of the ISP usually tends to be flat or linearly saturated, which means that the derivative of the brightness mapping function in this region (i.e., the terminal slope) tends to be a stable constant, so it can be linearly extended.
[0058] Through the above construction steps, the system obtains a monotonically increasing function (i.e., the brightness mapping function) with a domain of [0, 255]. This function precisely describes the linear response value that each pixel brightness should present if the ISP does not perform dynamic range compression.
[0059] Step S104: Determine the gain coefficient corresponding to each brightness level based on the brightness change of the brightness mapping function, and use the gain coefficient to perform color correction for visual image acquisition.
[0060] The brightness variation of the brightness mapping function reflects the degree of compression of the brightness of the truncated tongue image by the ISP. The greater the brightness variation of the brightness mapping function, the greater the degree of compression of the brightness of the truncated tongue image by the ISP. In this case, a larger restoration gain needs to be applied to the pixel brightness. Conversely, the smaller the brightness variation of the brightness mapping function, the smaller the degree of compression of the brightness of the truncated tongue image by the ISP. In this case, a smaller restoration gain needs to be applied to the pixel brightness.
[0061] Preferably, in some possible implementations of the embodiments of the present invention, the method for determining the gain coefficient corresponding to each brightness level includes: If the brightness level is greater than the preset brightness threshold, then the positive integer 1 will be used as the gain coefficient corresponding to the brightness level. If the brightness level is less than or equal to the preset brightness threshold, the function value of the brightness mapping function at that brightness level is used as the numerator, and the sum of the corresponding brightness level and the preset minimum constant is used as the denominator. The gain coefficient corresponding to the brightness level is calculated by ratio operation.
[0062] Saliva is present in the target's mouth, and its reflection is usually a very bright white. If the red channel is boosted on the saliva reflection area, the reflection area will turn red, resulting in a seriously misleading false color. Therefore, it is necessary to set a preset brightness threshold (e.g., 230) to identify areas with a brightness level greater than the preset brightness threshold as high reflectivity areas (i.e., saliva reflection areas), and areas with a brightness level less than or equal to the preset brightness threshold as non-high reflectivity areas (i.e., areas to be boosted). This is beneficial to improving the accuracy and reliability of subsequent color correction using gain coefficients.
[0063] It should be noted that in this embodiment of the invention, when the brightness level is greater than a preset brightness threshold, it indicates that the pixel is in a high reflectivity area. To protect the white balance, a positive integer 1 is used as the gain coefficient corresponding to the brightness level, indicating that no gain recovery is needed and the original brightness can be maintained. When the brightness level is less than or equal to the preset brightness threshold, the function value of the brightness mapping function at that brightness level is used as the numerator, and the sum of the corresponding brightness level and the preset minimum constant is used as the denominator. The gain coefficient corresponding to the brightness level is calculated by ratio operation. This is because the brightness mapping function is a singly increasing function, and its ratio operation result is greater than or equal to 0. Adding a preset minimum constant is intended to prevent the brightness level from being 0. The larger the ratio operation result, the greater the brightness change of the brightness mapping function, and the greater the compression degree of the ISP on the brightness of the truncated tongue image. Therefore, a larger gain coefficient needs to be set for the pixel brightness. Conversely, the smaller the ratio operation result, the smaller the brightness change of the brightness mapping function, and the smaller the compression degree of the ISP on the brightness of the truncated tongue image. In this case, a smaller gain coefficient needs to be set for the pixel brightness.
[0064] In step S101, it is explained that the contrast of the high-saturation area of the stable tongue image will decrease, resulting in the loss of details in the tongue image. Furthermore, there are a large number of overexposed areas in the truncated tongue image. Therefore, it is necessary to reverse-engineer the color details of the stable tongue image based on the stable tongue image, so as to obtain a visual diagnosis image with high detail and achieve color correction.
[0065] Preferably, in some possible implementations of the embodiments of the present invention, the process of color correction for visual image acquisition includes: Obtain the R component value of each pixel in the stable tongue image in the RGB space corresponding to the R channel; use the gain coefficient of the brightness level corresponding to the R component value as the corresponding pixel gain; The product of the R component value and the corresponding pixel gain of each pixel in the stable tongue image is rounded down to determine the reference R component value; the minimum value between the reference R component value and the preset R component threshold is taken as the corrected R component value; the corrected R component value of each pixel is combined with the G channel and B channel of the corresponding pixel to determine the color-corrected visual image.
[0066] Because the key pathological features of tongue diagnosis (such as red tongue, prickles, ecchymosis, and sublingual veins) are encoded in the high-saturation details of the red channel (R channel), and the specular highlight suppression and tone mapping algorithm of ISP mainly compresses the dynamic range of the red channel; the green and blue channels carry very little information for tongue diagnosis, and their relative linear relationship is basically intact. Therefore, when using gain coefficients to perform color correction on stable tongue images, the green channel (G channel) and blue channel (B channel) are left unchanged, and only the R component value of the red channel (R channel) is corrected. This can preserve the correct white balance of the original shot and avoid introducing unnecessary false colors and noise.
[0067] Since the R-component values in digital images must be integers (integers between 0 and 255), and multiplication operations produce decimals, the integer part of the product between the R-component value of each pixel in the stable tongue image and the corresponding gain coefficient is taken as the reference R-component value to avoid introducing systematic bias. Furthermore, the reason for using the integer part instead of rounding in this embodiment is that rounding introduces a +0.5 offset to the tongue diagnosis image, which may lead to a red tongue being misjudged as a red tongue or a red tongue being misjudged as a pale red tongue, resulting in unnecessary errors. It should be noted that... Multiplying the R component value of each pixel with the corresponding gain coefficient may cause the product to exceed the upper limit of the pixel value range (i.e., [0, 255]). Therefore, a preset R component threshold of 255 is used. The reference R component value is compared with the preset R component threshold, and the minimum value is taken as the final corrected R component value of the red light channel. This can prevent pixel value overflow, data truncation errors, and visual artifacts such as white spots or color block breaks in the highlight area of the image caused by the corrected R component value exceeding the upper limit of the dynamic range of 8-bit image (255). This effectively improves the accuracy of color correction.
[0068] Finally, the corrected R component value of each pixel is merged with the corresponding G and B channels to obtain a color-corrected visual image. This visual image accurately recovers the color details of the tongue from the ISP algorithm compressed image by directionally restoring the color contrast of key pathological features of tongue diagnosis.
[0069] In summary: First, this invention acquires tongue images during and after exposure, enabling the identification of the core carriers of pathological information in visual diagnosis from the source, providing a low-dynamic compression data foundation with minimal ISP dynamic range compression for subsequent analysis. Second, it analyzes the brightness distribution of the tongue images during and after exposure, determining the brightness distribution curves, which can intuitively quantify the brightness distribution morphology of the tongue region under low-dynamic compression response and ISP compression response. Then, by comparing the offsets of the brightness distribution curves during and after exposure, the mapping relationship between each post-exposure brightness and the corresponding pre-exposure brightness is analyzed, enabling the reconstruction of a full-domain continuous mapping curve from steady-state brightness to original brightness using two frames without increasing hardware. Finally, by acquiring the gain coefficient and implementing a targeted enhancement strategy, while ensuring the overall white balance and clarity of the image, the contrast of key pathological features in the visual diagnosis image is significantly improved, accurately restoring the color details of the tongue in the visual diagnosis image.
[0070] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0071] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for color correction in visual diagnosis image acquisition, characterized in that, The method includes: Retrieve the exposed tongue image and the stable tongue image after exposure from the oral medical database; The brightness levels of the exposed tongue image are truncated to obtain a truncated tongue image; the original brightness distribution curve is determined based on the brightness distribution of the truncated tongue image; and the stable brightness distribution curve is determined based on the brightness distribution of the stable tongue image. Based on the brightness distribution offset between the original brightness distribution curve and the stable brightness distribution curve, a morphological difference measurement matrix is constructed; based on the element value distribution of the morphological difference measurement matrix, optimization is performed to determine all original curve brightnesses that match the brightness of each stable curve in the stable brightness distribution curve in the original brightness distribution curve; based on the stable curve brightness and its matching original curve brightness, a brightness mapping function is constructed. Based on the brightness variation of the brightness mapping function, the gain coefficient corresponding to each brightness level is determined, and the gain coefficient is used for color correction of visual image acquisition.
2. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The method for obtaining the truncated tongue image includes: In the exposed tongue image, all brightness levels greater than the preset truncation threshold are used as the filter brightness levels; all pixels whose corresponding brightness belongs to the filter brightness level are removed to determine the truncated tongue image.
3. The color correction method for visual diagnosis image acquisition according to claim 2, characterized in that, The method for obtaining the preset truncation threshold includes: Sort all brightness levels in the exposed tongue image from smallest to largest to determine the exposure brightness level sequence; use the brightness level at the 90th percentile position in the exposure brightness level sequence as the preset truncation threshold.
4. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The method for obtaining the original brightness distribution curve includes: Using all brightness levels in the truncated tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference original brightness distribution curve; the reference original brightness distribution curve is then standardized to obtain the original brightness distribution curve.
5. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The method for obtaining the stable brightness distribution curve includes: Using all brightness levels in the stable tongue image as input, a preset smoothing kernel function is used to estimate the probability density and determine the reference stable brightness distribution curve; the reference stable brightness distribution curve is then standardized to determine the stable brightness distribution curve.
6. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The method for constructing the morphological difference measurement matrix includes: A morphological difference measurement matrix is constructed, wherein the rows of the morphological difference measurement matrix represent the brightness of each stable curve in the stable brightness distribution curve, and the columns of the morphological difference measurement matrix represent the brightness of each original curve in the original brightness distribution curve; each element in the morphological difference measurement matrix is the absolute value of the difference between the value of the stable curve brightness in the corresponding row of the stable brightness distribution curve on the stable brightness distribution curve and the value of the original curve brightness in the corresponding column of the original brightness distribution curve on the original brightness distribution curve.
7. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The process of determining the brightness of each stable luminance distribution curve in the stable luminance distribution curve and matching the brightness of all original curves in the original luminance distribution curve includes: The element at the top left corner of the morphological difference measurement matrix is taken as the starting point for optimization. In the morphological difference measurement matrix, each column of the morphological difference measurement matrix is taken as the endpoint column, and the last row of the morphological difference measurement matrix is taken as the endpoint row. Based on the endpoint row and each endpoint column, each optimization reference endpoint is determined. Using the morphological difference metric matrix as input, a dynamic time warping algorithm is employed to perform optimization between the optimization starting point and each optimization reference endpoint to determine the global optimal path; based on the global optimal path, all original curve brightnesses that match the brightness of each stable curve in the stable brightness distribution curve in the original brightness distribution curve are determined.
8. The color correction method for visual diagnosis image acquisition according to claim 7, characterized in that, The method for constructing the luminance mapping function includes: The optimal reference endpoint corresponding to the global optimal path is taken as the optimization endpoint; within the original curve brightness range covered between the optimization start point and the optimization endpoint, the stable curve brightness is taken as the independent variable, and the mean of all original curve brightness that matches the stable curve brightness is taken as the dependent variable. The reference brightness mapping function is constructed by cubic spline interpolation. Outside the original curve brightness range covered between the optimization start point and optimization end point, calculate the terminal slope of the reference brightness mapping function, and linearly extend the terminal of the reference brightness mapping function along the direction of the terminal slope to determine the brightness mapping function.
9. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The method for determining the gain coefficient corresponding to each brightness level includes: If the brightness level is greater than the preset brightness threshold, then the positive integer 1 will be used as the gain coefficient corresponding to the brightness level. If the brightness level is less than or equal to the preset brightness threshold, the function value of the brightness mapping function at that brightness level is used as the numerator, and the sum of the corresponding brightness level and the preset minimum constant is used as the denominator. The gain coefficient corresponding to the brightness level is calculated by ratio operation.
10. The color correction method for visual diagnosis image acquisition according to claim 1, characterized in that, The process of color correction for visual diagnosis image acquisition includes: Obtain the R component value of each pixel in the stable tongue image in the RGB space corresponding to the R channel; use the gain coefficient of the brightness level corresponding to the R component value as the corresponding pixel gain; The product of the R component value and the corresponding pixel gain of each pixel in the stable tongue image is rounded down to determine the reference R component value; the minimum value between the reference R component value and the preset R component threshold is taken as the corrected R component value; the corrected R component value of each pixel is combined with the G channel and B channel of the corresponding pixel to determine the color-corrected visual image.