Method and device for calculating color abnormal value number based on LAB color channel, and readable storage medium
By calibrating color outliers in the LAB color space and calculating interpolation, the subjective error problem of medical image color analysis is solved, and the quantification and accurate judgment of color pathological significance is realized, and precise treatment is supported.
Patent Information
- Application Number
- CN202410389731.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-02
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, the color analysis of medical images depends on the subjective judgment of professional doctors, resulting in errors in the pathological analysis results, and lack of quantitative judgment methods for color outliers, making it difficult to accurately evaluate the degree of abnormality of the disease.
By calibrating the L value, A value, and B value of the specified color in the LAB color space, the number of color outliers in a specific area is calculated, and the color outliers of each pixel point are calculated using the interpolation formula to quantify and digitize the color pathological significance.
It eliminates subjective judgment errors, realizes the precise quantification and digitization of color pathological significance, improves the accuracy of judging the degree of disease abnormality, and supports precise treatment.
Smart Images

Figure CN120374490A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical image processing. Specifically, it relates to a method for calculating the number of color outliers based on the Lab color channel, a computer device, and a computer-readable storage medium. Background Art
[0002] Medical images refer to image data obtained through medical imaging devices (such as X-ray, CT scan, MRI, ultrasound, etc.) for medical diagnosis, research, and treatment. Medical images play an important role in clinical medicine and medical research, and can help doctors understand the internal anatomical structure, pathological changes, and disease status of the human body. Medical images usually reveal some undesired pathological changes. Generally, when professional doctors diagnose medical images, they usually conduct in-depth analysis and judgment based on the texture features, structural features, morphological features, etc. in the medical images, and then obtain a diagnosis result. This diagnosis result largely depends on the experience and professional knowledge of professional doctors.
[0003] Currently, professional doctors face various challenges in the complexity of interpreting medical images. When professional doctors analyze pathological changes based on the color features in medical images, the analysis results are often subjectively judged by professional doctors on the pathological significance of colors. Therefore, there are usually certain errors in the analysis results. Even in some related technologies, scores corresponding to red, black, white, yellow, etc. in medical images are calculated based on the Lab color channel respectively. However, according to the score corresponding to red, it is not possible to scientifically distinguish whether the red is dark red or light red, and there is no corresponding method in the existing technology to quantitatively judge. Therefore, it is not possible to accurately judge the abnormal degree of human diseases through the score corresponding to red.
[0004] In addition to analyzing pathological changes based on the color features in medical images, there are many other perspectives in the existing technology to evaluate the pathological significance of medical images, but few researchers quantify the pathological significance of medical images based on the calculated color outliers.
[0005] The outlier corresponding to each color can reflect the abnormal degree of a certain disease suffered by the human body. Taking "Comprehensive Quantitative Evaluation Method of Conjunctival Microcirculation" as an example, the score of blood color can be set as the outlier. The score of bright red blood color is 0, the score of light red or dark red is 0.2, and the score of pale or dark purple is 0.6. After weighted statistics, this score can be used as a reference for disease diagnosis. For example, the comprehensive integral value of conjunctival microcirculation of patients in the first stage of hypertension is 10.1±5.6; the comprehensive integral value of conjunctival microcirculation of patients in the second stage of hypertension is 13.8±6.1; the comprehensive integral value of conjunctival microcirculation of patients in the third stage of hypertension is 17.3±6.6. The outlier in this case can be used to judge the stage of hypertension, that is, the abnormal degree of normal blood pressure, so as to achieve the purpose of quantifying and digitizing the pathological significance of colors.
[0006] In the related art, a staining normalization system and method based on LAB color space matching (CN117058014A) are disclosed. This technical solution uses the LAB color space and realizes modifying the staining of different pathological sections to the same standard through methods such as image acquisition, image analysis, image training, and image integration, eliminating the staining differences between different pathological sections. Although the pathological sections under different conditions are made into the same standard, the color differences between different pathological sections are not quantified.
[0007] Therefore, how to accurately calculate the color outlier of a specific region of a certain medical image, and then accurately judge the abnormal degree of the disease suffered by the human body corresponding to the medical image based on this color outlier is an urgent problem for us to solve. Summary of the Invention
[0008] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0009] To this end, the first object of the present invention is to propose a method for calculating the number of color outliers based on LAB color channels.
[0010] The second object of the present invention is to propose a computer device.
[0011] The third object of the present invention is to propose a computer-readable storage medium.
[0012] To achieve the above object, a technical solution of the first aspect of the present invention provides a method for calculating the number of color outliers based on the LAB color channel. The method includes: Step S1: Calibrate the outliers corresponding to each of several specified colors, determine the L value, A value, and B value corresponding to each of the several specified colors, and name the respective points (Ln, An, Bn) corresponding to the several specified colors in the LAB space as calibration points; wherein, the outliers corresponding to each color can reflect the abnormal degree of a certain disease suffered by the human body; Step S2: Obtain a picture for which the user needs to calculate the number of color outliers; Step S3: Select a specific area in the picture for which the number of color outliers needs to be calculated; Step S4: Calculate the number of color outliers in the specific area based on the outliers corresponding to each of the several specified colors, and the L value, A value, and B value corresponding to each of the several specified colors; The step S4 specifically includes: Step S4.1: Divide the specific area into several pixel points, and calculate the number of pixel points in the specific area; Step S4.2: Calculate the number of color outliers corresponding to each pixel point in the specific area based on the outliers corresponding to each of the several specified colors, and the L value, A value, and B value corresponding to each of the several specified colors; Step S4.3: Calculate the arithmetic mean of the number of color outliers corresponding to all pixel points based on the number of color outliers corresponding to each pixel point and the number of pixel points in the specific area; wherein, the calculated arithmetic mean is the number of color outliers in the specific area.
[0013] Preferably, the step S4.2 specifically includes: Step S4.21: Calculate the respective color distances between each calibration point and a certain specified pixel point in the specific area for which the number of color outliers needs to be calculated through a first preset formula, and screen out two calibration points with the smallest color distances from the calculated respective color distances; wherein, the expression of the first preset formula is:
[0014]
[0015] In formula (1), d is the respective color distances between each calibration point and a certain specified pixel point in the specific area for which the number of color outliers needs to be calculated; (Lx, Ax, Bx) is the coordinate of a certain specified pixel point in the specific area for which the number of color outliers needs to be calculated in the LAB space;
[0016] Step S4.22: Set the coordinates of the two calibration points with the smallest color distances screened out from the respective color distances in the LAB space as point 1 (L1, A1, B1) and point 2 (L2, A2, B2) respectively, and set the color outliers corresponding to point 1 and point 2 as h1 and h2 respectively; wherein, d点1 <d 点2 ; d 点1 and d 点2 are the color distances between point 1, point 2 and a certain specified pixel point for which the number of color outliers to be calculated within the specific region respectively; Step S4.23: Calculate the interpolation t based on the luminance channel L through a second preset formula L , calculate the interpolation t based on the chrominance channel A through a third preset formula A , and calculate the interpolation t based on the chrominance channel B through a fourth preset formula B to determine the relative position of the certain specified pixel point between point 1 and point 2;
[0017] Among them, the expression of the second preset formula is:
[0018]
[0019] The expression of the third preset formula is:
[0020]
[0021] The expression of the fourth preset formula is:
[0022]
[0023] Step S4.24: If the calculated t L , t A or t B is less than 0, then take the interpolation t L , t A or t B corresponding to the calculation result less than 0 as 0; Step S4.25: Calculate the color outlier h of the specified pixel point based on the luminance channel L through a fifth preset formula L , calculate the color outlier h of the specified pixel point based on the chrominance channel A through a sixth preset formula A , and calculate the color outlier h of the specified pixel point based on the chrominance channel B through a seventh preset formula B ;
[0024] Among them, the expression of the fifth preset formula is:
[0025] h L =(1 - t L ) * h1 + t L * h2(5)
[0026] The expression of the sixth preset formula is:
[0027] h A =(1 - t A)*h1 + t A *h2(6)
[0028] The expression of the seventh preset formula is:
[0029] h B = (1 - t B )*h1 + t B *h2(7)
[0030] Step S4.26: Calculate the number of color anomaly values corresponding to the specified pixel through the eighth preset formula; the expression of the eighth preset formula is:
[0031]
[0032] Step S4.27: Repeat steps S4.21 to S4.26 until the number of color anomaly values corresponding to each pixel in the specific area is calculated.
[0033] Preferably, referring to the standard color image data GB_T 18721.2 - 2017 encoded by the national standard XYZ / sRGB, determine the L value, A value, and B value corresponding to each of the several specified colors.
[0034] In the technical solution of the second aspect of the present invention, a computer device is further provided. The computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the method for calculating the number of color anomaly values based on the LAB color channels in any of the above technical solutions are implemented.
[0035] In the technical solution of the third aspect of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for calculating the number of color anomaly values based on the LAB color channels in any of the above technical solutions are implemented.
[0036] Advantages of the present invention:
[0037] (1) The method for calculating the number of color outliers based on the LAB color channel provided by the present invention first defines the concept of outliers for different colors, determines the relationship between the outliers and the L value, A value, and B value in the corresponding LAB color space, achieving the purpose of allowing users to define outliers for different colors and using the LAB channel values (i.e., the L value, A value, and B value corresponding to each color) to describe colors. Further, by dividing a specific area in the picture selected by the user for calculating the number of color outliers into several pixel points, and then calculating the number of color outliers corresponding to each pixel point in the specific area, the number of color outliers in the specific area can be calculated. The calculation process is simple, eliminating the error in the pathological significance caused by the subjective judgment of colors by professional doctors, quantifying and digitizing the pathological significance of colors, and at the same time realizing the transformation of clinical research from qualitative to quantitative.
[0038] (2) The method for calculating the number of color outliers based on the LAB color channel provided by the present invention improves the accuracy of judging the pathological significance of colors, realizes the accurate judgment of the pathological significance of colors, and can give accurate treatment in combination with the judgment.
[0039] The additional aspects and advantages of the present invention will become apparent in the following description or be understood through the practice of the present invention. Brief Description of the Drawings
[0040] Figure 1 A flowchart showing the method for calculating the number of color outliers based on the LAB color channel according to an embodiment of the present invention;
[0041] Figure 2 Shows Figure 1 The flowchart of step S4 in
[0042] Figure 3 A schematic block diagram showing a computer device according to an embodiment of the present invention. Detailed Description of the Embodiments
[0043] In order to more clearly understand the above objects, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.
[0044] Many specific details are set forth in the following description in order to fully understand the present invention. However, the present invention may be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the limitations of the specific embodiments disclosed below.
[0045] Figure 1The flowchart shows the method for calculating the number of color outliers based on the LAB color channels according to an embodiment of the present invention. Figure 2 shows Figure 1 the flowchart of step S4 in Figure 1 As shown, the method for calculating the number of color outliers based on the LAB color channels includes:
[0046] Step S1: Calibrate the outliers corresponding to each of several specified colors, determine the L value, A value, and B value corresponding to each of several specified colors, and name each point (Ln, An, Bn) corresponding to several specified colors in the LAB space as a calibration point;
[0047] Step S2: Obtain the image for which the user needs to calculate the number of color outliers;
[0048] Step S3: Select a specific area in the image for which the number of color outliers needs to be calculated;
[0049] Step S4: Calculate the number of color outliers in the specific area based on the outliers corresponding to each of several specified colors, and the L value, A value, and B value corresponding to each of several specified colors;
[0050] As Figure 2 shown, step S4 specifically includes:
[0051] Step S4.1: Divide the specific area into several pixel points and calculate the number of pixel points in the specific area;
[0052] Step S4.2: Calculate the number of color outliers corresponding to each pixel point in the specific area based on the outliers corresponding to each of several specified colors, and the L value, A value, and B value corresponding to each of several specified colors;
[0053] Step S4.3: Calculate the arithmetic mean of the number of color outliers corresponding to all pixel points based on the number of color outliers corresponding to each pixel point and the number of pixel points in the specific area.
[0054] In this embodiment, it is necessary to calibrate meaningful outliers for each of several specified colors. The outliers corresponding to each color can reflect the abnormal degree of a certain disease suffered by the human body.
[0055] In this embodiment, the calculated arithmetic mean is the number of color outliers in the specific area.
[0056] In this embodiment, first, the user needs to calibrate the outliers corresponding to any number of specified colors according to the actual needs, then obtain the picture for which the user needs to calculate the number of color outliers, and then select a specific area in the picture for which the number of color outliers needs to be calculated. Based on the outliers corresponding to each of several specified colors, as well as the L value, A value, and B value corresponding to each of several specified colors, the number of color outliers in this specific area is calculated. The following elaborates on the process of calculating the number of color outliers in the specific area. Specifically, first, the specific area is divided into several pixel points, the number of pixel points in the specific area is calculated, and then, based on the outliers corresponding to each of several specified colors, as well as the L value, A value, and B value corresponding to each of several specified colors, the number of color outliers corresponding to each pixel point in the specific area is calculated. Finally, the arithmetic mean of the number of color outliers corresponding to all pixel points is calculated, and this calculated arithmetic mean is the number of color outliers in the specific area.
[0057] In this embodiment, the method for calculating the number of color outliers based on the LAB color channel provided by the present invention first defines the concept of outliers for different colors, determines the relationship between the outliers and the L value, A value, and B value in the corresponding LAB space, achieving the purpose of allowing users to define outliers for different colors and using the LAB channel values (i.e., the L value, A value, and B value corresponding to each color) to describe colors. Further, by dividing the specific area in the picture selected by the user for which the number of color outliers needs to be calculated into several pixel points, and then calculating the number of color outliers corresponding to each pixel point in the specific area, the number of color outliers in this specific area can be calculated. The calculation process is simple, eliminating the error in the pathological significance caused by the subjective judgment of colors by professional doctors, quantifying and digitizing the pathological significance of colors, and at the same time realizing the transformation of clinical research from qualitative to quantitative.
[0058] In an embodiment of the present invention, step S4.2 specifically includes:
[0059] Step S4.21: Calculate the respective color distances between each calibration point and a certain specified pixel point in the specific area for which the number of color outliers needs to be calculated through a first preset formula, and select the two calibration points with the smallest color distances from the calculated respective color distances; wherein, the expression of the first preset formula is:
[0060]
[0061] In formula (1), d represents the respective color distances between each calibration point and a certain specified pixel point among the color anomaly values to be calculated within the specific region; (Lx, Ax, Bx) represents the coordinates of a certain specified pixel point among the color anomaly values to be calculated within the specific region in the LAB color space.
[0062] Step S4.22: Set the coordinates of the two calibration points with the smallest selected color distances in the LAB color space as point 1 (L1, A1, B1) and point 2 (L2, A2, B2) respectively, and set the corresponding color anomaly values of point 1 and point 2 as h1 and h2 respectively; where d 点1 <d 点2 ; d 点1 and d 点2 are respectively the color distances between point 1, point 2 and a certain specified pixel point among the color anomaly values to be calculated within the specific region.
[0063] Step S4.23: Calculate the interpolation t based on the luminance channel L through a second preset formula L , calculate the interpolation t based on the chrominance channel A through a third preset formula A , and calculate the interpolation t based on the chrominance channel B through a fourth preset formula B to determine the relative position of the certain specified pixel point between point 1 and point 2.
[0064] Among them, the expression of the second preset formula is:
[0065]
[0066] The expression of the third preset formula is:
[0067]
[0068] The expression of the fourth preset formula is:
[0069]
[0070] Step S4.24: If the calculated t L , t A or t B is less than 0, then set the interpolation t L , t A or t B corresponding to the calculation result less than 0 to 0.
[0071] Step S4.25: Calculate the color anomaly value h of the specified pixel point based on the luminance channel L through a fifth preset formula L , calculate the color anomaly value h of the specified pixel point based on the chrominance channel A through a sixth preset formulaA , and calculating a color anomaly value h of the specified pixel point based on the chrominance channel B through a seventh preset formula B ;
[0072] Among them, the expression of the fifth preset formula is:
[0073] h L =(1 - t L ) * h1 + t L * h2(5)
[0074] The expression of the sixth preset formula is:
[0075] h A =(1 - t A ) * h1 + t A * h2(6)
[0076] The expression of the seventh preset formula is:
[0077] h B =(1 - t B ) * h1 + t B * h2(7)
[0078] Step S4.26: Calculating the number of color anomaly values corresponding to the specified pixel point through an eighth preset formula; the expression of the eighth preset formula is:
[0079]
[0080] Step S4.27: Repeatedly execute steps S4.21 to S4.26 until the number of color anomaly values corresponding to each pixel point in the specific area is calculated.
[0081] In this embodiment, in the LAB color space, first calculate the respective color distances between each calibration point and a certain specified pixel point for which the anomaly value is to be calculated through a first preset formula, and select the 2 points with the smallest color distances among them, and then calculate the interpolation parameters t L , t A and t B to determine the relative position of the specified pixel point between the two calibration points with the two closest color distances. Calculating the interpolation parameters t L , t A and t B specifically includes: setting the coordinates of the two calibration points with the smallest color distances selected from the respective color distances in the LAB color space as point 1 (L1, A1, B1) and point 2 (L2, A2, B2) respectively, and setting the corresponding color anomaly values of point 1 and point 2 as h1 and h2 respectively; where d 点1 < d 点2 ; d点1 and d 点2 are the color distances between point 1, point 2 and a certain specified pixel point for which the number of color outliers to be calculated within a specific region. Here, point 1 (L1, A1, B1) and point 2 (L2, A2, B2), h1 and h2, and d 点1 and d 点2 are all known. Furthermore, the interpolation t based on the luminance channel L is calculated through a second preset formula L , the interpolation t based on the chrominance channel A is calculated through a third preset formula A , and the interpolation t based on the chrominance channel B is calculated through a fourth preset formula B . If the calculated t L , t A or t B is less than 0, then the interpolation t L , t A or t B corresponding to the calculation result less than 0 is taken as 0. Further, the color outlier h of the specified pixel point based on the luminance channel L is calculated through a fifth preset formula L , the color outlier h of the specified pixel point based on the chrominance channel A is calculated through a sixth preset formula A , and the color outlier h of the specified pixel point based on the chrominance channel B is calculated through a seventh preset formula B . Furthermore, the number of color outliers corresponding to the specified pixel point is calculated through an eighth preset formula. Further, steps S4.21 to S4.26 are repeatedly executed until the number of color outliers corresponding to each pixel point within the specific region is calculated.
[0082] In this embodiment, first, the purpose of finding the known color with the closest color distance is achieved: for the color for which the outlier is to be calculated, it is necessary to find the color with the closest color distance among the known colors, which can be achieved by calculating the distance between the LAB channel values. Furthermore, the calculation of the interpolation parameters t L , t A and t B is realized: through the LAB channel values between the known color and the color for which the outlier index is to be calculated, the interpolation parameters are calculated to determine the relative position of the specified pixel point between the two calibration points with the smallest color distance selected from among the various color distances. Furthermore, the interpolation parameters t L , t A and t B, and calculate the outliers h1 and h2 corresponding to the two calibration points with the smallest color distance: Use the interpolation parameter to linearly interpolate the outliers of the known colors to calculate the outlier index value of the color to be calculated. Furthermore, apply the defined outliers: According to the user's definition, determine how to use the calculated outliers. The user defines the outliers of a series of colors and uses interpolation to calculate the outliers of other colors based on the relationship between the known colors and the LAB channel values.
[0083] The method for calculating the color outlier number based on the LAB color channel provided by the present invention improves the accuracy of judging the pathological significance of colors, realizes the accurate judgment of the pathological significance of colors, and can give precise treatment in combination with the judgment.
[0084] In an embodiment of the present invention, the number of the several specified colors is 25.
[0085] There is no specific requirement for the number of calibrated colors. In theory, the more the number of calibrated colors, the more accurate the calculated result and the more in line with the actual meaning. In this embodiment, the number of the several specified colors is 25, achieving the experimental purpose of the method for calculating the color outlier number based on the LAB color channel of the present invention.
[0086] In an embodiment of the present invention, referring to the standard color image data GB_T18721.2 - 2017 encoded by the national standard XYZ / sRGB, determine the L value, A value, and B value corresponding to each color among the several specified colors.
[0087] In an embodiment of the present invention, the user can also, according to their actual needs, define the L value, A value, and B value corresponding to each color among the several specified colors by themselves.
[0088] Figure 3 Shows a schematic block diagram of a computer device according to an embodiment of the present invention. As Figure 3 shown, a computer device 300 includes: a memory 302, a processor 304, and a computer program stored on the memory 302 and executable on the processor 304. When the processor 304 executes the computer program, it implements the steps of the method for calculating the color outlier number based on the LAB color channel in any of the above embodiments.
[0089] For the computer device 300 provided by the present invention, when the processor 304 executes a computer program, the concept of outliers of different colors is first defined, and the relationship between the outlier and the L value, A value, and B value in the corresponding LAB space is determined, achieving the purpose of allowing users to define outliers of different colors and using LAB channel values (i.e., the L value, A value, and B value corresponding to each color) to describe colors. Further, by dividing a specific area in the picture selected by the user for calculating the number of color outliers into several pixel points, and then calculating the number of color outliers corresponding to each pixel point in the specific area, the number of color outliers in the specific area can be calculated. The calculation process is simple, eliminating the error in pathological significance caused by the subjective judgment of professional doctors on colors, quantifying and digitizing the pathological significance of colors, and at the same time realizing the transformation of clinical research from qualitative to quantitative. Further, the accuracy of judging the pathological significance of colors is improved, the accurate judgment of the pathological significance of colors is realized, and accurate treatment can be given in combination with the judgment.
[0090] The present invention also proposes a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for calculating the number of color outliers based on the LAB color channel in any of the above embodiments are implemented.
[0091] For the computer-readable storage medium provided by the present invention, when the computer program is executed by a processor, the concept of outliers of different colors is first defined, and the relationship between the outlier and the L value, A value, and B value in the corresponding LAB space is determined, achieving the purpose of allowing users to define outliers of different colors and using LAB channel values (i.e., the L value, A value, and B value corresponding to each color) to describe colors. Further, by dividing a specific area in the picture selected by the user for calculating the number of color outliers into several pixel points, and then calculating the number of color outliers corresponding to each pixel point in the specific area, the number of color outliers in the specific area can be calculated. The calculation process is simple, eliminating the error in pathological significance caused by the subjective judgment of professional doctors on colors, quantifying and digitizing the pathological significance of colors, and at the same time realizing the transformation of clinical research from qualitative to quantitative. Further, the accuracy of judging the pathological significance of colors is improved, the accurate judgment of the pathological significance of colors is realized, and accurate treatment can be given in combination with the judgment.
[0092] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for calculating the number of color outliers based on the LAB color channel, characterized in that Including: Step S1: Calibrate the outlier values corresponding to each of several specified colors, determine the L value, A value, and B value corresponding to each of the several specified colors, and name the respective points (Ln, An, Bn) corresponding to the several specified colors in the LAB color space as calibration points; wherein, the outlier value corresponding to each color can reflect the abnormal degree of a certain disease suffered by a human body. Step S2: Obtain an image for which the user needs to calculate the number of color outlier values. Step S3: Select a specific area in the image for which the number of color outlier values needs to be calculated. Step S4: Based on the outlier value corresponding to each of the several specified colors and the L value, A value, and B value corresponding to each of the several specified colors, calculate the number of color outlier values for the specific area. The specific implementation of step S4 includes: Step S4.1: Divide the specific area into several pixel points and calculate the number of pixel points within the specific area. Step S4.2: Based on the outlier value corresponding to each of the several specified colors and the L value, A value, and B value corresponding to each of the several specified colors, calculate the number of color outlier values corresponding to each pixel point within the specific area. Step S4.3: Based on the number of color outlier values corresponding to each pixel point and the number of pixel points within the specific area, calculate the arithmetic mean of the number of color outlier values corresponding to all pixel points; wherein, the calculated arithmetic mean is the number of color outlier values for the specific area.
2. The method for calculating the number of color anomaly values based on the LAB color channel according to claim 1, wherein The specific implementation of step S4.2 includes: Step S4.21: Calculate the respective color distances between each calibration point and a certain specified pixel point for which the number of color outlier values needs to be calculated within the specific area through a first preset formula, and screen out two calibration points with the smallest color distances from the calculated respective color distances; wherein, the expression of the first preset formula is: In formula (1), d is the respective color distances between each calibration point and a certain specified pixel point for which the number of color outlier values needs to be calculated within the specific area; (Lx, Ax, Bx) is the coordinate of a certain specified pixel point for which the number of color outlier values needs to be calculated within the specific area in the LAB color space. Step S4.22: Set the coordinates of the two calibration points with the smallest color distances selected from the respective color distances in the LAB space as point 1 (L1, A1, B1) and point 2 (L2, A2, B2), and set the corresponding color outliers of point 1 and point 2 as h1 and h2 respectively; where d 点1 < d 点2 ; d 点1 and d 点2 are the color distances between point 1, point 2 and a certain specified pixel point of the number of color outliers to be calculated in the specific area respectively; Step S4.23: Calculate the interpolation t based on the luminance channel L through a second preset formula L , calculate the interpolation t based on the chrominance channel A through a third preset formula A , and calculate the interpolation t based on the chrominance channel B through a fourth preset formula B , to determine the relative position of the certain specified pixel point between point 1 and point 2; Wherein, the expression of the second preset formula is: The expression of the third preset formula is: The expression of the fourth preset formula is: Step S4.24: If the calculated t L , t A or t B is less than 0, then the interpolation t L , t A or t B corresponding to the calculation result less than 0 is set to 0; Step S4.25: Calculate the color anomaly value h of the specified pixel point based on the luminance channel L through the fifth preset formula L , calculate the color anomaly value h of the specified pixel point based on the chrominance channel A through the sixth preset formula A , and calculate the color anomaly value h of the specified pixel point based on the chrominance channel B through the seventh preset formula B ; Wherein, the expression of the fifth preset formula is: h L = (1 - t L ) * h1 + t L * h2(5) The expression of the sixth preset formula is: h A = (1 - t A ) * h1 + t A * h2(6) The expression of the seventh preset formula is: h B = (1 - t B ) * h1 + t B * h2(7) Step S4.26: Calculate the number of color outlier values corresponding to the specified pixel point through an eighth preset formula; the expression of the eighth preset formula is: Step S4.27: Repeat steps S4.21 to S4.26 until the number of color outlier values corresponding to each pixel point within the specific area is calculated.
3. The method for calculating the number of color outliers based on the LAB color channel according to claim 1 or 2, characterized in that, Determine the L value, A value, and B value corresponding to each of the several specified colors with reference to the standard color image data GB_T 18721.2-2017 encoded according to the national standard XYZ / sRGB.
4. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for calculating the number of color outliers based on the LAB color channels as described in any one of claims 1 to 3.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for calculating the number of color outliers based on the LAB color channels as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Dyeing normalization system and method based on LAB color space matching
CN117058014A