Colorimetric card for traditional Chinese medicine lingual surface image acquisition and color correction method thereof
By designing a colorimetric card with functional partitions and a non-linear mapping relationship, the problem of inconsistent color reproduction capabilities in tongue image acquisition was solved, achieving accuracy and standardization in the digital diagnosis of the tongue body and tongue coating, and supporting digital diagnosis in traditional Chinese medicine.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING UNIV OF CHINESE MEDICINE
- Filing Date
- 2026-03-06
- Publication Date
- 2026-04-17
AI Technical Summary
The color reproduction capabilities of tongue images acquired under different acquisition devices and environments vary, resulting in significant color differences in the images. This affects the accuracy of digital diagnosis in traditional Chinese medicine tongue diagnosis, and traditional color charts cannot meet the color requirements of traditional Chinese medicine tongue diagnosis.
Design a colorimetric card for acquiring tongue surface images in Traditional Chinese Medicine, which includes grayscale areas, tongue body color areas, tongue coating color areas, and facial color areas. Through functional partitioning color block arrays and color correction methods, establish a nonlinear mapping relationship to achieve standardized correction of tongue body, tongue coating, and facial colors.
It achieves brightness consistency and color accuracy of tongue surface images under different lighting conditions, improves the accuracy of digital diagnosis of tongue body and tongue coating, and supports the standardization and reliability of TCM digital diagnosis.
Smart Images

