Quality detection and identification method based on image color conversion matrix

By using image color conversion matrix technology in the quality detection and recognition system, the problem of difficult to ensure the consistency of imaging color is solved, and higher recognition accuracy and robustness are achieved.

CN119445148APending Publication Date: 2025-02-14FUJIAN NEWLAND AUTO ID TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411586529.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing quality detection and recognition system based on image processing faces the problem of difficult to guarantee the consistency of imaging color, resulting in a decrease in recognition accuracy.

Method used

Using an image color conversion matrix based method, the reference color and the color space of the on-site image are converted by designing the conversion matrix to ensure that the image color space in different scenarios is consistent.

Benefits of technology

It effectively solves the color inconsistency problem caused by changes in lighting conditions and camera parameters, improves the accuracy and robustness of recognition, and simplifies the sample collection and model training process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119445148A_ABST
    Figure CN119445148A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, in particular to a quality detection and recognition method based on an image color conversion matrix. In the preparation stage, a parameter threshold value, a reference color A and a sample color B are determined, color mapping is executed by calculating a conversion matrix M, a picture of a training model is converted into a color space, a target object is shot in a parameter environment, and after the target object is converted into a numerical value in the color space, a quality result is output through the training model. According to the method, a global image processing strategy is adopted, and the change of a single pixel value in a color space is not focused, so that the comprehensiveness and quality of color processing are improved; the problem of color inconsistency in quality identification can be effectively solved. Besides, for the target object subjected to quality identification, an output result can be obtained only by training the model in the environment, a large amount of data and complex parameter adjustment are not needed, and the scene adaptability and practicability of the model are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a method for color consistency processing before quality detection and recognition using image processing and computer vision technology, and a quality detection and recognition method based on an image color conversion matrix. Background Art

[0002] In the field of in vitro diagnostics (IVD), the identification of the serum status of centrifuged blood (including the detection of hemolysis, lipemia and jaundice) is an important step in assessing the health status of patients. At present, most of these quality indicators are determined by visual evaluation and colorimetric cards by the inspector, but this method has the disadvantages of strong subjectivity, large errors and low efficiency. In order to improve the accuracy and efficiency of diagnosis, automated recognition systems based on image processing and machine learning have been developed in recent years. These systems use a camera to capture images of centrifuged blood samples and send the images of the serum part to the trained model to judge the quality of the sample.

[0003] However, these image processing-based recognition systems face a key problem: it is extremely difficult to ensure the consistency of imaging color. Specifically, it manifests itself in the following aspects: 1. Scene diversity leads to color differences: external lighting conditions in different environments, differences in detection equipment, camera installation positions, and adjustments to exposure parameters will all cause image color variations, making it impossible to directly compare and analyze the captured images. 2. Color changes affect recognition accuracy: Due to the extremely high sensitivity of serum status recognition to color features, color changes will directly affect the recognition accuracy of the model. Current methods often rely on collecting a large number of samples labeled under different conditions to train the model in order to enhance the model's adaptability to color changes. However, this method has the following shortcomings: it requires a large training data set, has many model parameters, a complex structure, is not conducive to hardware integration, and is difficult to cover all potential scene changes, so the recognition effect is still unsatisfactory. 3. Limitations of image color processing methods: Existing image color processing technologies mainly focus on the changes in single pixel values ​​in the color space, and fail to consider the color information of the entire image as a whole, which reduces the overall quality of color processing.

[0004] In the prior art, such as 1. A method for generating a port-wine stain color card based on grayscale segmentation and Lab color clustering, application number CN2021103078050 and announcement number CN113034467B, generates a customized color card for each patient by means of grayscale and LAB color clustering, and the generated color card is easily affected by individual differences; 2. A color data extraction method for color card images at any angle, application number CN2023110171617 and announcement number CN117036513A, focuses on correcting the color block area of ​​the color card at any angle in order to extract the color card value, which easily reduces the overall quality of color processing. Summary of the invention

