Image color correction method and apparatus, color correction robot, and storage medium
By combining a deep learning colorimetric detection and segmentation model with a multinomial regression model, the problem of color deviation in tongue images was solved, achieving high-precision image color correction and improving the accuracy of TCM tongue diagnosis and data support for intelligent analysis.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- BEIJING ECON MEDICAL TECHNOLOGY CO LTD
- Filing Date
- 2025-07-21
- Publication Date
- 2026-07-02
AI Technical Summary
Existing medical image processing algorithms can cause color deviations in tongue images under complex lighting and background conditions, affecting the accuracy of intelligent analysis and auxiliary diagnosis in traditional Chinese medicine tongue diagnosis, especially in fields such as dermatology and stomatology. Existing methods suffer from problems such as insufficient training data and the assumption that the color chart and the photographed object are not on the same plane.
A deep learning-based colorimetric card detection and segmentation model is adopted. Images are acquired through a high-resolution camera, and a color transformation matrix is generated by combining a multinomial regression model to perform image color correction, thereby improving the accuracy and applicability of color correction.
It achieves high-precision image color correction in complex environments, improves the color accuracy and diagnostic value of tongue images, and ensures the reliability of TCM tongue diagnosis and data support for intelligent analysis.
Smart Images

Figure CN2025109609_02072026_PF_FP_ABST
Abstract
Description
Image color correction methods, devices, color correction robots, and storage media
[0001] This disclosure claims priority to Chinese Patent Application No. 202411902317.4, filed on December 23, 2024, entitled “Image Color Correction Method, Apparatus, Color Correction Robot and Storage Medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of image processing technology, and in particular to an image color correction method, apparatus, color correction robot, and storage medium. Background Technology
[0003] With advancements in artificial intelligence, medical images are playing an increasingly prominent role in clinical diagnosis. However, the quality of medical images directly impacts the accuracy of doctors' diagnoses, especially in fields where color information is crucial for diagnosis, such as dermatology, dentistry, and ophthalmology. For example, high-quality tongue images serve as the data foundation for all subsequent intelligent and assisted tongue diagnosis; the accuracy of the tongue image's color directly affects the reliability of the diagnostic results.
[0004] When capturing images of the tongue, the image quality is affected by various factors such as lighting conditions, focal length changes, and the shooting environment. To compensate for these adverse factors, cameras typically use various built-in image processing algorithms to automatically adjust image quality. Existing image processing algorithms primarily aim to make the captured images easier for humans to view and more aesthetically pleasing. However, in practical medical applications, these algorithms can lead to color deviations and distortions in the tongue image. Because the image processing algorithms are built into the camera and use an automatic adjustment mechanism, the imaged colors are not always accurate, especially under complex lighting and background conditions. This deviation can manifest in the tongue image's color saturation, contrast, and even white balance shifts.
[0005] The aforementioned color deviations not only affect the visual realism of tongue images but also severely reduce their diagnostic value. This is particularly critical in the field of intelligent analysis and assisted diagnosis of tongue diagnosis in Traditional Chinese Medicine, where precise color information is essential. Even subtle color differences can increase the difficulty of identifying lesions and may even lead to misdiagnosis or missed diagnosis. Accurate color correction of tongue images is a problem that urgently needs to be solved. Summary of the Invention
[0006] Technical problems to be solved
[0007] To address the aforementioned technical issues, this disclosure provides an image color correction method, apparatus, color correction robot, and storage medium, which improves the color accuracy of images, ensures the reliability and authenticity of image information, and thus provides reliable data support for subsequent intelligent analysis and assisted diagnosis.
[0008] means for solving problems
[0009] In a first aspect, this disclosure provides an image color correction method, the method comprising: acquiring an image to be processed, wherein the image to be processed includes a colorimetric card area, the colorimetric card area including multiple color blocks; extracting the color values of each pixel in the multiple color blocks to obtain a color value list; setting weight coefficients for each color value in the color value list; fitting a polynomial regression model using the color value list with weight coefficients to obtain a fitted polynomial regression model; generating a color transformation matrix using the fitted polynomial regression model, the color transformation matrix being used to represent the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card; and correcting the color values of the pixels in the image to be processed using the color transformation matrix to obtain a corrected image.
[0010] Secondly, this disclosure provides an image color correction device, comprising: an image acquisition module for acquiring an image to be processed, wherein the image to be processed includes a colorimetric card area, the colorimetric card area including multiple color blocks; a color value extraction module for extracting the color values of each pixel in the multiple color blocks to obtain a color value list; a weight setting module for setting weight coefficients for each color value in the color value list; a fitting module for fitting a polynomial regression model using the color value list with weight coefficients to obtain a fitted polynomial regression model; a matrix generation module for generating a color transformation matrix using the fitted polynomial regression model, the color transformation matrix representing the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card; and a color correction module for correcting the color values of the pixels in the image to be processed using the color transformation matrix to obtain a corrected image.
[0011] Thirdly, this disclosure provides a color correction robot, which includes: one or more processors; a storage device for storing one or more programs; a camera for acquiring an image to be processed and transmitting it to the processor; and when one or more programs are executed by one or more processors, the one or more processors implement the image color correction method as described in the first aspect above.
[0012] Fourthly, this disclosure provides a storage medium, which may be a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the image color correction method as described in the first aspect above.
[0013] Fifthly, embodiments of this disclosure provide a computer program product comprising a computer program or instructions that, when executed by a processor, implement the image color correction method as described in any of the first aspects above. Beneficial effects
[0014] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0015] This disclosure provides an image color correction method, apparatus, color correction robot, and storage medium. The method includes: acquiring an image to be processed, wherein the image to be processed includes a colorimetric card area, and the colorimetric card area includes multiple color blocks; extracting the color values of each pixel in the multiple color blocks to obtain a color value list; setting weight coefficients for each color value in the color value list; fitting a polynomial regression model using the color value list with weight coefficients to obtain a fitted polynomial regression model; generating a color transformation matrix using the fitted polynomial regression model, the color transformation matrix representing the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card; and correcting the color values of the pixels in the image to be processed using the color transformation matrix to obtain a corrected image. This embodiment improves the color accuracy of images, ensures the reliability and authenticity of image information, and thus provides reliable data support for subsequent intelligent analysis and assisted diagnosis. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0017] Figure 1 is a schematic flowchart of the image color correction method provided in an embodiment of this disclosure;
[0018] Figure 2 is a schematic diagram of the construction process of the color correction robot provided in the embodiments of this disclosure;
[0019] Figure 3 is a schematic diagram of an example of the original image provided in an embodiment of this disclosure;
[0020] Figure 4 is a schematic diagram comparing the image preprocessing before and after the embodiment of this disclosure;
[0021] Figure 5 is a schematic diagram of the colorimetric card area marked in the original image provided in the embodiments of this disclosure;
[0022] Figure 6 is a schematic diagram of the color blocks marked in the colorimetric card area image provided in the embodiments of this disclosure;
[0023] Figure 7 is a schematic diagram of the process of embedding the color correction robot program into a standard robot according to an embodiment of the present disclosure;
[0024] Figure 8 is a schematic diagram of the structure of the colorimetric card detection model provided in the embodiment of this disclosure;
[0025] Figure 9 is a schematic diagram of the structure of the color block segmentation model provided in the embodiment of this disclosure;
[0026] Figure 10 is a schematic diagram of the complete process from colorimetric card detection to color block segmentation provided in an embodiment of this disclosure;
[0027] Figure 11 is a schematic diagram of the process for generating a color value list provided in an embodiment of this disclosure;
[0028] Figure 12 is a schematic diagram of the weight coefficient adjustment process provided in the embodiments of this disclosure;
[0029] Figure 13 is a schematic diagram of the fitting process of the multinomial regression model provided in the embodiments of this disclosure;
[0030] Figure 14 is a schematic diagram of the process for generating a color conversion matrix provided in an embodiment of this disclosure;
[0031] Figure 15 is a flowchart of color value conversion provided in an embodiment of this disclosure;
[0032] Figure 16 is a schematic diagram of the image color correction device provided in an embodiment of this disclosure;
[0033] Figure 17 is a schematic diagram of the structure of the electronic device provided in the embodiments of this disclosure. Detailed Implementation
[0034] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0035] With advancements in artificial intelligence, medical images are playing an increasingly prominent role in clinical diagnosis. However, the quality of medical images directly impacts the accuracy of doctors' diagnoses, especially in fields where color information is crucial for diagnosis, such as dermatology, dentistry, and ophthalmology. For example, tongue images are an important basis for tongue diagnosis in traditional Chinese medicine, and the accuracy of their color directly affects the reliability of the diagnostic results.
[0036] In actual tongue image data acquisition, factors such as lighting conditions, imaging equipment settings, and shooting environment can cause color deviations in tongue images. This color deviation significantly reduces the diagnostic value of tongue images, especially in the field of intelligent analysis and assisted diagnosis of traditional Chinese medicine tongue diagnosis, which requires precise color information. Accurate color correction of tongue images is a pressing issue. To address these problems, related technologies for tongue image color correction mainly fall into the following categories: color correction methods based on multinomial regression and color charts, color correction methods based on machine learning and color charts, and color correction methods based on deep learning and color charts.
[0037] In the three color correction methods mentioned above, the step of extracting color values is mostly based on image grayscale conversion and edge detection algorithms (such as Canny edge detection) to find the boundaries of color blocks and determine the contour positions of each color block on the colorimetric chart. By calculating the average color value of the central region of each color block, the influence of edge effects during the imaging process on the correction results can be effectively reduced.
[0038] While color correction methods based on multinomial regression, machine learning, and deep learning can improve the color accuracy of images to some extent, they still have many problems in practical applications of traditional Chinese medicine (TCM) tongue diagnosis, which heavily relies on the accurate reproduction of the tongue image's true color. TCM tongue diagnosis is extremely sensitive to the accurate representation of color features such as tongue color and tongue coating; any color deviation can affect the doctor's diagnosis. Therefore, the aforementioned color correction methods still cannot meet the needs of intelligent analysis and assisted diagnosis in TCM tongue diagnosis in practical applications. The main shortcomings of these color correction methods are as follows:
[0039] (1) Disadvantages of color correction methods based on polynomial regression and color charts
[0040] Multinomial regression models correct image colors by fitting the relationship between standard color values and color values in the acquired image. However, this method has limitations in the selection of the polynomial order. When the order is too high, the model may overfit, becoming overly sensitive to noise in the training data, resulting in poor performance on new images; while when the order is too low, it cannot capture complex color variations, leading to unsatisfactory correction results. Furthermore, multinomial regression models typically model each color channel independently, ignoring the correlation between color channels, which can cause the corrected image to appear unnatural.
[0041] (2) Disadvantages of color correction methods based on machine learning and color charts
[0042] Machine learning methods such as Support Vector Machines (SVMs) can handle complex nonlinear problems, but they may face challenges when dealing with high-dimensional data and complex color mappings. In particular, the performance of the model is highly dependent on the quality and diversity of the training data, meaning that the model's calibration effect will be affected if there is insufficient labeled data or insufficient data diversity. In addition, the training and tuning process of SVM models is complex and usually requires a lot of computational resources and time.
[0043] (3) Disadvantages of color correction methods based on deep learning and color charts
[0044] Deep learning models can learn the complex mapping relationship between the color values of acquired images and standard color values, giving them an advantage in color correction. However, training deep learning models often requires a large amount of high-quality labeled data, making the training process time-consuming and computationally expensive. Furthermore, deep learning models face the problem of overfitting and may lack good generalization ability when processing tongue images with diverse backgrounds and lighting conditions.
[0045] The three color correction methods mentioned above all have two common significant problems: (1) limited training data; (2) the assumption that the color chart and the photographed object are on the same plane.
[0046] (1) Data volume limit
[0047] All three color correction methods described above use color values from a colorimeter chart for correction, typically only obtaining the average color value of each color patch. Taking a commonly used 24-color standard colorimeter chart as an example, the final data used for correction consists of only 24 color values. This limitation in data volume leads to insufficient data during model training, preventing the model from fully learning the complex color variations in images. Furthermore, color variations in real-world images are often gradual and multi-dimensional; data from only a small number of color patches is insufficient to capture these subtle changes, thus affecting the detail and overall effectiveness of the correction.
[0048] (2) The assumption that the color chart and the photographed object are on the same plane.
[0049] Existing methods generally assume that the color chart and the photographed object are on the same plane, with consistent light intensity and angle. However, in actual shooting, lighting and viewing angle conditions often vary, leading to deviations in the color values of the color patches. Since the three color correction methods mentioned above typically use the average value of the color chart area as the representative color of the color patch, they fail to consider the effects of changes in lighting and viewing angle, thus limiting the accuracy and applicability of color correction.
[0050] To address the aforementioned technical problems, this disclosure provides an image color correction method. The image color correction method provided by this disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] Figure 1 is a flowchart of an image color correction method according to an embodiment of this disclosure. This embodiment is applicable to the correction of colors in captured images. The method can be executed by an image color correction device, which can be implemented in software and / or hardware. The image color correction device can be configured in a color correction robot. The color correction robot may include a standard robot capable of medical health monitoring or medical auxiliary treatment.
[0052] The image color correction method provided in this embodiment is mainly implemented by a color correction robot program built into the color correction robot. The process of constructing the color correction robot will be described first.
[0053] The color correction robot in this embodiment is mainly used to address the shortcomings of traditional color correction methods, such as insufficient training data and the assumption that the color chart and the photographed object are on the same plane. By introducing detection and segmentation models, an intelligent and accurate integrated image color correction method is designed, which can maintain high-precision color reproduction in complex imaging environments. The main components of the color correction robot include the following modules: image acquisition module, standard color chart, detection and segmentation module, and color correction module.
[0054] The color correction robot is equipped with a high-resolution camera and camera control unit for acquiring high-precision images. This robot can adjust the shooting angle and lighting conditions in different environments to ensure accurate capture of color information in the scene, and stores the captured images in its internal storage unit for subsequent processing.
[0055] In color correction robots, a standard colorimeter chart is used as the benchmark for color correction. The colorimeter chart contains multiple color blocks with known standard color values. These color blocks provide reliable reference points for image color correction, ensuring the accuracy of color adjustments.
[0056] The detection and segmentation module mainly includes a colorimeter detection model and a color block segmentation model. The colorimeter detection model, based on deep learning algorithms, can automatically identify and locate the colorimeter in an image. This model ensures the accurate detection of the colorimeter's position in the image, laying the foundation for subsequent color block segmentation and color value data extraction. The color block segmentation model, also based on deep learning algorithms, is responsible for pixel-level precise segmentation of the color blocks in the colorimeter. This model analyzes the color information within each color block pixel by pixel, extracting all pixel data for each color block, significantly improving the amount of data and accuracy used for color correction.
[0057] The color correction module extracts color block pixel data based on a colorimetric card detection model and a color block segmentation model, and calculates and generates a color conversion matrix. This color conversion matrix is applied to each pixel of the original image to correct its color value, ultimately achieving high-precision image color correction. In this way, the color correction robot can effectively cope with complex lighting and environmental changes, ensuring the accuracy of image color reproduction.
[0058] The construction process of the color correction robot provided in this embodiment mainly includes five steps: data preprocessing, model training, construction of a detection and segmentation module, construction of a color correction module, and module embedding. The specific process of constructing the color correction robot is shown in Figure 2 below, and the details are as follows:
[0059] a. Data preprocessing
[0060] The data preprocessing stage involves three main steps: data acquisition, data processing, and data labeling, providing data support for subsequent model training and module construction. The specific steps are as follows:
[0061] Step (1): Data Acquisition. A large number of images containing color charts are acquired using the high-definition camera built into the standard robot as raw images, ensuring that the raw images cover various lighting conditions, shooting angles, and different scenes. To ensure data quality, the acquired raw images are filtered, removing blurry or unevenly lit images, and retaining the raw images where the color chart area is clearly visible. This step yields high-quality raw images.
[0062] Accurate and comprehensive raw images lay a solid foundation for subsequent model training and color correction. The acquisition of raw images primarily revolves around images containing color charts, aiming to ensure the color correction robot can operate stably under various lighting conditions, angles, and scenes. Therefore, a large number of raw images containing standard color charts were acquired using the built-in high-resolution camera. Furthermore, it was necessary to ensure that the color charts were photographed under different environmental conditions, including various lighting conditions and different shooting angles, to ensure the breadth and representativeness of the acquired data. The specific raw image acquisition strategy is shown in Table 1 below.
[0063] Table 1. Acquisition Strategy for Original Images
[0064] Using the aforementioned original image acquisition strategy, a total of 12,000 original images with a resolution of 1080×1000 pixels were acquired. To ensure image quality, 492 images were removed during the image screening process due to blurriness, uneven lighting, or other factors that might affect colorimetric card recognition. Finally, 11,508 original images with clearly visible colorimetric card areas were retained. An example of the acquired original images is shown in Figure 3 below. As shown in Figure 3, taking the application of this image color correction method to the field of tongue diagnosis as an example, the original image 30 includes the tongue region 31 and the colorimetric card region 32.
[0065] Step (2): Data Preprocessing. The original image acquired in Step (1) is processed. The main operation is to crop the color chart region in the original image to generate a color chart region image for use in training the color block segmentation model. During the cropping process, it is necessary to ensure the integrity of the color blocks in the color chart region image and avoid the outer frame of the color chart or other objects affecting the image quality. After this step, a color chart region image suitable for training the color block segmentation model is obtained.
[0066] Data preprocessing is a crucial step in ensuring data quality and applicability, providing fundamental support for subsequent model training and color correction. Data preprocessing primarily involves appropriately cropping the original images acquired in step (1) and saving them as color chart region images required for color block segmentation model training, serving as the data annotation source for the color block segmentation model in subsequent step (3). During preprocessing, it is important to maintain the integrity of the color blocks in the color chart region image while appropriately removing some of the color chart's outline to avoid including objects other than the standard color chart in the cropped image. An example of data preprocessing is shown in Figure 4. Before data preprocessing, as shown in the left image of Figure 4, the original image 30 includes the tongue region 31 and the color chart region 32. After data preprocessing, as shown in the right image of Figure 4, the color chart region image 40 only includes the color chart region and does not include the tongue region.
[0067] Step (3): Data Labeling. This step includes two parts: colorimetric card detection data labeling and color block segmentation data labeling. The colorimetric card detection data labeling uses the original images of the tongue region and colorimetric card region collected in step (1), while the color block segmentation data labeling uses the cropped colorimetric card region image obtained in step (2). The open-source labeling tool Labelme is used as the labeling tool for both colorimetric card detection and color block segmentation. During the labeling process, it is necessary to clearly define the boundaries of the colorimetric card and the specific location of each color block to provide accurate reference for subsequent color value extraction and model training. After this step, the colorimetric card detection dataset and the color block segmentation dataset are obtained.
[0068] In step (3), the colorimetric card detection data annotation requires the original image acquired in step (1) to be annotated, clearly defining the boundaries and positions of the colorimetric card. The annotated dataset will be used to train the colorimetric card detection model, ensuring that the model can accurately identify the positions of the colorimetric card in the image. The color block segmentation data annotation requires the preprocessed colorimetric card region image from step (2) to annotate the color block segmentation data. Similarly, the Labelme annotation tool is used to accurately annotate each color block in the colorimetric card, recording the specific position and boundary of each color block. The annotated dataset will be used to train the color block segmentation model, ensuring that the model can accurately segment the color block regions in the colorimetric card. A sample of colorimetric card detection data annotation is shown in Figure 5, annotating the colorimetric card region in the original image. A sample of color block segmentation data annotation is shown in Figure 6, annotating the specific position and boundary of each color block.
[0069] It should be noted that Figures 3-6 are grayscale images, used only to illustrate key steps in the image processing during color correction. In actual use, the images used for model training and color correction are color images containing color charts, such as RGB format images.
[0070] After completing the data annotation for colorimetric card detection and color block segmentation, the labeled datasets are rationally divided to ensure the scientific validity and effectiveness of model training, validation, and testing. Specifically, the original images after colorimetric card detection data annotation are randomly divided into training, validation, and test sets in an 8:1:1 ratio to obtain the colorimetric card detection dataset; the colorimetric card region images after color block segmentation data annotation are randomly divided into training, validation, and test sets in a 70:15:15 ratio to obtain the color block segmentation dataset. The detailed contents of the colorimetric card detection dataset and the color block segmentation dataset are shown in Table 2 below.
[0071] Table 2. Contents of the Color Comparison Detection Dataset and the Color Patch Segmentation Dataset
[0072] b. Model training phase
[0073] During the model training phase, the main goal is to build an automated detection and segmentation system, enabling image color correction to be more accurate and efficient in various complex scenarios, reducing human intervention. The specific steps are as follows:
[0074] Step (4): Colorimetric Scale Detection Model Training. The pre-trained detection model is trained using the colorimetric scale detection dataset obtained in Step (3) to construct a model capable of automatically identifying the colorimetric scale location under different lighting conditions, angles, and scenes. The purpose of this colorimetric scale detection model is to automatically locate the colorimetric scale region, providing a foundation for subsequent color block segmentation and color correction. During training, information such as the boundaries and positions of the colorimetric scale needs to be trained to ensure that the colorimetric scale detection model has high accuracy and robustness in practical applications. The colorimetric scale detection model training process mainly involves establishing a mapping relationship between the input image and the output result using a large number of labeled original images. After this step, a colorimetric scale detection model capable of automatically detecting the colorimetric scale location will be obtained.
[0075] Step (5): This step uses the color block segmentation dataset obtained in step (3) to train the pre-trained segmentation model, constructing a model capable of accurately segmenting color block regions in the color chart area image. The main task of this color block segmentation model is to segment each color block in the color chart area image individually, ensuring that the pixel values of each color block can be accurately extracted. The key to this step is to obtain fine color data in the color chart area image through the color block segmentation model, which far exceeds the 24 color values used in traditional methods. Compared with using the regional mean, the color value data can reach 10,000 times or even 100,000 times, greatly enriching the data resources required for color correction. After this step, a color block segmentation model capable of accurately segmenting color blocks will be obtained. The accurate and effective color block segmentation model can accurately segment the regions of each color block in the color chart, ensuring the accurate extraction of all pixel values within each color block, and providing a large amount of diverse color value data for subsequent color correction.
[0076] c. Construction of the detection and segmentation module stage
[0077] To enable interactive processing between the colorimetric card detection model and the color block segmentation model, and to effectively extract pixel values within color blocks on the colorimetric card, a detection and segmentation module is constructed. This module integrates the colorimetric card detection model, the color block segmentation model, and the color value extraction algorithm to facilitate subsequent automated image color correction processes. By interactively integrating the colorimetric card detection model, the color block segmentation model, and the color value extraction algorithm, a complete automated process from colorimetric card detection, color block segmentation, and color value extraction can be achieved.
[0078] d. Building the color correction module stage
[0079] The color correction module is the core component of the system. Its purpose is to apply the rich color data obtained in the preceding steps to actual image correction, thereby improving the color accuracy of the tongue image. The color correction module primarily adjusts the weights of the extracted color values and uses the adjusted weights and color values as input data to fit a multinomial regression model. Finally, based on the fitted multinomial regression model and color transformation matrix, it is applied to the tongue image to be corrected, achieving high-quality tongue image color correction.
[0080] e. Module embedding stage
[0081] In this stage, the detection and segmentation module is integrated with the color correction module and embedded into a standard robot to create a color correction robot. This enables the color correction robot to perform a fully automated image color correction process. This stage ensures that all parts of the system work in coordination, allowing the color correction robot to perform color correction processing while capturing images.
[0082] By embedding a detection and segmentation module and a color correction module into a standard robot, the robot gains integrated image color correction capabilities, thus enabling it to perform color correction. In other words, by embedding these modules into a standard robot, a color-corrected robot is created. This standard robot is equipped with a high-resolution camera and a camera control unit for acquiring high-precision images of the tongue. The robot can adjust its shooting angle and lighting conditions in different environments to ensure accurate capture of color information in the scene and stores the captured images in its internal storage unit for subsequent processing.
[0083] Optionally, the main structure and functions of the standard robot are shown in Table 3, and the main structure and functions of the color correction robot are shown in Table 4. As can be seen from Tables 3 and 4, the hardware structure and accessories of the standard robot and the color correction robot are identical, and both include a camera control module in their software configurations. Compared to the standard robot, the color correction robot's software configuration adds a detection and segmentation module and a color correction module.
[0084] Table 3. Main Structure and Functions of Standard Robots
[0085] Table 4. Main Structure and Functions of the Color Correction Robot
[0086] The specific process of embedding the detection and segmentation module and the color correction module into the standard robot is shown in Figure 7: First, the standard robot program within the standard robot is acquired; then, the detection and segmentation module and the color correction module are embedded into the standard robot program in series to form the color correction robot program; finally, the color correction robot program is overwritten into the standard robot to form the color correction robot. The standard robot program includes: a camera capturing images based on a shooting signal, an imaging module outputting the acquired image, and an output module storing the output acquired image. The color correction robot program includes: a camera capturing images based on a shooting signal, an imaging module outputting the acquired image, a detection and segmentation module processing the acquired image and outputting color block coordinates and color value data, a color correction module performing color correction on the acquired image based on the color block coordinates and color value data, and an output module outputting and storing the color-corrected image.
[0087] The following describes a method for correcting image colors using a color correction robot. As shown in Figure 1, the image color correction method provided in this embodiment mainly includes steps S101-S106.
[0088] S101. Obtain the image to be processed, wherein the image to be processed includes a colorimetric card area, and the colorimetric card area includes multiple color blocks.
[0089] The image to be processed can be understood as an image captured by an electronic device that exhibits color deviation. This electronic device refers to one that deploys a color correction robot program, such as a color correction robot. A colorimeter chart includes a standard colorimeter chart, typically composed of a series of predefined standard color blocks. These color blocks are printed or displayed in a specific arrangement, and each color has a unique number or name for easy reference by the user. Using a standard colorimeter chart as the benchmark for color correction, the chart contains multiple color blocks with known standard color values. These color blocks provide reliable reference points for image color correction, ensuring the accuracy of color adjustments.
[0090] Furthermore, the image to be processed includes a target object region, which is used to display the target object. The target object is the object that needs color correction; color correction is performed on the target object region to improve the accuracy of the target object's color. The target object is specifically determined according to the purpose of the color correction robot. For example, if the color correction robot is an auxiliary device for tongue diagnosis, then the target object is the tongue; if the color correction robot is an auxiliary device for eye diagnosis, then the target object is the eye. This embodiment does not specifically limit the type of target object; this embodiment uses the tongue as an example for illustration.
[0091] In practical applications, the target object and the colorimetric card are placed in the same scene, and then the scene is photographed using a camera. The image captured by the camera is used as the image to be processed. In tongue diagnosis applications, the patient's tongue and the colorimetric card are placed in the same scene, for example, the colorimetric card is placed under the tongue. Then, the scene is photographed using a camera, and the image captured by the camera is used as the image to be processed. As shown in Figure 3, the image to be processed includes a colorimetric card area and a tongue area. The colorimetric card area contains multiple color blocks with known standard color values. These color blocks provide reliable reference points for color correction of the image to be processed, ensuring the accuracy of color adjustment.
[0092] Furthermore, the color correction robot is equipped with a high-resolution camera and a camera control unit. The camera is used to acquire high-precision images as images to be processed. This color correction robot can adjust the shooting angle and lighting conditions in different environments to ensure accurate capture of color information in the scene, and stores the captured images in an internal storage unit for subsequent processing.
[0093] S102. Extract the color values of each pixel in multiple color blocks to obtain a list of color values.
[0094] The colorimetric chart area includes multiple color blocks, each composed of multiple pixels. Each color block in the colorimetric chart area has its corresponding standard color value; that is, there is a one-to-one correspondence between color blocks and standard color values. For each color block, the pixels within that color block are traversed, the color value of each pixel is extracted, and the color block code and the corresponding color values of each pixel are stored in a color value list.
[0095] In one possible implementation, the color values of each pixel in multiple color blocks are extracted to obtain a color value list, including: using a colorimetric detection model to detect the image to be processed and obtain the location information of the colorimetric region; cropping the image to be processed based on the location information of the colorimetric region to obtain a colorimetric region image; using a color block segmentation model to identify and segment the colorimetric region image to obtain the coordinates of each pixel in each color block; and extracting the color value of each pixel in each color block based on the coordinates of each pixel in each color block to obtain a color value list.
[0096] First, the trained colorimetric card detection model is used to automatically detect and identify the locations of the colorimetric card regions in the image to be processed. After detection, the colorimetric card regions in the image to be processed are cropped based on their location information, and the cropped colorimetric card region image is passed to the trained color block segmentation model. The color block segmentation model performs fine segmentation on the cropped colorimetric card region image, accurately identifying each color block region. After color block segmentation, the location information of each color block is output, including the color block's code and its specific location in the image. This step ensures that all pixel information of each color block in the colorimetric card region can be accurately obtained.
[0097] The colorimetric card detection model, trained using a deep learning algorithm, can automatically identify and locate colorimetric card regions in the image to be processed. This model ensures the accurate detection of the colorimetric card's position within the image, laying the foundation for subsequent color block segmentation and color value extraction. Specifically, the colorimetric card detection model is a detection model capable of automatically identifying and locating colorimetric card regions in the image to be processed, providing a basis for subsequent color block segmentation and color correction.
[0098] The structure of the colorimetric card detection model is shown in Figure 8. The input to the model is the image to be processed, and the output is location information (x, y, w, h) and the image type is a colorimetric card, specifically the location information of the output colorimetric card region. This location information includes the horizontal and vertical coordinates, width, and height (x, y, w, h) of the colorimetric card region. The colorimetric card detection model uses a convolutional neural network (CNN) as the feature extraction network, fully connected layers further process and combine these features, and the output layer generates the final detection result. As shown in Figure 8, the colorimetric card detection model extracts features from the input image to obtain a first feature map. Further feature extraction from the first feature map yields a second feature map, followed by a third feature map. This third feature map is then processed to obtain a fourth feature map, which is input into the first fully connected layer. Simultaneously, the fourth feature map is upsampled to obtain a fifth feature map. This fifth feature map is then fused with the third feature map to obtain a sixth feature map, which is input into the second fully connected layer. The fifth feature map is then upsampled to obtain a seventh feature map. This second feature map is then fused with the seventh feature map to obtain an eighth feature map, which is input into the third fully connected layer. The output data from the three fully connected layers are then processed in the detection head to obtain location information and classification results. The location information includes the horizontal coordinate, vertical coordinate, width, and height (x, y, w, h). The classification result is the colorimetric card.
[0099] The aforementioned network structure enables the model to accurately detect the colorimetric card area and its features, thereby improving the detection capability of the color correction robot.
[0100] The color block segmentation model is trained based on a deep learning algorithm and is mainly used for pixel-level accurate segmentation of color blocks in a color chart image. By analyzing the color information within each color block pixel by pixel, the model extracts the position information of all pixels in each color block, significantly improving the amount of data and accuracy used for color correction.
[0101] The accurate and effective color block segmentation model can precisely segment the regions of each color block in the color chart area image, ensuring the accurate extraction of all pixel values within each color block. This lays the foundation for providing a large number of diverse color values for subsequent color correction.
[0102] As shown in Figure 9, the input to the color block segmentation model is a color chart region image, and the output is the encoding of each color block and the coordinates of each pixel within each color block. The color block encoding indicates the standard color value corresponding to that color block. Furthermore, the color block segmentation model employs a Convolutional Neural Network (CNN) as the main feature extraction network, combined with a Feature Pyramid Network (FPN) structure. The model first performs feature extraction through multiple layers of CNN, extracting information at different levels of the image, including the edges, shapes, and internal details of the color blocks. Then, upsampling techniques are used to recover the scale of the feature map, and with the help of the Feature Pyramid Network, a multi-scale feature representation is constructed.
[0103] Specifically, as shown in Figure 9, the input to the color block segmentation model is a color chart region image. The color block segmentation model performs convolution processing on the color chart region image to obtain the ninth feature map. The ninth feature map is then convolved again to obtain the tenth feature map. This tenth feature map is then convolved again to obtain the eleventh feature map. The eleventh feature map is then convolved again to obtain the twelfth feature map. The twelfth feature map is then upsampled to obtain the thirteenth feature map. The eleventh and thirteenth feature maps are then fused to obtain the fourteenth feature map. Finally, the fourteenth feature map is upsampled... The sampling process yields the fifteenth feature map. The tenth and fifteenth feature maps are then fused to obtain the sixteenth feature map. Convolution is performed on the sixteenth feature map to obtain the seventeenth feature map. The fourteenth and seventeenth feature maps are then fused to obtain the eighteenth feature map. Convolution is performed on the eighteenth feature map to obtain the nineteenth feature map. The nineteenth feature map is then fused with the twelfth feature map to obtain the twentieth feature map. The twentieth, eighteenth, and sixteenth feature maps are then input into the segmentation head. The segmentation head outputs the classification results and the corresponding pixel coordinates for each classification result. The classification results include the labels of each color block, and the pixel coordinates for each classification result include the coordinates of all pixels within that labeled color block.
[0104] This feature pyramid structure can better capture multi-level information in an image, enabling the model to accurately understand and segment color block regions at different scales.
[0105] Through multi-level feature extraction and multi-scale feature fusion, the color patch segmentation model can accurately identify and segment 24 color patches in a colorimetric chart under complex lighting and angle conditions. These patches include: Dark skin, Skin, Blue sky, Foliage, Blue flower, Bluish green, Orange, Purplish blue, Moderate red, Purple, Yellow, Green, Orange yellow, Blue, Red, Magenta, Cyan, White, Neutral 8, Neutral 6.5, Neutral 5, Neutral 3.5, and Black. These color patches are coded from 1 to 24 sequentially from left to right and top to bottom in the colorimetric chart. The color block segmentation model ensures that all pixel values within each color block area can be accurately extracted, providing a solid and reliable data foundation for subsequent color correction.
[0106] In this embodiment, the colorimetric detection model trained by the model is interactively integrated with the color block segmentation model, enabling a complete automated process from colorimetric detection to color block segmentation. The fusion workflow of the colorimetric detection model and the color block segmentation model is shown in Figure 10: First, the image to be processed is input into the trained colorimetric detection model. The colorimetric detection model performs inference on the image to be processed, obtains the colorimetric detection result, and outputs the position and boundary (x, y, w, h) of the colorimetric region. Based on the position and boundary of the colorimetric region, the colorimetric region in the image to be processed is automatically cropped to obtain the colorimetric region image, which is then passed to the color block segmentation model. Thus, the detection box generated by the colorimetric detection model serves as the input to the color block segmentation model, providing accurate region information for subsequent precise segmentation. The cropped colorimetric region image is then input into the color block segmentation model. The color block segmentation model uses a Feature Pyramid Network (FPN) structure to segment the color blocks at different scales, ensuring accurate identification of the boundary and internal region of each color block, obtaining the color block segmentation result, and outputting the coordinates of each color block. In this way, the color correction robot is able to obtain the precise location of each color block.
[0107] In one possible implementation, the color values of each pixel in each color block are extracted based on the coordinates of each pixel to obtain a color value list, including: extracting the color values of each pixel in the image to be processed based on the coordinates of each pixel; establishing an association between the color block number and the color values of each pixel and storing them in the color value list.
[0108] In this embodiment, based on the coordinates of each pixel in each color block, and combined with a color value extraction algorithm, the color value at the corresponding coordinate position is extracted from the colorimetric chart area image. The extracted color values are summarized into a color value list, providing data support for subsequent color correction. The color value list contains a large number of color values from each color block in the colorimetric chart, far exceeding the limitations of traditional methods that only use the average color value of a single area; it can typically reach 10,000 to 100,000 times the number of average color values for an area. In this way, more color details can be captured, providing richer and more accurate data support for subsequent color correction. Finally, the color value list of all color blocks is output as the basic data input for subsequent color correction steps. This ensures the automation and high-precision execution of the color correction process.
[0109] Furthermore, after fusing the colorimetric card detection model and the color block segmentation model, the next step is to combine the color value extraction algorithm with the output of the aforementioned model to achieve high-precision color data extraction. The main task of the color value extraction algorithm is to extract the accurate color values (RGB values) of each pixel within each segmented color block. These color values will be used in the subsequent color correction process. The specific process is shown in Figure 11. After completing the segmentation of the color blocks, the region information of each color block has been obtained, including the boundary and internal region of each color block. The color value extraction algorithm first reads this region information and identifies the coordinates of all pixels within each color block. Secondly, it iterates through the coordinates of the pixels within each color block, extracts the color value (RGB value) of each pixel, and stores both the color block code and the color value in a color value list. Finally, the color value list is output to the color correction module. As shown in the right side of Figure 11, this is a schematic diagram of the color value list structure. The color value list structure includes multiple color value information, including the color block number and the color value of each pixel within the corresponding color block. For example, in Figure 11, 01, 06, and 24 identify the color blocks, and (R, G, B) after each number indicates the color value of a pixel in the corresponding color block.
[0110] S103. Set weight coefficients for each color value in the color value list to obtain a color value list with weight coefficients.
[0111] To adapt to different shooting conditions (such as light intensity and angle changes), the color values are weighted according to the distribution of different color blocks. The purpose of weight adjustment is to assign weight coefficients to the color values within the color blocks based on the lighting and shooting angle information in the actual scene, thereby reducing or increasing their weighting influence when fitting the multinomial regression model. Specifically, this involves adjusting the weight coefficients of different color values based on the distribution of color values in the color value list.
[0112] Specifically, based on the color value list, the weights are adjusted by analyzing the distribution of color values. The representation of different color blocks in an image is affected by light intensity and angle; therefore, the weight coefficients need to be adjusted so that the multinomial regression model can better reflect the lighting conditions of the actual scene during fitting. After adding weight coefficients to each color value, a list of weighted color values is formed. Through weight adjustment, the model is prevented from being overly sensitive to certain abnormal or extreme color values, resulting in a smoother fit that conforms to the actual lighting conditions during shooting.
[0113] In one possible implementation, weight coefficients are set for each color value in the color value list, including: statistically analyzing the color values of each pixel in the color value list to obtain the color distribution of each channel; analyzing the color distribution of each channel to obtain the first parameter and the second parameter corresponding to each channel, wherein the first parameter is half of the channel width and the second parameter is the channel value with the largest proportion in the channel; and calculating the weight coefficient of each channel based on the first parameter and the second parameter corresponding to each channel and the set weight calculation formula.
[0114] In this embodiment of the disclosure, color distribution statistics are performed on 24 color blocks in the image to be processed and the actual captured image using an ultra-high pixel camera. It can be seen that, whether it is the image to be processed or the actual captured image, the pixel distribution of the R, G, and B channels in the color block pixels of the color chart basically conforms to a normal distribution.
[0115] As shown in Figure 12, the specific process of the weight adjustment strategy is as follows: First, the color values of the pixels contained in all color blocks are statistically analyzed to obtain the pixel value distribution of the R channel, G channel, and B channel in the color blocks, and singular values in each channel are removed; Second, the weight coefficient of the pixels is adjusted according to the channel color value distribution. The adjustment formula for the weight coefficient k is as follows:
[0116] in:
[0117] e is the natural logarithm;
[0118] v is the current channel value of the pixel, that is, the horizontal coordinate value at this time;
[0119] v m It is the channel value that accounts for the largest proportion in a single channel, that is, the horizontal coordinate value corresponding to the largest vertical coordinate value;
[0120] σ is half the width of a single channel, which is half the maximum x-coordinate value minus the minimum x-coordinate value.
[0121] After statistically analyzing the color value distribution, we obtain σ and v. m And the weight transformation function F(ν). After weight adjustment by F(ν), the color value list is transformed into a color value list with weight coefficients. This color value list with weight coefficients will be passed as input to the multinomial regression model fitting process to fit the multinomial regression model.
[0122] S104. Use the list of color values with weighted coefficients to fit the multinomial regression model and obtain the fitted multinomial regression model.
[0123] The purpose of multinomial regression model fitting is to construct a color correction model suitable for different shooting scenarios based on a list of weighted color values, thereby adjusting the color of the image to be processed to a standard state.
[0124] A multinomial regression model is fitted using a list of weighted color values. Based on the difference between the standard color values of the color chart and the color values in the captured image, a multinomial regression model is established, and weighted coefficients are considered in the loss function calculation to reduce fitting error. The multinomial coefficients of the model are iteratively optimized to ensure that the model accurately reflects the mathematical relationship between the color deviation of each pixel in the image being processed and the standard color. Ultimately, the optimized multinomial regression model better reflects the overall color shift in the tongue image.
[0125] In one possible implementation, a multinomial regression model is fitted using a target color value list to obtain a fitted multinomial regression model. This includes: fitting the model using the color values and color block numbers in the color value list to obtain an initial multinomial regression model; and iteratively adjusting the initial multinomial regression model using the weight coefficients of each color value in the color value list to obtain a fitted multinomial regression model. The fitted multinomial regression model includes a multinomial regression model that minimizes the loss function.
[0126] The specific process of fitting the multinomial regression model is shown in Figure 13 below. First, the weight values, color values, and color block labels in the color value list with weighted coefficients are extracted, and the color values and color block labels are used to fit the multinomial regression model. Second, the weight values in the color value list with weighted coefficients are used to correct the loss function output when fitting the multinomial regression model. Third, the model parameters are iteratively adjusted so that the fitted multinomial curve can reflect the color change pattern between color blocks as accurately as possible. Finally, the fitted multinomial regression model is output.
[0127] In Figure 13, the loss function Loss represents the loss function of the multinomial regression model, where R', G', and B' represent the actual color values of the target's red, green, and blue channels, respectively; x, y, and z are the initial coefficients of the multinomial regression model f; k R k G k BThese are the weighted coefficients for the red, green, and blue channels, respectively; f = x'R + y'G + z'B is the multinomial regression model after minimizing the loss function. This model mainly adjusts the coefficients in the multinomial regression model by minimizing the loss function to achieve the best fit to the color data; x', y', and z' are the coefficients of the fitted multinomial regression model; f = (a + b + c)R + (e + f + g)G + (i + j + k)B is the fitting function after decomposing the coefficients of the multinomial regression model; a, b, and c represent the results of decomposing the coefficients of the red channel, e, f, and g represent the results of decomposing the coefficients of the green channel, and i, j, and k represent the results of decomposing the coefficients of the blue channel.
[0128] S105. Generate a color conversion matrix using the fitted polynomial regression model. The color conversion matrix is used to represent the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card.
[0129] The purpose of generating the color transformation matrix is to convert the fitted polynomial regression model into a transformation matrix suitable for tongue image color correction, used to adjust the color values in the image to the color state of a standard colorimetric card. The fitted polynomial regression model is used to generate the color transformation matrix for actual color correction. This color transformation matrix contains the coefficients of the polynomial regression model and is passed as a whole to the subsequent tongue image color conversion step. The function of the color transformation matrix is to correct the color value of each pixel in the tongue image in the RGB space.
[0130] In one possible implementation, the color transformation matrix is generated using the fitted polynomial regression model, including: splitting the coefficients in the fitted polynomial regression model to obtain a polynomial regression model with split coefficients; and combining the coefficients of the polynomial regression model with split coefficients to form a color transformation matrix.
[0131] The specific process for generating the color conversion matrix is shown in Figure 14. First, the coefficients of the fitted polynomial regression model are extracted. These coefficients are key parameters describing the color change pattern, determining how color values are adjusted under different lighting conditions and shooting angles. Second, the coefficients in the polynomial regression model are combined into a standardized color conversion matrix. This matrix represents the mapping relationship from the color values of the image to be processed to the color values of a standard colorimetric card. Typically, the dimension of the color conversion matrix depends on the dimension of the color space (3x3 matrix for RGB space). Finally, the final color conversion matrix (M) is output for subsequent calculations of tongue image color conversion.
[0132] In Figure 14, f = (a+b+c)R + (e+f+g)G + (i+j+k)B is the fitting function after coefficient decomposition of the multinomial regression model, where R, G, and B represent the input red, green, and blue components, respectively, and a, b, c, e, f, g, i, j, and k are the model coefficients. Furthermore, after matrix transformation, formula f is expressed in matrix multiplication form, outputting a matrix Matrix, which is then converted into a color transformation matrix M, where a = M 11 b = M 21 c = M 31 ,e=M 12 f = M 22 g = M 32 i = M 13 j = M 23 k = M 33 .
[0133] S106. Use the color transformation matrix to correct the color values of the pixels in the image to be processed, and obtain the corrected image.
[0134] A color transformation matrix is used to correct the color of all pixels in the image to be processed. The color transformation matrix is applied to the RGB values of the image to be processed, and a color-corrected image is generated. In this way, the color value of each pixel in the image to be processed is adjusted according to the result of polynomial fitting, ensuring that the corrected image matches the standard color values of the colorimetric card, thus generating the final corrected image.
[0135] Using the generated color conversion matrix, the RGB values in the image to be processed are color-corrected and converted, adjusting the color values of all pixels in the image to the corrected color values, thus generating the final corrected image. As shown in Figure 15, the specific operation process is as follows: Read the image to be processed and extract the RGB values of each pixel. These original color values in the image will be adjusted to a standard state in subsequent steps; use the color conversion matrix to perform color conversion on the RGB values of each pixel; recombine the corrected color values of all pixels in the image to be processed into a complete image. At this point, the colors of all pixels in the corrected image have been mapped and adjusted to the colors in the standard color chart; finally, output the color-converted corrected image. The color distribution of the corrected image is more in line with the actual standard and can be used for subsequent intelligent analysis and auxiliary diagnosis of TCM tongue diagnosis. Specifically, when using the color conversion matrix for color conversion, the following matrix operations are applied for each pixel:
[0136] in:
[0137] [R,G,B] represents the RGB values of the original pixels in the image to be processed, and [R',G',B'] represents the corrected pixel values in the corrected image; M ij It is the corresponding element in the color transformation matrix M.
[0138] Furthermore, after color correction is complete, the corrected image is saved to the color correction robot's built-in storage. The stored corrected image data is securely preserved by the system for later use or further analysis. The security and traceability of the corrected image data are ensured, including version information, generation date, and time. In addition, the hash value (such as MD5) of the generated file is used for integrity verification, and it is regularly backed up to secure storage media or the cloud to prevent data loss or corruption.
[0139] To facilitate subsequent use or further analysis, the color-corrected image is output to the built-in storage space of the color correction robot, ensuring the security and traceability of the corrected tongue image data. To ensure a balance between image quality and storage efficiency, the image is stored in lossless compressed PNG format with a traceable file naming format, including version information, date, time, and image number. For example: Corrected_ver001_20240101_001.png. To ensure image security, the generated file hash (MD5) is used for integrity verification after saving, and the image is regularly backed up to secure storage media or the cloud to prevent data loss.
[0140] To allow users to intuitively view and evaluate the effects of color correction, a visualization function for the corrected image was designed. This function helps users quickly understand the results of color correction and determine whether they meet the expected standards.
[0141] The robot reads the saved calibration image from storage and outputs it to its built-in display screen. Through the screen, users can intuitively view and evaluate the color calibration effect and determine whether the calibrated image meets the expected standards. This function provides a direct interactive method, making the color calibration process more transparent and easier to understand, ensuring that the final tongue image meets the quality requirements of traditional Chinese medicine tongue diagnosis.
[0142] To visually demonstrate the effects of color correction, a convenient evaluation and analysis interface will be provided for users. The system will read the saved correction images from the robot's built-in storage and output them to the robot's built-in display screen for visualization. Through the display screen, users can clearly see the color-corrected tongue image and quickly assess the correction effect by comparing it with the original image.
[0143] The image color correction method provided in this disclosure has the following main advantages:
[0144] First, by adjusting the weights of color values, the accuracy and adaptability of the color correction model can be improved.
[0145] Color correction is achieved by fitting color values using a multinomial regression model and combining it with a weight adjustment algorithm to optimize the fitting process. This approach provides an adaptive correction mechanism to address color deviations in images under different lighting conditions and shooting angles. The weight adjustment algorithm optimizes the color values of different color blocks, enabling the model to more accurately reflect the color variation patterns between color blocks during fitting, thus achieving higher precision color correction. The multinomial regression model fitting method based on weight adjustment exhibits strong adaptability, capable of handling complex lighting and angle variations, and possesses high practical value and innovation.
[0146] Secondly, by detecting and extracting a large amount of raw color value data from the segmentation module, the stability and reliability of the system are enhanced.
[0147] A high-precision color correction model is constructed by fitting a polynomial regression model to a large amount of raw color value data. This rich dataset allows the model to more comprehensively capture color variation patterns in actual shooting scenes. This results in better stability and reliability of the polynomial regression model under various shooting conditions and environments. The extensive raw color value data covers more lighting conditions and shooting angle variations, making the model more accurate when handling complex lighting conditions and different angles. This precise fitting capability significantly improves the accuracy of color correction, making the final color correction result closer to the actual color values.
[0148] Third, it automates colorimetric card detection and color block segmentation, improving efficiency and accuracy.
[0149] In the image color correction process, a modular and automated data processing scheme for color charts and color blocks in images is proposed by combining a colorimetric card detection model with a color block segmentation model. This provides a large amount of raw color value data for subsequent color correction modules. The colorimetric card detection model automatically identifies the position and boundaries of the color chart in the image to be processed, while the color block segmentation model further performs precise segmentation of each color block in the color chart region image. Through this organic combination, the system can efficiently and accurately extract color information from the color chart, greatly reducing the workload of manual annotation and intervention. This automated detection and segmentation process has high flexibility and scalability, and can be applied to various image processing scenarios. It not only improves processing efficiency but also ensures the accuracy of the results, making it suitable for image color correction tasks.
[0150] Fourth, by using robotic systems to achieve full-process automation and integration, labor costs can be reduced and overall processing efficiency can be improved.
[0151] By embedding a colorimetric card detection and segmentation module and a color correction module into the robotic system, a comprehensive robotic image color correction system solution is formed. The robot automatically acquires images to be processed via a camera and sequentially executes colorimetric card detection, color block segmentation, and color correction, ensuring seamless integration of each step. The system design covers the entire process from image acquisition to processing, correction, storage, and final visualization. Medical users can complete the entire image data acquisition and color correction process solely through the robotic system. This highly automated design not only reduces manual intervention and lowers operating costs but also improves processing speed and accuracy, significantly enhancing system stability and reliability, making it suitable for various medical and research applications. The embedded storage and visualization functions also allow users to easily manage data and evaluate correction effects in real time, further enhancing the system's practicality and convenience.
[0152] Figure 16 is a schematic diagram of the structure of an image color correction device according to an embodiment of the present disclosure. As shown in Figure 16, the image color correction device 40 provided in this embodiment of the present disclosure mainly includes: an image acquisition module 41, a color value extraction module 42, a weight setting module 43, a fitting module 44, a matrix generation module 45, and a color correction module 46.
[0153] The system includes: an image acquisition module 41 for acquiring an image to be processed, which includes a colorimetric card area containing multiple color blocks; a color value extraction module 42 for extracting the color values of each pixel in the multiple color blocks to obtain a color value list; a weight setting module 43 for setting weight coefficients for each color value in the color value list; a fitting module 44 for fitting a multinomial regression model using the color value list with weight coefficients to obtain a fitted multinomial regression model; a matrix generation module 45 for generating a color transformation matrix using the fitted multinomial regression model, which represents the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card; and a color correction module 46 for correcting the color values of the pixels in the image to be processed using the color transformation matrix to obtain a corrected image.
[0154] This disclosure provides an image color correction device that performs the following steps: acquiring an image to be processed, wherein the image to be processed includes a colorimetric card area, and the colorimetric card area includes multiple color blocks; extracting the color values of each pixel in the multiple color blocks to obtain a color value list; setting weight coefficients for each color value in the color value list; fitting a polynomial regression model using the color value list with weight coefficients to obtain a fitted polynomial regression model; generating a color transformation matrix using the fitted polynomial regression model, the color transformation matrix representing the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card; and correcting the color values of each pixel in the image to be processed using the color transformation matrix to obtain a corrected image. This embodiment improves the color accuracy of images, ensures the reliability and authenticity of image information, and thus provides reliable data support for subsequent intelligent analysis and assisted diagnosis.
[0155] In one possible implementation, the color value extraction module 42 is specifically used to detect the image to be processed using a colorimetric card detection model to obtain the location information of the colorimetric card region; to crop the image to be processed based on the location information of the colorimetric card region to obtain a colorimetric card region image; to recognize and segment the colorimetric card region image using a color block segmentation model to obtain the coordinates of each pixel in each color block; and to extract the color value of each pixel in each color block based on the coordinates of each pixel in each color block to obtain a color value list.
[0156] In one possible implementation, the color value extraction module 42 is specifically used to extract the color value of each pixel in the image to be processed based on the coordinate value of each pixel; establish an association between the number of the color block and the color value of each pixel, and store it in the color value list.
[0157] In one possible implementation, the weight setting module 43 is specifically used to set weight coefficients for each color value in the color value list, including: statistically analyzing the color values of each pixel in the color value list to obtain the color distribution of each channel; analyzing the color distribution of each channel to obtain the first parameter and the second parameter corresponding to each channel, wherein the first parameter is half of the channel width and the second parameter is the channel value with the largest proportion in the channel; and calculating the weight coefficient of each channel based on the first parameter and the second parameter corresponding to each channel and the set weight calculation formula.
[0158] In one possible implementation, the weight calculation formula is as follows.
[0159] Where k represents the weighting coefficient, e is the natural logarithm, σ is the first parameter, and v m This is the second parameter.
[0160] In one possible implementation, the fitting module 44 is specifically used to fit the color values and color block numbers in the color value list to obtain an initial polynomial regression model; and to iteratively adjust the initial polynomial regression model using the weight coefficients of each color value in the color value list to obtain a fitted polynomial regression model, wherein the fitted polynomial regression model includes a polynomial regression model that minimizes the loss function.
[0161] In one possible implementation, the matrix generation module 45 is specifically used to split the coefficients in the fitted polynomial regression model to obtain a polynomial regression model with split coefficients; and to combine the coefficients of the polynomial regression model with split coefficients into a color transformation matrix.
[0162] The image color correction apparatus provided in this disclosure can execute the image color correction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0163] Figure 17 is a schematic diagram of the structure of an electronic device provided in this embodiment. The electronic device may include an image color correction device. As shown in Figure 17, the electronic device 500 includes a processor 510, a memory 520, an input device 530, and an output device 540. The number of processors 510 in the electronic device can be one or more; Figure 17 shows an example of one processor 510. The processor 510, memory 520, input device 530, and output device 540 in the electronic device can be connected via a bus or other means; Figure 17 shows an example of connection via a bus.
[0164] The memory 520, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the image color correction method in this embodiment of the invention. The processor 510 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 520, thereby implementing the image color correction method provided in this embodiment of the invention.
[0165] The memory 520 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 520 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 520 may further include memory remotely located relative to the processor 510, which can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0166] Input device 530 can be used to receive input digital or character information, and to generate signal inputs related to user settings and function control of the electronic device, and may include a keyboard, mouse, etc. Output device 540 may include a display device such as a screen.
[0167] This embodiment also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to implement the image color correction method provided in this embodiment of the invention.
[0168] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the method operations described above, but can also perform related operations in the image color correction method provided in any embodiment of the present invention.
[0169] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, 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 a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including 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 of the present invention.
[0170] It is worth noting that in the embodiments of the above-mentioned image color correction device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0171] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0172] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein. Industrial applicability
[0173] This disclosure provides an image color correction method that can improve the color accuracy of images, ensure the reliability and authenticity of image information, and thus provide reliable data support for subsequent intelligent analysis and assisted diagnosis, which has strong industrial applicability.
Claims
1. A method for correcting image color, characterized in that, The method includes: Obtain an image to be processed, wherein the image to be processed includes a colorimetric card area, and the colorimetric card area includes multiple color blocks; Extract the color values of each pixel in the multiple color blocks to obtain a list of color values; Setting weight coefficients for each color value in the color value list includes: statistically analyzing the color values of each pixel in the color value list to obtain the color distribution of each channel; analyzing the color distribution of each channel to obtain a first parameter and a second parameter corresponding to each channel, wherein the first parameter is half the channel width and the second parameter is the channel value with the largest proportion in the channel; and calculating the weight coefficient of each channel based on the first parameter and the second parameter corresponding to each channel and the set weight calculation formula. The polynomial regression model is fitted using a list of color values with weighted coefficients to obtain the fitted polynomial regression model. A color transformation matrix is generated using a fitted multinomial regression model. This color transformation matrix is used to represent the mapping relationship between the color values in the image to be processed and the standard color values in the colorimetric card. The color values of pixels in the image to be processed are corrected using the color conversion matrix to obtain a corrected image.
2. The method according to claim 1, characterized in that, The step of extracting the color values of each pixel in multiple color blocks to obtain a color value list includes: The colorimetric card detection model is used to detect the image to be processed and obtain the location information of the colorimetric card region; Based on the location information of the colorimetric card area, the image to be processed is cropped to obtain the colorimetric card area image; The color block segmentation model is used to identify and segment the color chart region image to obtain the coordinates of each pixel in each color block; Based on the coordinates of each pixel in each color block, the color value of each pixel in each color block is extracted to obtain a list of color values.
3. The method according to claim 2, characterized in that, Based on the coordinates of each pixel in each color block, the color value of each pixel in each color block is extracted to obtain a color value list, including: Based on the coordinate values of each pixel, the color value of each pixel is extracted from the image to be processed. The color block number is associated with the color value of each pixel and stored in the color value list.
4. The method according to claim 1, characterized in that, The formula for calculating the set weights is as follows: Where k represents the weighting coefficient, e is the natural logarithm, σ is the first parameter, and v m The second parameter is v, which is the channel value of the current channel of the pixel.
5. The method according to claim 4, characterized in that, The process of fitting a multinomial regression model using the weighted color value list to obtain the fitted multinomial regression model includes: By fitting the color values and color block numbers in the color value list, an initial multinomial regression model is obtained; The initial polynomial regression model is iteratively adjusted using the weight coefficients of each color value in the color value list to obtain a fitted polynomial regression model, wherein the fitted polynomial regression model includes a polynomial regression model that minimizes the loss function.
6. The method according to claim 5, characterized in that, The process of generating the color transformation matrix using the fitted polynomial regression model includes: The coefficients in the fitted polynomial regression model are decomposed to obtain the polynomial regression model with decomposed coefficients. The coefficients of the multinomial regression model after coefficient decomposition are combined into a color transformation matrix.
7. An image color correction device, characterized in that, The device includes: An image acquisition module is used to acquire an image to be processed, wherein the image to be processed includes a colorimetric card area, and the colorimetric card area includes multiple color blocks; The color value extraction module is used to extract the color value of each pixel in multiple color blocks to obtain a color value list. The weight setting module is used to set weight coefficients for each color value in the color value list. Setting weight coefficients for each color value in the color value list includes: statistically analyzing the color values of each pixel in the color value list to obtain the color distribution of each channel; analyzing the color distribution of each channel to obtain a first parameter and a second parameter corresponding to each channel, wherein the first parameter is half the channel width, and the second parameter is the channel value with the largest proportion in the channel; and calculating the weight coefficient of each channel based on the first parameter and the second parameter corresponding to each channel and the set weight calculation formula. The fitting module is used to fit a list of color values with weighted coefficients to a multinomial regression model, and obtain the fitted multinomial regression model. The matrix generation module is used to generate a color conversion matrix using a fitted multinomial regression model. The color conversion matrix is used to represent the mapping relationship between the color values in the image to be processed and the standard color values in the colorimeter card. The color correction module is used to correct the color values of pixels in the image to be processed using the color conversion matrix to obtain a corrected image.
8. A color correction robot, characterized in that, The color correction robot includes: One or more processors; Storage device for storing one or more programs; A camera is used to capture images to be processed and transmit them to the processor; When the one or more programs are executed by the one or more processors, the one or more processors implement the image color correction method as described in any one of claims 1-6.
9. A storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the image color correction method as described in any one of claims 1-6.