Figure CN121867759A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of colorimetric card technology, and more specifically, to a colorimetric card design for acquiring images of the tongue surface in Traditional Chinese Medicine and its color correction method. Background Technology
[0002] In traditional Chinese medicine (TCM) tongue diagnosis, physicians primarily rely on visual observation of the tongue body, tongue coating, sublingual veins, and facial complexion to assess the condition. However, this method is heavily influenced by the physician's subjective experience, ambient lighting, and observation angle, making it difficult to standardize and quantify diagnoses. With the development of digital healthcare, more and more scenarios are attempting to record tongue information using image acquisition devices for remote diagnosis, case archiving, or intelligent analysis. However, this process faces significant technical bottlenecks. Different acquisition devices exhibit varying color reproduction capabilities, and different lighting conditions (such as indoor lighting and natural light) lead to color casts and uneven brightness in images. This results in significant color differences in images of the same tongue acquired under different devices or in different scenarios, failing to accurately reproduce the true characteristics of the tongue body, tongue coating, sublingual veins, and facial color, thus affecting the accuracy of subsequent digital diagnoses. Furthermore, tongue diagnostic instruments, due to their high cost, large size, and fixed applicable environments, require specific patient positioning and operating space, limiting their applicability in flexible scenarios such as primary healthcare institutions, community health service centers, bedside care, and home health management.
[0003] Furthermore, traditional universal color charts are mostly designed for fields such as photography and printing. Their color block layout and color parameters do not meet the needs of traditional Chinese medicine tongue diagnosis. They cannot cover the specific color range for tongue diagnosis, from pale white to purple tongues and from white coating to black coating. They also lack a correction benchmark adapted to the facial skin tone of East Asian people, and it is difficult to provide the brightness reference required for tongue surface images. These problems have made it difficult to establish a unified color standard for the digital acquisition of tongue surface images. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the present invention aims to provide a colorimetric card for acquiring images of the tongue surface in Traditional Chinese Medicine and a method for color correction thereof.
[0005] To achieve the above objectives, the present invention provides the following technical solution: A colorimetric chart for acquiring images of the tongue surface in Traditional Chinese Medicine includes an array of color blocks divided by function, wherein the color block array includes at least: A grayscale area, which consists of multiple neutral gray blocks, is used to provide a brightness correction reference. The tongue body color zone consists of multiple color blocks that simulate different tongue body colors, and its color parameters cover the diagnostic color range from pale white tongue to purple tongue. The tongue coating color zone consists of multiple color blocks that simulate different tongue coating colors, and its color parameters cover the diagnostic color range from white coating to black coating. Facial color zones, which consist of multiple color blocks simulating different facial skin tones, are used to provide a baseline for facial color correction.
[0006] Preferably, it also includes a reference area, which consists of multiple color blocks located at the color gamut boundary or having a special hue, used to provide boundary constraints and verification benchmarks for the color correction model.
[0007] A color correction method for acquiring images of the tongue surface in Traditional Chinese Medicine, the method comprising the following steps: Acquire original images containing the patient's tongue surface and a zoned standard colorimetric chart; wherein the zoned standard colorimetric chart includes at least a grayscale area, a tongue body color area, a tongue coating color area, and a facial color area; The color patch regions of the color chart are identified and located in the original image, and the measured color values of each color patch region are extracted. Semantic segmentation is performed on the original image to obtain mask regions; wherein, the mask regions include tongue region mask, tongue coating region mask and face region mask; Based on the measured color values of each color block region and the pre-stored standard color values, a nonlinear mapping relationship from the measured color space to the standard color space is established for the tongue body color area, the tongue coating color area, and the facial color area, respectively. By iterating through each pixel of the original image and applying the corresponding non-linear mapping relationship according to the mask region to correct the color value of the pixel, a color-corrected tongue image is obtained.
[0008] Preferably, identifying and locating the color patch regions of the colorimetric card in the original image specifically includes the following steps: The YOLO object detection model is used to locate the color chart of the original image to obtain the bounding rectangle of the color chart; Corner detection is performed within the bounding rectangle area, and geometric correction is performed by comparing the color chart with perspective transformation to obtain the front-view color chart image; The color chart image viewed from the front is divided into color block areas for each function area according to a preset grid array.
[0009] Preferably, the mask region is obtained by semantic segmentation of the original image, specifically as follows: The semantic segmentation network model extracts multi-scale contextual information through the hollow spatial pyramid pooling module to obtain the mask region.
[0010] Preferably, the nonlinear mapping relationship is established through a second-order polynomial regression model, and the mapping relationship for any color patch region and color channel k is as follows: ; in: These are the measured channel values extracted from the image; These are the calibrated standard channel values; This is the intercept term, used to correct for the basis offset; This is a linear coefficient used to correct the gain ratio; These are the coefficients of the quadratic term, used to correct the nonlinear Gamma response and nonlinear color shift; For residuals; The optimal coefficient vector is obtained by fitting using the least squares method. Its goal is to minimize the sum of squared residuals. : ; Where N is the number of color patches participating in the fitting of the color patch region, and i is the index of the color patch.
[0011] Preferably, after obtaining the color-corrected tongue surface image, boundary smoothing processing is further included, specifically: Gaussian processing is applied to the mask regions generated by semantic segmentation to obtain a weight map; For pixels located at the boundary of different mask regions, their final corrected color value is the weighted sum of the correction results of adjacent regions, calculated using the following formula: ; in, For the weight map in pixels The weight value at that location, and These are the corrected color values obtained through the mapping relationship between adjacent regions.
[0012] Preferably, the method further includes the following steps: Extract the color values of the reference area reserved on the color chart from the color-corrected tongue surface image; Calculate its average color difference with the pre-stored standard reference value. The calculation formula is as follows: ; If the average color difference does not exceed the preset threshold, output a color-corrected tongue image; If the average color difference exceeds the preset threshold, the correction is deemed to have failed.
[0013] Preferably, the measured color values of each color patch area are extracted, specifically including the following steps: The sRGB values are normalized and linearized using the following formula: in, , These are the sRGB component values normalized to [0,1]. The linear RGB values are converted to CIEXYZ values using a transformation matrix, and the calculation formula is as follows: The formula for converting CIEXYZ values to CIELab values is as follows: Nonlinear function Defined as: Obtain each color patch area on the color chart The measured color values were marked as follows. .
[0014] Preferably, the formula for calculating the LAB value of a pixel is: ; in, This represents the original channel value of the pixel. This represents the corrected channel value. , , This represents the regression coefficient for the color channel corresponding to the region to which the pixel belongs.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The grayscale area setting in this invention addresses the brightness deviation problem under different acquisition environments. It consists of multiple neutral gray blocks covering a complete brightness range from dark to light, serving as a unified brightness correction benchmark. This ensures that images acquired under different lighting conditions exhibit consistent brightness, preventing the loss of detail in the tongue and tongue coating due to overexposure or underexposure, and guaranteeing the accuracy and reliability of brightness information in the tongue image. The tongue body color area includes color blocks simulating different tongue body colors, with color parameters fully covering the diagnostic color range from pale white to purple. These color blocks correspond to the tongue body manifestations of different pathogenesis such as qi and blood deficiency, heat syndrome, and blood stasis, providing a precise reference for tongue body color correction. This ensures a high degree of consistency between the tongue body color in the digital image and the actual color characteristics of the clinical tongue appearance, helping physicians accurately determine the corresponding pathogenesis of the tongue body through digital images. The layout of the tongue coating color area aligns with the actual needs of tongue coating diagnosis. Its color blocks simulate common tongue coating colors, ranging from white to black, covering color changes in the tongue coating from normal to pathological states. It can effectively correct the distortion of tongue coating color under different devices or environments, allowing key diagnostic information such as the thickness and color depth of the tongue coating to be clearly presented in digital images, thus improving the digital accuracy of tongue coating diagnosis.
[0016] The comprehensive facial color zone configuration facilitates the collaborative reference between TCM facial and tongue diagnosis. It includes color blocks simulating different facial skin tones, serving as a benchmark for facial color correction. This ensures a consistent reference standard for facial skin tones across different patients in digital images. This allows physicians to use facial complexion to aid in assessing the overall condition and makes the contrast between tongue color and facial skin tone more consistent with the actual logic of clinical observation, enhancing the comprehensiveness and reliability of TCM digital diagnosis. The functional zoning design achieves multi-dimensional standardized correction of tongue image brightness, tongue body, tongue coating, and facial color. Attached Figure Description
[0017] Figure 1 This invention provides a schematic diagram of the structure of a colorimetric card for acquiring images of the tongue surface in traditional Chinese medicine. Figure 2 This is a schematic diagram illustrating the steps of a color correction method for acquiring traditional Chinese medicine tongue images, as provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the technical process of a color correction method for acquiring images of the tongue surface in traditional Chinese medicine, provided by an embodiment of the present invention. Detailed Implementation
[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0019] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0020] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.
[0021] Reference Figures 1-3 As shown.
[0022] The embodiments further illustrate the colorimetric card and color correction method for acquiring images of the tongue surface in traditional Chinese medicine proposed in this invention.
[0023] A colorimetric chart for acquiring images of the tongue surface in Traditional Chinese Medicine includes an array of color blocks divided by function, the color block array comprising at least: The color chart contains 24 color blocks, including 18 feature color blocks and 6 grayscale color blocks. The Lab values of these color blocks were obtained through extensive clinical image acquisition, expert interpretation and computer cluster analysis, and the colors were classified according to the five-color theory of traditional Chinese medicine (white, red, yellow, blue and black).
[0024] The grayscale area, which consists of multiple neutral gray blocks, is used to provide a brightness correction reference. The tongue body color zone consists of multiple color blocks that simulate different tongue body colors, and its color parameters cover the diagnostic color range from pale white tongue to purple tongue. The tongue coating color zone consists of multiple color blocks that simulate different tongue coating colors, and its color parameters cover the diagnostic color range from white coating to black coating. Facial color zones consist of multiple color blocks that simulate different facial skin tones, used to provide a baseline for facial color correction.
[0025] The grayscale area consists of multiple neutral gray blocks, following the human eye's perception of brightness, and can cover the complete dynamic range of the tongue image from deep shadows to highlights. The color parameters of these gray blocks are strictly controlled so that the values on the red-green axis and the yellow-blue axis are both 0, ensuring that no color cast is introduced and providing a pure brightness reference for subsequent white balance correction and exposure response adjustment. For example, in practical applications, five color blocks are set in the grayscale area, with brightness values linearly distributed from 10 to 90, corresponding to extreme shadows, shadows, mid-gray, light gray, and near-highlight references, respectively. After image acquisition, the measured brightness of these color blocks is compared with the standard brightness to fit an accurate gamma curve, correcting the brightness deviation of the image under different lighting conditions, making the brightness performance of the tongue, tongue coating, and facial areas more consistent.
[0026] The tongue color zone is designed to meet the diagnostic needs of tongue color in Traditional Chinese Medicine (TCM) tongue diagnosis. It includes multiple color blocks that simulate typical tongue color changes from pale white to purple. The color parameters of each block are derived from statistical analysis and clustering of a large amount of clinical tongue image data, optimized in conjunction with TCM observation theory. The brightness, red-green hue, and yellow-blue hue of these color blocks exhibit regular changes: brightness gradually decreases overall, red hue gradually increases, and yellow-blue hue initially increases and then decreases. This comprehensively covers the tongue color range corresponding to different pathogenesis conditions, including Qi and blood deficiency, normal tongue color, heat syndrome, excessive heat in the nutritive level, and blood stasis. During actual data acquisition, when the image contains this color chart, the measured color values of each color block in the tongue color zone are extracted and mapped to pre-stored standard values. This corrects the color of the tongue in the image, accurately reproducing the paleness of a pale tongue, the rosy hue of a red tongue, the deep red of a crimson tongue, and the stagnant feeling of a purple tongue, providing accurate color evidence for TCM diagnosis.
[0027] The tongue coating color zone focuses on the standardized correction of tongue coating color. Its color block combination is based on the results of Gaussian mixture model cluster analysis of tongue coating color, comprehensively covering clinically common tongue coating types from white to black. The color parameters of each color block are finely calibrated to accurately simulate the characteristics of white coating, light yellow coating, deep yellow coating, and dark gray-black coating, ensuring that the color differences of different tongue coating types can be clearly distinguished. After image acquisition, the color information of the tongue coating color zone is extracted to establish a tongue coating color correction model, which can effectively correct the tongue coating color distortion caused by differences in ambient light and equipment. For example, it avoids white coating from appearing too bright due to excessive light or too dark due to insufficient light, allowing key diagnostic information such as the thickness and color depth of the tongue coating to be accurately presented, helping doctors to accurately judge the condition.
[0028] The facial color zone is based on common skin tones, constructing a uniformly transitioning skin tone gradient. It contains multiple color patches covering the full range from very light to dark skin tones. The color parameters of each patch are carefully designed to simulate the spectral characteristics of real skin tones. The core function of this zone is to provide a stable benchmark for facial color correction, as accurate restoration of the true skin tone is a prerequisite for identifying pathological complexions in Traditional Chinese Medicine (TCM) facial diagnosis. For example, the brightness of the color patches in the facial color zone decreases from 82 to 58, with corresponding regular changes in red-green and yellow-blue hues. The color axis parameters of the dark skin patches are specifically adjusted to effectively improve yellowing issues caused by ambient light or equipment. During image processing, the standard color information from the facial color zone is used to correct the colors of facial areas in the image, ensuring the comparability of facial skin tones across different patients after standardization. It also provides a unified reference for comparing tongue color with facial skin tone, helping physicians to more accurately assess overall complexion.
[0029] The colorimetric chart's operation is closely integrated with the image acquisition and processing system. During acquisition, the colorimetric chart and the patient's tongue are placed on the same depth-of-field plane to ensure simultaneous image capture. The colorimetric chart's position is located using a target detection algorithm, followed by geometric correction and mesh segmentation. The measured color values of each functional area are extracted and converted to device-independent color space values. Semantic segmentation technology is then used to distinguish the tongue body, tongue coating, and facial regions in the image. A partitioned nonlinear correction model is established based on the standard color values and measured values of each functional area. Finally, the image pixels are traversed, and the corresponding correction model is applied according to the region to which the pixel belongs. Boundary smoothing ensures natural color transitions between regions, ultimately outputting a standardized tongue image that is color-consistent, comparable, and reproducible, laying the foundation for digital diagnosis and intelligent analysis in Traditional Chinese Medicine.
[0030] It also includes a reference area, which consists of multiple color blocks located at the color gamut boundary or with special hues, used to provide boundary constraints and verification benchmarks for the color correction model.
[0031] The design logic of the reference area is to cover color ranges not covered by the regular functional areas. The color blocks it contains are located at the edges of the color gamut of areas such as the tongue, tongue coating, and face, and possess unique hue attributes. The color parameters of these blocks are not for direct diagnostic reference, but rather to provide data support for the color correction model. For example, highly saturated red color blocks can be set. These color blocks are located at the color gamut boundary of the tongue's color area, helping the model avoid over- or under-correction when processing highly saturated tongue colors. Yellow color blocks can also be set; their hue deviates from the regular color range of the tongue coating or face, allowing the model to learn richer color mapping rules, thereby enhancing its adaptability to special color situations. Cool-toned or dark color blocks can also be set; these blocks supplement the color dimensions not covered by the regular functional areas, providing the model with more comprehensive boundary constraints.
[0032] In practical work, after locating the color chart and extracting the color patches, the color patches in the reference area are first used to construct the color correction model. Since these color patches are located at the color gamut boundary, the model adjusts the regression coefficients based on the standard and measured values of these color patches when fitting the mapping relationship. This prevents the model from deviating in the edge areas of the color range and ensures that the mapping remains stable throughout the entire color space. For example, when constructing the correction model for the tongue's color region, the measured and standard values of the high-saturation red color patches in the reference area are used as boundary data, allowing the model to more accurately convert tongue colors close to that saturation.
[0033] After color correction, a reference area is used as a benchmark. The color values of the corrected reference area color patches are extracted and compared with pre-stored standard values to calculate the average color difference. If the average color difference is within a preset threshold range, the model's correction effect meets the requirements, and the corrected image can be output and used. If the average color difference exceeds the threshold, the correction is deemed invalid, and the image needs to be re-acquired. For example, if the standard value of the dark color patch in the reference area differs significantly from the measured value after correction, it means the model has a problem processing low-brightness areas. In this case, re-acquiring the image avoids using a color-distorted image, ensuring the accuracy of subsequent diagnostic analysis.
[0034] The reference area, through its dual role as boundary constraint and verification benchmark, helps the color correction model maintain accurate mapping across a wider color range and can promptly identify anomalies during the correction process, thus providing an important guarantee for the reliability of color correction of the entire TCM tongue image.
[0035] A color correction method for acquiring images of the tongue surface in Traditional Chinese Medicine, the method comprising the following steps: Acquire original images containing the patient's tongue surface and a zoned standard colorimetric chart; wherein the zoned standard colorimetric chart includes at least a grayscale area, a tongue body color area, a tongue coating color area, and a facial color area; The color patch regions of the color chart are identified and located in the original image, and the measured color values of each color patch region are extracted. Semantic segmentation is performed on the original image to obtain mask regions; among which, the mask regions include tongue region mask, tongue coating region mask, and face region mask; Based on the measured color values of each color block region and the pre-stored standard color values, a nonlinear mapping relationship from the measured color space to the standard color space is established for the tongue body color area, the tongue coating color area, and the facial color area, respectively. By iterating through each pixel of the original image and applying the corresponding non-linear mapping relationship according to the mask region to correct the color value of the pixel, a color-corrected tongue image is obtained.
[0036] Identifying and locating the color patch regions of the color chart in the original image includes the following steps: The YOLO object detection model is used to locate the color chart of the original image to obtain the bounding rectangle of the color chart; Corner detection is performed within the bounding rectangle area, and geometric correction is performed by comparing the color chart with perspective transformation to obtain the front-view color chart image; The color chart image viewed from the front is divided into color block areas for each function area according to a preset grid array.
[0037] The initial localization of the colorimetric card is achieved using the YOLO object detection model. The YOLO model possesses efficient object recognition capabilities, quickly scanning the original image, identifying the outline of the colorimetric card, and determining its bounding rectangle. For example, in an image containing both the patient's tongue and the colorimetric card, the YOLO model distinguishes the colorimetric card area from the complex image background based on the card's shape and color distribution characteristics, outputting a bounding rectangle that precisely encloses the card. This bounding rectangle clearly defines the colorimetric card's extent within the image, delineating the target region for subsequent processing.
[0038] Corner detection is performed within the circumscribed rectangle, and perspective transformation is used to perform geometric correction of the colorimeter chart. Corner detection captures the positions of the four vertices of the colorimeter chart, while perspective transformation corrects geometric distortions caused by the shooting angle. For example, during actual acquisition, the colorimeter chart may be tilted or perspective-distorted due to the angle at which the photographer holds it. In this case, corner detection will find the actual four corners of the colorimeter chart, and the perspective transformation algorithm will convert the tilted colorimeter chart image into a normal planar image, restoring the colorimeter chart to a regular rectangular shape and ensuring that the subsequently segmented color block areas correspond one-to-one with the functional areas of the actual colorimeter chart.
[0039] The colorimetric chart image, viewed from the front, is divided according to a preset grid array to obtain color patch regions for each functional area. The colorimetric chart itself is laid out in a regular array according to functional zones, such as using a 5x5 grid structure, corresponding to functional areas such as grayscale area and tongue body color area. By uniformly dividing the viewed colorimetric chart image into multiple small blocks according to the preset grid, each small block corresponds exactly to a color patch on the colorimetric chart. This allows for the extraction of color patch regions for each functional area, such as grayscale area, tongue body color area, and tongue coating color area, providing accurate regional data for subsequent extraction of measured color values of color patches and establishment of color correction models.
[0040] The mask region is obtained by semantic segmentation of the original image, specifically as follows: The semantic segmentation network model extracts multi-scale contextual information through the hollow spatial pyramid pooling module to obtain the mask region.
[0041] The goal of semantic segmentation network models is to distinguish different functional regions from the original image, and the dilated spatial pyramid pooling module is a key component for improving its segmentation accuracy. The dilated spatial pyramid pooling module expands the receptive field of convolutional operations through multiple convolutional layers with different dilation rates, without increasing the feature map size or computational cost. Different dilation rates correspond to different receptive field ranges; convolutions with small dilation rates can capture subtle local features in the image, such as the texture of the tongue edge and the thickness of the tongue coating; convolutions with large dilation rates can cover a wider area, capturing the global spatial relationship between the tongue, face, and background. This multi-scale feature information is fused, allowing the model to accurately identify details in small regions while also grasping the overall regional distribution.
[0042] For example, when the original image simultaneously contains the tongue, tongue coating, face, and background, the hollow spatial pyramid pooling module first identifies the subtle textures of the tongue surface and the distribution boundaries of the tongue coating through small dilation rate convolutions. Then, it determines the position of the tongue in the entire image and the relative relationship between the tongue and the face through large dilation rate convolutions. This information is then integrated into the semantic segmentation network. Based on this multi-scale information, the network classifies each pixel in the image and finally outputs the corresponding mask regions, including tongue region masks, tongue coating region masks, and face region masks. The mask regions clearly mark which functional region each pixel belongs to, providing a clear pixel classification basis for subsequent color correction of different regions, ensuring that subsequent color correction can accurately correspond to different diagnostic regions such as the tongue and tongue coating.
[0043] The nonlinear mapping relationship is established through a second-order polynomial regression model. The mapping relationship for any color patch region and color channel k is as follows: ; in: These are the measured channel values extracted from the image; These are the calibrated standard channel values; This is the intercept term, used to correct for the basis offset; This is a linear coefficient used to correct the gain ratio; These are the coefficients of the quadratic term, used to correct the nonlinear Gamma response and nonlinear color shift; For residuals; The second-order polynomial regression model is used for each color patch and each color channel of the colorimetric card, with the intercept term... Its function is to correct for baseline offset. For example, when the measured channel values of a certain color patch area are generally lower than the standard value, the intercept term can add a fixed reference value to all measured values, aligning the base color level with the standard state; linearity coefficient Used to correct for gain ratios, for example, when a camera sensor's response to a certain color channel has a scaling bias, causing the measured value to be 1.2 times the standard value, the linearity coefficient is used. These measured values can be adjusted proportionally to the standard range; quadratic coefficient To correct nonlinear deviations, such as nonlinearity in the camera's Gamma response or nonlinearity in color shift caused by ambient light, the quadratic term curve can be adjusted to compensate for these issues, making the corrected colors more closely resemble the true standard state.
[0044] Suppose the measured channel value of a certain color patch in this region is 40, and the corresponding standard channel value is 45. First, extract the measured channel values and standard channel values of all color patches in this region. Then, fit these three coefficients using the least squares method. The intercept term may be set to 5 to compensate for the 5-unit bias of the base case; the linear coefficient is set to 1.0 to maintain the stability of the gain ratio; and the quadratic coefficient is set to 0.005 to correct the nonlinear Gamma response of this channel. Substituting the measured value of 40 into the model, the calculated corrected value is close to the standard value of 45. The residual term represents the small error between the model's calculation result and the actual standard value. By minimizing the sum of squared residuals, the coefficients are optimized to ensure the accuracy of the entire mapping relationship, allowing the measured values of each color patch region and each color channel to be accurately converted into standard values. Ultimately, this achieves precise color correction of the tongue image, providing a reliable digital color basis for TCM tongue diagnosis.
[0045] The optimal coefficient vector is obtained by fitting using the least squares method. Its goal is to minimize the sum of squared residuals. : ; Where N is the number of color patches participating in the fitting of the color patch region, and i is the index of the color patch.
[0046] The core objective of the least squares method is to minimize the sum of squared residuals, where residuals refer to the difference between the standard channel values and the model-predicted values for each color patch. In practice, for each color channel of each color patch region, the measured channel values and corresponding standard channel values of all color patches in that region are collected, where N represents the number of color patches involved in the fitting. For example, the tongue body color area usually contains 5 color patches, so N is 5, and each color patch corresponds to an index i.
[0047] Taking the red channel of the tongue's color region as an example, the measured and standard red channel values of these five color patches are extracted. These data are then substituted into the formula for calculating the residual sum of squares. The residual sum of squares is the sum of the squares of the results obtained by subtracting the predicted value calculated by the model from the measured values for each color patch's standard value, and then summing the squared values of all five color patches. The least squares method is used to adjust the linear coefficients of the intercept term and the quadratic coefficients in the second-order polynomial to minimize this residual sum of squares.
[0048] Specifically, the values of these three coefficients are continuously optimized. For example, the initial coefficients are set to maximize the sum of squared residuals. After multiple adjustments, the sum of squared residuals is minimized when the combination of the linear and quadratic coefficients of the intercept term allows the predicted value of each color patch to approach the standard value. The coefficient vector obtained at this point is optimal. This optimal coefficient vector is applied to a second-order polynomial regression model to ensure that subsequent color correction of corresponding pixels in the tongue image accurately matches the standard color space. This makes the corrected color more consistent with the actual needs of TCM tongue diagnosis, improving the accuracy and reliability of tongue image digitization.
[0049] After obtaining the color-corrected tongue surface image, boundary smoothing processing is also included, specifically: Gaussian processing is applied to the mask regions generated by semantic segmentation to obtain a weight map; For pixels located at the boundary of different mask regions, their final corrected color value is the weighted sum of the correction results of adjacent regions, calculated using the following formula: ; in, Weighted map at pixels The weight value at that location, and These are the corrected color values obtained through the mapping relationship between adjacent regions.
[0050] Gaussian processing is applied to the mask regions generated by semantic segmentation to obtain the corresponding weight map. The mask regions themselves are pixel-level binary partitions. For example, a mask for the tongue region would label pixels as belonging to or not belonging to the tongue. This abrupt division can cause obvious abrupt changes in color correction at the boundaries of different regions. The purpose of Gaussian processing is to transition the mask boundaries from sharp 0s or 1s to continuous values between 0 and 1. These continuous values constitute the weight map. For example, at the boundary between the tongue body and the tongue coating, where the original mask clearly distinguishes between tongue body pixels and tongue coating pixels, after Gaussian blurring, the weight values of the pixels at the boundary will gradually change between 0 and 1, preserving the region's affiliation while making the boundary transition smoother.
[0051] For pixels located at the boundaries of different mask regions, a weighted sum is used to calculate their final corrected color. Specifically, each boundary pixel corresponds to a weight value in the weight map, representing the degree to which the pixel belongs to one of the two adjacent regions. Taking the boundary between the tongue body and the tongue coating as an example, assuming a pixel has a weight value of 0.7, it means that 70% of the pixel's attributes belong to the tongue body region and 30% to the tongue coating region. The corrected color values of the pixel in both regions are then obtained through the mapping relationship between the tongue body region and the tongue coating region, and finally fused according to the weight values.
[0052] For example, if the color value of a pixel mapped through the tongue body region is the standard color corresponding to the tongue body, and the color value mapped through the tongue coating region is the standard color corresponding to the tongue coating, then the final color value is the standard color of the tongue body multiplied by 0.7, plus the standard color of the tongue coating multiplied by 0.3. This weighted fusion method ensures that the color of pixels at the boundary contains both the color features of their main region and the color information of adjacent regions, avoiding color abrupt changes caused by direct division. This makes the color transition of the entire tongue image more natural, more closely resembles the visual effect of a real tongue, and is more conducive to the diagnostic observation of traditional Chinese medicine practitioners.
[0053] It also includes the following steps: Extract the color values of the reference area reserved on the color chart from the color-corrected tongue surface image; Calculate its average color difference with the pre-stored standard reference value. The calculation formula is as follows: ; If the average color difference does not exceed the preset threshold, output a color-corrected tongue image; If the average color difference exceeds the preset threshold, the correction is deemed to have failed.
[0054] After color correction is completed, the color values of the reference area on the color chart are extracted from the corrected tongue image. The reference area is a region located at the boundary of the color gamut or with a special hue, and its color parameters are pre-calibrated standard values, which are stored in the system in advance as a benchmark for verification.
[0055] The color difference between the measured color value and the pre-stored standard reference value for each color patch in the reference area is calculated. The calculation method involves determining the difference between the standard value and the measured value for each color patch's luminance channel and two chrominance channels. Each difference is squared, summed, and the square root of the sum is taken to obtain the color difference value for a single color patch. The average color difference value for this correction is obtained by averaging the color difference values of all color patches in the reference area.
[0056] For example, if the reference area contains 5 color blocks, the color difference value of each color block is calculated sequentially. Then, these 5 color difference values are added together and divided by 5 to obtain the average color difference. The average color difference is then compared with a preset threshold, which is set according to the color accuracy requirements of traditional Chinese medicine tongue diagnosis. For example, the threshold is usually set to 5.
[0057] If the average color difference is less than the preset threshold, it means that the deviation between the corrected reference area color and the standard value is within an acceptable range, and the color correction effect of the entire tongue image meets the requirements. The system outputs this color-corrected tongue image for subsequent diagnostic analysis. If the average color difference exceeds the preset threshold, it means that the color deviation of the reference area is too large, and the accuracy of the entire correction process cannot be guaranteed. The system determines that the correction has failed, and it is necessary to re-acquire the image and perform correction to avoid using color-distorted images that affect the accuracy of TCM diagnosis.
[0058] Extracting the measured color values of each color patch area involves the following steps: The sRGB values are normalized and linearized using the following formula: in, , These are the sRGB component values normalized to [0,1]. The linear RGB values are converted to CIEXYZ values using a transformation matrix, and the calculation formula is as follows: The formula for converting CIEXYZ values to CIELab values is as follows: Nonlinear function Defined as: Obtain each color patch area on the color chart The measured color values were marked as follows. .
[0059] Normalization and linearization are performed on sRGB values. sRGB is the color space that devices rely on, and different devices exhibit non-linear deviations in their sRGB responses. Therefore, the original sRGB component values need to be normalized to the range of 0 to 1, and the corresponding linearization formula is selected based on the numerical value. When the normalized sRGB value does not exceed 0.04045, it is directly divided by 12.92 to obtain the linearized value; when the value is greater than 0.04045, the value is first added by 0.055, then divided by 1.055, and the result is then raised to the power of 2.4 to obtain the linearized value. For example, if the normalized red component of a pixel is 0.5, since it is greater than 0.04045, the corresponding linearized red value is obtained, which can eliminate the non-linear gamma response deviation of the device and make the color value closer to the true linear relationship of light intensity.
[0060] The linearized RGB values are converted to CIEXYZ values. CIEXYZ is a device-independent color space, and the conversion process is achieved through a fixed transformation matrix. This transformation matrix is determined based on standard light sources and the characteristics of human vision. The linearized red, green, and blue component values are multiplied by their corresponding coefficients in the matrix, and then summed to obtain the X, Y, and Z component values. For example, if the linearized red value is 0.6, green value is 0.5, and blue value is 0.4, substituting these values into the matrix yields the corresponding X, Y, and Z values, allowing color data to be independent of device limitations and achieving a unified color reference across devices.
[0061] The CIEXYZ values are converted to CIELab values. CIELab is a color space that more closely resembles human color perception. The conversion uses the XYZ values of the standard white point as a reference. First, the ratio of each component to its corresponding white point component is calculated. A non-linear function f(t) is selected for conversion based on the ratio. When the ratio is greater than 0.008856, it is raised to the power of one-third; when the ratio is less than or equal to 0.008856, 7.787 is multiplied by the ratio and then 16 / 116 is added. The final CIELab value is obtained using the formulas for the luminance channel L and the two chrominance channels a and b. For example, if the ratio of X of a color swatch to the white point X is 0.8, which is greater than 0.008856, its cube root is taken, and then substituted into the formulas for L, a, and b to calculate the measured CIELab value of that color swatch.
[0062] This series of conversions transforms the color values of each color patch on the color chart into device-independent CIELab values that conform to human visual perception. These values serve as measured color data and are compared with pre-stored standard CIELab values. This provides accurate and unified basic data for establishing a color correction mapping relationship, ensuring that the colors of tongue images collected from different devices and environments can be accurately corrected to the standard state, thus supporting the digital analysis of TCM tongue diagnosis.
[0063] The formula for correcting the LAB value of a pixel is as follows: ; in, This represents the original channel value of the pixel. This represents the corrected channel value. , , This represents the regression coefficient for the color channel corresponding to the region to which the pixel belongs.
[0064] First, determine the region to which each pixel belongs, such as the tongue region, tongue coating region, or facial region. Different regions correspond to their respective regression coefficients obtained by fitting a second-order polynomial regression. These coefficients include the intercept term, linear coefficient, and quadratic term coefficient, which correspond to different parameters in the calibration model.
[0065] During the calibration process, for each pixel's original LAB channel value, the regression coefficient of the corresponding color channel for its region is called and substituted into the calibration formula for calculation. In the formula, the original channel value is the basic input for calibration. The intercept term is used to correct the basis offset of the channel value. For example, when the original channel value of a certain region is generally low, the intercept term will add a fixed reference amount to it. The linear coefficient is used to adjust the gain ratio of the channel value. For example, when there is a fixed scaling difference between the original value and the standard value, the linear coefficient will scale the original value proportionally. The quadratic coefficient is used to compensate for the non-linear deviation of the channel value. For example, the non-linear response of the device sensor or the color shift non-linearity caused by ambient light can be corrected by adjusting the curve of the quadratic term.
[0066] Taking the luminance channel of the tongue region as an example, assuming the original luminance channel value of a pixel is 50, the intercept term for that region's luminance channel is 3, the linear coefficient is 1.1, and the quadratic coefficient is 0.002, substituting these values into the formula, the corrected luminance value is 3 plus 1.1 multiplied by 50, plus 0.002 multiplied by the square of 50. The final value obtained is the corrected luminance channel value for that pixel. By performing this calculation on the three LAB channels of each pixel, the pixel colors of different regions in the entire image can be converted into standard color space values, making the corrected tongue image color closer to the real tongue appearance and facial condition, providing accurate color basis for digital tongue diagnosis in Traditional Chinese Medicine.
[0067] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A colorimetric card for acquiring images of the tongue surface in Traditional Chinese Medicine, characterized in that, Includes a color block array divided by function, the color block array comprising at least: A grayscale area, which consists of multiple neutral gray blocks, is used to provide a brightness correction reference. The tongue body color zone consists of multiple color blocks that simulate different tongue body colors, and its color parameters cover the diagnostic color range from pale white tongue to purple tongue. The tongue coating color zone consists of multiple color blocks that simulate different tongue coating colors, and its color parameters cover the diagnostic color range from white coating to black coating. Facial color zones, which consist of multiple color blocks simulating different facial skin tones, are used to provide a baseline for facial color correction.
2. The colorimetric card for acquiring tongue surface images in Traditional Chinese Medicine according to claim 1, characterized in that, It also includes a reference area, which consists of multiple color blocks located at the color gamut boundary or with a special hue, used to provide boundary constraints and verification benchmarks for the color correction model.
3. A color correction method for acquiring tongue surface images in Traditional Chinese Medicine, applied to a colorimetric card for acquiring tongue surface images in Traditional Chinese Medicine as described in any one of claims 1-2, characterized in that, The method includes the following steps: Acquire original images containing the patient's tongue surface and a zoned standard colorimetric chart; wherein the zoned standard colorimetric chart includes at least a grayscale area, a tongue body color area, a tongue coating color area, and a facial color area; The color patch regions of the color chart are identified and located in the original image, and the measured color values of each color patch region are extracted. Semantic segmentation is performed on the original image to obtain mask regions; wherein, the mask regions include tongue region mask, tongue coating region mask and face region mask; Based on the measured color values of each color block region and the pre-stored standard color values, a nonlinear mapping relationship from the measured color space to the standard color space is established for the tongue body color area, the tongue coating color area, and the facial color area, respectively. By iterating through each pixel of the original image and applying the corresponding non-linear mapping relationship according to the mask region to correct the color value of the pixel, a color-corrected tongue image is obtained.
4. The color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, Identifying and locating the color patch regions of the color chart in the original image includes the following steps: The YOLO object detection model is used to locate the color chart of the original image to obtain the bounding rectangle of the color chart; Corner detection is performed within the bounding rectangle area, and geometric correction is performed by comparing the color chart with perspective transformation to obtain the front-view color chart image; The color chart image viewed from the front is divided into color block areas for each function area according to a preset grid array.
5. A color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, The mask region is obtained by semantic segmentation of the original image, specifically as follows: The semantic segmentation network model extracts multi-scale contextual information through the hollow spatial pyramid pooling module to obtain the mask region.
6. The color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, The nonlinear mapping relationship is established through a second-order polynomial regression model. The mapping relationship for any color patch region and color channel k is as follows: ; in: These are the measured channel values extracted from the image; These are the calibrated standard channel values; This is the intercept term, used to correct for the basis offset; This is a linear coefficient used to correct the gain ratio; These are the coefficients of the quadratic term, used to correct the nonlinear Gamma response and nonlinear color shift; For residuals; The optimal coefficient vector is obtained by fitting using the least squares method. Its goal is to minimize the sum of squared residuals. : ; Where N is the number of color patches participating in the fitting of the color patch region, and i is the index of the color patch.
7. A color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, After obtaining the color-corrected tongue surface image, boundary smoothing processing is also included, specifically: Gaussian processing is applied to the mask regions generated by semantic segmentation to obtain a weight map; For pixels located at the boundary of different mask regions, their final corrected color value is the weighted sum of the correction results of adjacent regions, calculated using the following formula: ; in, For the weight map in pixels The weight value at that location, and These are the corrected color values obtained through the mapping relationship between adjacent regions.
8. A color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, It also includes the following steps: Extract the color values of the reference area reserved on the color chart from the color-corrected tongue surface image; Calculate its average color difference with the pre-stored standard reference value. The calculation formula is as follows: ; If the average color difference does not exceed the preset threshold, output a color-corrected tongue image; If the average color difference exceeds the preset threshold, the correction is deemed to have failed.
9. A color correction method for acquiring traditional Chinese medicine tongue images according to claim 3, characterized in that, Extracting the measured color values of each color patch area involves the following steps: The sRGB values are normalized and linearized using the following formula: in, , These are the sRGB component values normalized to [0,1]. The linear RGB values are converted to CIEXYZ values using a transformation matrix, and the calculation formula is as follows: The formula for converting CIEXYZ values to CIELab values is as follows: Nonlinear function Defined as: Obtain each color patch area on the color chart The measured color values were marked as follows. .
10. A color correction method for acquiring tongue surface images in traditional Chinese medicine according to claim 3, characterized in that, The formula for correcting the LAB value of a pixel is as follows: ; in, This represents the original channel value of the pixel. This represents the corrected channel value. , , This represents the regression coefficient for the color channel corresponding to the region to which the pixel belongs.