[0005] In view of the limitations of existing image processing recognition systems and the inability of color recognition to meet accuracy requirements, the present invention aims to provide a quality detection and recognition method based on image color conversion matrix, using the color card color value list as the color conversion reference, designing a conversion matrix, and converting the reference color and the color space of the on-site collected image. It ensures that the color space of the image collected in different scenes is consistent, solving the problem of the accuracy of quality recognition decreasing due to different imaging devices.

[0006] This solution is implemented through the following technical solutions.

[0007] A quality detection and identification method based on an image color conversion matrix comprises the following steps:

[0008] The following steps are involved:

[0009] S1, preparation stage: photograph the color card at the target position, obtain the color value A1 of the color card image, adjust and record the first parameter threshold, minimize the difference between the color value A1 and the color value A2 preset on the color card; use the color value A1 as the sample color B, and the color value A2 as the reference color A;

[0010] S2, calculate the transformation matrix M: C A ≈M·C B , where C A is the color space matrix of the reference color A, C B is the color space matrix of sample color B;

[0011] S3, sample collection: under the shooting condition of the sample color B, shoot the sample, obtain the color value A3 of the sample image, and convert it into the color space matrix C A3 , and then transform it into the matrix C in the color space through the transformation matrix M C , conversion formula: C C =M·C A3 , get the transformed image;

[0012] S4, training model: training the quality score model corresponding to the sample color through the image converted in step S3;

[0013] S5, recognition stage: photograph the target object, execute step S3 to obtain the converted image, input it into the model for recognition, and output the score.

[0014] Furthermore, step S1 is:

[0015] S11, photographing the color card under laboratory conditions, obtaining a color value A11 of the color card image, minimizing the difference between the color value A11 and a color value A2 preset on the color card, and using the color value A11 as a reference color A;

[0016] S12, photographing the color card at the target position, obtaining a color value A12 of the color card image, adjusting and recording a second parameter threshold, minimizing a difference between the color value A12 and the color value A11, and using the sequence A12 as a sample color B.

[0017] Furthermore, the color card includes a first color card and a second color card, the color accuracy of the first color card is greater than the color accuracy of the second color card, and step S1 is:

[0018] S11, photographing the first color card under laboratory conditions, obtaining a color value A101 of the first color card image, adjusting and recording a third parameter threshold, and minimizing a difference between the color value A101 and a preset color value A4 of the first color card;

[0019] S12, using a third parameter threshold, photographing the second color card to obtain a color value A102 of the second color card image, and using the color value A102 as a reference color A;

[0020] S13, photographing the second color card at the target position, obtaining a color value A103 of the second color card image, adjusting and recording a fourth parameter threshold, minimizing a difference between the color value A103 and the color value A102, and using the color value A103 as a sample color B.

[0021] Furthermore, by minimizing the error function E, the transformation matrix M is solved as follows:

[0022]

[0023] Expand the error function E into matrix operation form:

[0024] E=tr((C A -M.C. B ) T ·(C A -M.C.B )),

[0025] Taking the derivative of M and setting the derivative to 0, we get:

[0026]

[0027] Furthermore, the color value is one of a Lab color value, an RGB color value, a CMYK color value, an HSV color value or an HSL color value in a color space.

[0028] Furthermore, the color card is a color card, the first color card is a high-standard color card, and the second color card is a standard color card.

[0029] Furthermore, the parameters of the first parameter threshold, the second parameter threshold, the third parameter threshold and the fourth parameter threshold are at least for adjusting the lighting condition and the exposure parameter.

[0030] Further, samples to be distinguished by color are prepared, photographed respectively, and the fifth parameter threshold is adjusted and recorded, so that each sample image obtained can distinguish the color degree;

[0031] The first parameter threshold, the second parameter threshold and the third parameter threshold are replaced by the fifth parameter threshold.

[0032] Furthermore, the sizes of the color card, the first color card and the second color card are similar to the size of the target object.

[0033] The present invention has the following beneficial effects:

[0034] 1. The quality detection and identification method based on the image color conversion matrix described in the present invention adopts a global image processing strategy, does not focus on the change of a single pixel value in the color space, and improves the comprehensiveness and quality of color processing; takes the reference color A as a reference, and determines the optimal matching parameter threshold through Lab color calculation, providing a quantifiable evaluation index, and at the same time, it also provides a reference for engineers to adjust on-site lighting, equipment exposure parameters, etc.; uses the on-site collected image as the sample color B, and converts it to the color space of the reference color A, effectively solving the color inconsistency problem caused by changes in lighting conditions and camera parameters. In addition, for the target object that needs quality inspection, it is only necessary to train the model in this environment to obtain the output result, without the need for a large amount of data and complex parameter adjustment, which enhances the scene adaptability and practicality of the model.

[0035] 2. The quality detection and identification method based on the image color conversion matrix described in the present invention adjusts the color space of the same color card in the laboratory and the field environment to obtain the color value closest to the preset color card, thereby establishing the reference color A, and further adjusting the second parameter threshold to obtain the sample color B under the best conditions. It can reduce the image color deviation caused by environmental changes, improve the color adaptability, and ensure the accuracy of the quality identification results.

[0036] 3. The quality detection and recognition method based on the image color conversion matrix described in the present invention converts the color card images collected in different environments into a color space close to the reference color A, solving the problem of color consistency in quality recognition. The method simplifies the sample collection and model training process, improves the accuracy and robustness of recognition, effectively controls the image color variation caused by environmental factors, and enhances color adaptation ability.

[0037] 4. The quality detection and identification method based on the image color conversion matrix described in the present invention adopts a multi-precision color card system, combines high-precision color cards and portable low-precision color cards, and builds a flexible color management framework. The high-precision color card ensures the fineness of color matching, while the portable color card provides the convenience of rapid on-site evaluation, which together improves the working efficiency of the blood quality detection system and the accuracy of color recognition.

[0038] 5. In the quality detection and identification method based on the image color conversion matrix described in the present invention, the color card is similar in size to the target object, which can ensure the color space consistency of the identification area.

[0039] 6. The quality detection and recognition method based on the image color conversion matrix described in the present invention does not require a very precise degree of color recognition. The recognition environment can be distinguished as a prerequisite, and there is no need to spend too much time on debugging parameter thresholds. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flow chart of the present invention.

[0041] Figure 2 These are pictures of the target object in Example 3 of the present invention under different lighting conditions.

[0042] Figure 3 yes Figure 2 The image generated after the image in is converted.

[0043] Figure 4 These are blood sample images of different color levels of hemolysis, icterus and lipemia according to Example 4 of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiment of the present invention is illustrated by: the color card is used as a color card, and the color value is the Lab color value under the color space, but it is not intended to limit the specific selection of the present invention. The color card can be replaced by other standard objects that can measure color, and the color space can also be a variety of expressions such as RGB, CMYK, HSV or HSL, and the expression of the sequence is changed, but the overall idea remains unchanged.

[0045] Embodiment 1.

[0046] like Figure 1 As shown, a quality detection and identification method based on an image color conversion matrix comprises:

[0047] S1, preparation stage: fix the camera parameters: exposure, focal length and gain, shoot the color card at the target position, the actual size of the color card is close to the target object, or the proportion of the color card on the image is close to the proportion of the target object on the image. Extract the color Lab value of each color block on the image, and obtain the sequence A1 of the color card image color Lab value. Adjust and record the lighting conditions and exposure parameters to minimize the difference between the sequence A1 and the sequence A2 of the preset color Lab value of the color card, and use the color value A1 as the sample color B, and the color value A2 as the reference color A. The preset color Lab value of the color card is the Lab value under ideal conditions, for example, the red Lab value is set to (42.10, 53.38, 28.19), the green Lab value is set to (55.26, -38.34, 31.37), etc., and all the colors on the color card correspond to the values.

[0048] S2, calculate the conversion matrix M: use the least squares method to fit a color conversion matrix M so that the color value in the sample image is as close as possible to the color value of the reference color A, that is, C A ≈M·C B , where C A is the color space matrix of the reference color A, C B is the color space matrix of sample color B; the expanded formula is as follows:

[0049]

[0050] By minimizing the error function E, the transformation matrix M is solved as follows:

[0051]

[0052] In order to minimize E, it is necessary to differentiate the error function E and find the point where the derivative is zero, which corresponds to the minimum value of the error. The error function E is expanded into a matrix operation form:

[0053] E=tr((C A -M.C. B ) T ·(C A -M.C. B )).

[0054] Take the derivative of M and set the derivative to 0. The process is as follows:

[0055]

[0056] After sorting, we get:

[0057]

[0058] S3, sample collection: under the shooting condition of the sample color B, shoot the sample and obtain a sequence A3, C of the color Lab value of the sample image. A3 is the color space matrix of sequence A3, which is converted into matrix C in color space through conversion matrix M C , substitute into the conversion formula: C C =M·C A3 , and obtain the transformed image.

[0059] S4, training model: the image converted by step S3 is used to train the quality score model corresponding to the sample color.

[0060] S5, recognition stage: photograph the target object, execute step S3, obtain the converted image, input it into the model for recognition, and output the score.

[0061] Embodiment 2.

[0062] On the basis of the first embodiment, laboratory conditions are introduced, and the influencing factors of the laboratory environment are controllable, so that the most ideal color card color under the conditions can be obtained as the reference color A, which is used as the standard for subsequent color conversion.

[0063] S1, preparation stage:

[0064] S11, photographing the color card under laboratory conditions, extracting the color Lab value of each color block on the image, obtaining a sequence A11 of color Lab values ​​of the color card image, minimizing the difference between the color value A1 and a sequence A2 of preset color Lab values ​​of the color card, and using the color value A1 as a reference color A.

[0065] S12, photograph the color card at the target position, extract the color Lab value of each color block on the image, obtain a sequence A12 of the color Lab value of the color card image, adjust and record the second parameter threshold, minimize the difference between the color value A12 and the color value A11, and use the color value A12 as the sample color B.

[0066] S2, calculate the conversion matrix M: use the least squares method to fit a color conversion matrix M so that the color value in the sample image is as close as possible to the color value of the reference color A, that is, C A ≈M·C B , where C A is the color space matrix of the reference color A, C B is the color space matrix of sample color B; the expanded formula is as follows:

[0067]

[0068] By minimizing the error function E, the transformation matrix M is solved as follows:

[0069]

[0070] In order to minimize E, it is necessary to differentiate the error function E and find the point where the derivative is zero, which corresponds to the minimum value of the error. The error function E is expanded into a matrix operation form:

[0071] E=tr((C A -M.C. B ) T ·(C A -M.C. B )).

[0072] Take the derivative of M and set the derivative to 0. The process is as follows:

[0073]

[0074] After sorting, we get:

[0075]

[0076] S3, sample collection: under the shooting condition of the sample color B, shoot the sample and obtain a sequence A3, C of the color Lab value of the sample image. A3 is the color space matrix of color value A3, which is converted into matrix C in color space through conversion matrix M C , substitute into the conversion formula: C C =M·C A3 , and obtain the transformed image.

[0077] S4, training model: the image converted by step S3 is used to train the quality score model corresponding to the sample color.

[0078] S5, recognition stage: photograph the target object, execute step S3, obtain the converted image, input it into the model for recognition, and output the score.

[0079] The sample and the target object are the same product, and adjusting the second parameter is at least adjusting the lighting condition and the exposure parameter.

[0080] Embodiment three.

[0081] On the basis of the second embodiment, a precision multi-precision color card system is introduced. The color cards include a first color card and a second color card, and the color accuracy of the first color card is greater than the color accuracy of the second color card. The application scenario is in vitro detection, and the state of the serum of the centrifuged blood is identified. The sample and the target are both blood sample tubes. The training model includes: training for scoring hemolysis, lipemia and icterus by color. The output quality results include: quality scores for hemolysis, lipemia and icterus.

[0082] The S1 steps are:

[0083] S11, photographing the first color card under laboratory conditions, obtaining a sequence A101 of color Lab values ​​of the first color card image, adjusting and recording a third parameter threshold, and minimizing the difference between the color value A101 and a sequence A4 of preset color Lab values ​​of the first color card.

[0084] S12 , using a third parameter threshold, photographing the second color card, obtaining a sequence A102 of color Lab values ​​of the second color card image, and using the color values ​​A102 as a reference color A.

[0085] S13, photographing the second color card at the target position, obtaining a sequence A103 of color Lab values ​​of the second color card image, adjusting and recording a fourth parameter threshold, minimizing a difference between the color value A103 and the color value A102, and using the color value A103 as sample color B.

[0086] S2, calculate the conversion matrix M: use the least squares method to fit a color conversion matrix M so that the color value in the sample image is as close as possible to the color value of the reference color A, that is, C A ≈M·C B , where C A is the color space matrix of the reference color A, C B is the color space matrix of sample color B; the expanded formula is as follows:

[0087]

[0088] By minimizing the error function E, the transformation matrix M is solved as follows:

[0089]

[0090] In order to minimize E, it is necessary to differentiate the error function E and find the point where the derivative is zero, which corresponds to the minimum value of the error. The error function E is expanded into a matrix operation form:

[0091] E=tr((C A -M.C. B ) T ·(C A -M.C. B )).

[0092] Take the derivative of M and set the derivative to 0. The process is as follows:

[0093]

[0094] After sorting, we get:

[0095]

[0096] S3, sample collection: under the shooting condition of the sample color B, shoot the sample to obtain a sequence A3, C of the color Lab value of the sample image. A3 is the color space matrix of sequence A3, which is converted into matrix C in color space through conversion matrix M C , substitute into the conversion formula: C C =M·C A3 , and obtain the converted image; the images generated before and after the conversion are as shown in the attached Figure 2-3 As shown, Figure 2 These are images of the same blood sample tube taken under different exposure parameters. The image changes significantly from dark to bright. Figure 3 It is the image after the conversion by the present invention. It can be seen that a group of images with obvious color differences originally have a relatively high consistency in brightness and color after the conversion, which provides a guarantee for the accuracy of quality detection and recognition.

[0097] S4, training model: the image converted by step S3 is used to train the quality score model corresponding to the sample color.

[0098] S5, recognition stage: photograph the target object, execute step S3, obtain the converted image, input it into the model for recognition, and output the score.

[0099] The first color card is a high-standard color card, the second color card is a standard color card, and the color card formula uses the CIEDE2000 color card formula.

[0100] The parameters of the third parameter threshold and the fourth parameter threshold are at least used to adjust the lighting condition and the exposure parameter.

[0101] Embodiment 4.

[0102] Based on the third embodiment, the third parameter is adjusted.

[0103] Prepare blood samples of hemolysis, icterus and lipemia that need to be distinguished in color, take pictures respectively, adjust and record the fifth parameter threshold, so that the obtained samples can distinguish the colors of each blood sample in the image. Replace the third parameter threshold of Example 3 with the fifth parameter threshold, and perform steps S1-S5.

[0104] like Figure 4 As shown in the figure, from top to bottom, the first row is the hemolysis image, the second row is the jaundice image, and the third row is the lipemia image. From left to right, there are 7 blood samples with different degrees of hemolysis, jaundice, and lipemia. It can be clearly seen that the parameter threshold at this time can well distinguish the colors of hemolysis, jaundice, and lipemia, and the parameter threshold at this time is set to the fifth parameter threshold.

[0105] The above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention. The above is only an embodiment of the present invention. The selection of the embodiment scheme is only for a better understanding of the invention content, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A quality detection and identification method based on image color conversion matrix, characterized in that: The following steps are involved: S1, preparation stage: photograph the color card at the target position, obtain the color value A1 of the color card image, adjust and record the first parameter threshold, minimize the difference between the color value A1 and the color value A2 preset on the color card; use the color value A1 as the sample color B, and the color value A2 as the reference color A; S2, calculate the transformation matrix M: C A ≈M·C B , where C A is the color space matrix of the reference color A, C B is the color space matrix of sample color B; S3, sample collection: under the shooting condition of the sample color B, shoot the sample, obtain the color value A3 of the sample image, and convert it into the color space matrix C A3 , and then transform it into the matrix C in the color space through the transformation matrix M C , conversion formula: C C =M·C A3 , get the transformed image; S4, training model: training the quality score model corresponding to the sample color through the image converted in step S3; S5, recognition stage: photograph the target object, execute step S3 to obtain the converted image, input it into the model for recognition, and output the score.

2. The quality detection and identification method based on image color conversion matrix according to claim 1 is characterized in that: Furthermore, step S1 is: S11, photographing the color card under laboratory conditions, obtaining a color value A11 of the color card image, minimizing the difference between the color value A11 and a color value A2 preset on the color card, and using the color value A11 as a reference color A; S12, photographing the color card at the target position, obtaining a color value A12 of the color card image, adjusting and recording a second parameter threshold, minimizing a difference between the color value A12 and the color value A11, and using the sequence A12 as a sample color B.

3. The quality detection and identification method based on image color conversion matrix according to claim 1 is characterized in that: Furthermore, the color card includes a first color card and a second color card, the color accuracy of the first color card is greater than the color accuracy of the second color card, and step S1 is: S11, photographing the first color card under laboratory conditions, obtaining a color value A101 of the first color card image, adjusting and recording a third parameter threshold, and minimizing a difference between the color value A101 and a preset color value A4 of the first color card; S12, using a third parameter threshold, photographing the second color card to obtain a color value A102 of the second color card image, and using the color value A102 as a reference color A; S13, photographing the second color card at the target position, obtaining a color value A103 of the second color card image, adjusting and recording a fourth parameter threshold, minimizing a difference between the color value A103 and the color value A102, and using the color value A103 as a sample color B.

4. The quality detection and identification method based on image color conversion matrix according to claim 1 is characterized in that: By minimizing the error function E, the transformation matrix M is solved as follows: Expand the error function E into matrix operation form: E=tr((C A -M·C B ) T ·(C A -M·C B )), Taking the derivative of M and setting the derivative to 0, we get:

5. The quality detection and identification method based on image color conversion matrix according to claim 1 is characterized in that: The color value is one of a Lab color value, an RGB color value, a CMYK color value, an HSV color value or an HSL color value in a color space.

6. The quality detection and identification method based on image color conversion matrix according to claim 3 is characterized in that: The color card is a color card, the first color card is a high-standard color card, and the second color card is a standard color card.

7. A quality detection and identification method based on image color conversion matrix according to any one of claims 1 to 3, characterized in that: The parameters of the first parameter threshold, the second parameter threshold, the third parameter threshold and the fourth parameter threshold are at least for adjusting the lighting condition and the exposure parameter.

8. A quality detection and identification method based on image color conversion matrix according to any one of claims 1 to 3, characterized in that: Prepare samples to be distinguished by color, photograph them respectively, adjust and record the fifth parameter threshold, so that each sample image obtained can distinguish the color degree; The first parameter threshold, the second parameter threshold and the third parameter threshold are replaced by the fifth parameter threshold.

9. A quality detection and identification method based on image color conversion matrix according to any one of claims 1 to 3, characterized in that: The sizes of the color card, the first color card and the second color card are similar to the size of the target object.

Citation Information

Patent Citations

  • A method for generating a port-wine stain color chart based on grayscale segmentation and Lab color clustering

    CN113034467B

  • Color data extraction method for color card image at any angle

    CN117036513A