Skin image spot identification and quantitative evaluation method based on RGB color space
By using a skin image processing algorithm based on the RGB color space, the number, area, depth, and prominence of spots in skin images are identified and calculated, solving the problem of inaccurate quantitative assessment of spots in existing technologies and achieving efficient quantitative assessment of spot features.
Patent Information
- Application Number
- CN202410542319.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-30
- Publication Date
- 2025-10-31
AI Technical Summary
Existing technologies are not very accurate in skin image spot recognition and quantitative assessment, especially in calculating the number, area, depth, and obviousness of spots in the RGB color space, which leads to inaccurate quantitative assessment.
A skin image processing algorithm based on the RGB color space is adopted. A grayscale image is generated by combining blue and green color components, and downsampling and seed point identification are performed to expand the spot area. The four-connectivity algorithm is used to identify and calculate the spot attributes, including the number, area, depth and obviousness.
It achieves highly accurate identification and quantitative evaluation of spots in skin images, and can quickly calculate multiple attribute values of spots, thus improving the accuracy and efficiency of quantitative evaluation of skin spot features.
Smart Images

Figure CN120876349A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to skin spot recognition and evaluation technology, specifically to a method for skin image spot recognition and quantitative evaluation based on RGB color space. This invention employs computer graphics algorithms and computer image processing algorithms, and belongs to the field of computer image and skin image processing application technology. Background Technology
[0002] The various properties of the skin surface are important indicators in research on skin aging and anti-aging, and also one of the important indicators for the objective evaluation of skin care products. The intuitive, objective, and quantitative identification and quantitative calculation of the attribute values of various features in skin images is one of the research hotspots in the field of skin image processing. One important application is the identification and calculation of spot features on the skin surface.
[0003] Currently, the accuracy of identifying and calculating various skin surface features both domestically and internationally is not very high, and there are very few algorithms specifically designed for skin image feature recognition. Using computer graphics algorithms and computer image processing techniques to extract skin surface features and calculate skin surface feature attribute values allows for the quantitative assessment of skin characteristics.
[0004] Skin image features include color, texture, blemishes, gloss, pores, and sebaceous deposits. Among these, blemishes are a crucial skin characteristic, and their number, average area, proportion, depth, and prominence are important metrics for skin health. Computer image processing techniques for blemish identification have emerged in recent years. The main idea is to perform simple thresholding on the color value of each pixel in the RGB (or HSV) color space to obtain blemish pixels. However, this method produces many false blemishes, affecting the accuracy of quantitative assessment. Furthermore, it only studies individual pixels, neglecting the concepts of lines and surfaces, making it impossible to calculate many metrics such as the number, depth, and size of blemishes. Summary of the Invention
[0005] The purpose of this invention is to provide a method for skin image spot recognition and quantitative evaluation based on the RGB color space. This method calculates attribute values such as the number, average area, proportion, depth, and prominence of spots in a skin image based on the pixel color values in the RGB color space. First, spots in the skin image are identified; then, multiple attribute values of the identified spots are quantitatively calculated to evaluate the characteristics of the skin spots.
[0006] In this invention, the skin image is a facial skin image. The algorithm uses a single color skin image as the sole data source to identify skin spots and calculate quantitative values for multiple attributes of the skin spots: a grayscale image is obtained by calculating a fixed combination of blue and green color components; the grayscale image is downsampled to reduce the image resolution; seed points for spots are determined and sorted on the low-resolution image; for each seed point, the spot region is gradually expanded and stopped under appropriate conditions to determine the spot pixel region corresponding to the seed point; the spot outline and spot region pixels are trimmed to obtain the final set of spot pixels; a four-connectivity algorithm is used to obtain individual spot patches, and the area, depth, and prominence of each individual spot are calculated; based on the information of all individual spots, the number, average area, proportion, depth, and prominence of spots in the entire image are statistically analyzed.
[0007] The proposed method for quantitative evaluation of skin image spots based on RGB color space can perform calculations on color digital skin images of various resolutions, identify and draw the outer contour lines of spots on the skin image, and calculate multiple attribute values of the spots. These values can quantitatively evaluate the spot characteristics on the surface of the skin image.
[0008] This invention mainly includes the following contents:
[0009] A grayscale image img1 is obtained by a fixed combination of the blue and green color components of a skin image, as follows:
[0010] An RGB image has three different color components. The blue and green components are weighted and summed to obtain a grayscale image img1. The weighted summation method is as follows: Gray = G × 0.15 + B × 0.85, where Gray is the grayscale value of a pixel in the img1 image, and G and B are the green and blue color components of the corresponding pixel in the input image. The grayscale value Gray ranges from [0, 255].
[0011] B. Downsampling is performed on the grayscale image img1 to reduce the image resolution, resulting in a low-resolution image img2. The specific method is as follows:
[0012] The downsampling step size is fixed at 4. The image img1 is traversed. The grayscale mean of 16 pixels in each 4*4 pixel square area in the image img1 is calculated and used as the grayscale value of a pixel in the downsampled image img2. Areas smaller than 4*4 are discarded (not sampled). The size of the downsampled image img2 is 1 / 16 of the size of the original image img1.
[0013] C. Determine seed points on the low-resolution grayscale image img2, and sort the seed points in ascending order of grayscale value. The specific steps are as follows:
[0014] C1. Image img2 is divided into uniform blocks;
[0015] The image img2 is evenly divided into 6*6 sub-blocks. For each sub-block, calculate the average gray value of the sub-block respectively, with a total of 36 sub-blocks and 36 average gray values of the sub-blocks;
[0016] C2. On the image img2, determine the seed points. The specific method is as follows:
[0017] Traverse all the pixels of the image img2. For each pixel P1, according to the position of the pixel P1, determine its所属 sub-block (the sub-block in step C1) and the average gray value avg1 of the sub-block. Given the seed point threshold tSeed = avg1 - 22 and the dark area threshold t1 = avg1 – 117. The gray value of the pixel p1 on the image img2 is v1. If v1>tSeed, the color of the p1 point is not dark enough, and the p1 point is judged as a non-seed point; if v1<t1, the color of the p1 point is too dark, and it is also judged as a non-seed point; other pixel points are determined as seed points;
[0018] C3. Sort the seed points. The method is as follows: [[ID=1十三]]
[0019] The seed points determined in step C2 are sorted in ascending order according to their gray values on the image img2 to obtain the seed point sequence S1
[0020] D. Expand the seed points so that the small area around each seed point is a speckle pixel. The specific steps are as follows:
[0021] D1. Define all the pixels on the outer contour of a single speckle as set L, define all the pixels constituting a single speckle as set T, and define that each pixel has four identifiers: contour, contour1, speckle, background. Each identifier is actually represented by a value between 1 and 250 defined arbitrarily;
[0022] D2. Initialize L and T as empty sets. Add the seed point pixel P to the speckle contour line set L, and the identifier of the P point is "contour";
[0023] All the pixel points in set L are sorted in ascending order according to their gray values on the image img2 to obtain the pixel sequence S;
[0024] D4. Traverse the pixel sequence S from the beginning, find the first pixel point with the identifier "contour" as the active pixel point P2, and make different treatments according to the existence of the P2 point;
[0025] After step D4.1.5 or step D4.2 ends the expansion of the seed points, obtain the internal pixel set T of a single speckle and the pixel set L on the outer contour of a single speckle;
[0026] D6. Traverse each seed point P in the seed point sequence S1 (step C3). If P is not marked as a "spot", repeat steps D2 to D5 until the process of expanding all seed points into spot blocks is completed (the traversal of sequence S1 is completed), and obtain the labeled image Img3 of image Img2. Each pixel in image Img3 is labeled as: spot, outline, outline 1, background.
[0027] E. Post-processing of spots and outlines, merging spot patches, the specific steps are as follows:
[0028] E1. Spot trimming and treatment of cavities within spot patches;
[0029] E2. Outline refining and spot merging;
[0030] The image obtained after post-processing of E3 image img3 is identified as Img4;
[0031] F. The 4-connectivity algorithm identifies individual blobs and calculates their attributes. The specific steps are as follows:
[0032] The F1 image Img4 has a value for each pixel that is one of four values: blob, contour, contour1, and background. The four-connected method identifies the pixel set W of a single blob patch.
[0033] F2 calculates the number of pixels, average gray value, and visibility of pixels in set W.
[0034] F3 repeats steps F1 and F2 until step F1.1 can no longer find a pixel marked as a "spot" on the Img4 image. Each repetition is a single spot. The number of spots on the entire skin image is recorded as spotNum (the number of times steps F1 and F2 are repeated).
[0035] G. Statistically analyze the average area, number, proportion, depth, and visibility of spots in the entire skin image. The specific steps are as follows:
[0036] G1. Number of spots, spotNum in step F3 is the number of spots;
[0037] G2. Average spot area: In step F2.1, the area of a single spot s1 was calculated. The sum of the areas of all single spots sSum is calculated. The average spot area = sSum / spotNum.
[0038] G3. Spot depth: In step F2.2, the depth avg5 of a single spot was calculated. The sum of the avg5 values of all individual spots is avg5Sum. Spot depth avg6 = avg5Sum / spotNum.
[0039] G4. Spot prominence, the mean of the prominence of all individual spots compared to (F2.3);
[0040] G5. Spot Ratio: The ratio of the total number of spot pixels (sSum in step G2) to the total number of pixels in the entire image is defined as the spot ratio.
[0041] Further, in step D4;
[0042] D4.1 If there is an active pixel P2, record its grayscale value as P2Gray, process the four pixels above, below, left, and right of P2 respectively, and process each of the four pixels as P3.
[0043] D4.2 If the active pixel P2 does not exist, the outline of the seed point P is determined and will not expand outward.
[0044] Further, in step D4.1;
[0045] D4.1.1 Mark pixel P3 and change the identifier of pixel P2;
[0046] D4.1.2 Calculate the bounding box of the pixels on the contour line (in set L), the number of pixels inside the bounding box and outside the contour line countOut, and the gray mean of all pixels inside the bounding box in image Img1 (step A) aveBox.
[0047] D4.1.3 Calculate the mean gray value aveIn and the number of pixels (countIn) of the blot (in set T);
[0048] In D4.1.4, the grayscale threshold Tgray is set to 3, and the maximum area of the blob is set to Max1 = 115 (in pixels).
[0049] D4.1.5 If condition 1 (P2Gray > aveIn + Tgray and countIn > Max1) or condition 2 (countOut > countIn) is satisfied, the outline of the spot of the seed point P is determined and will not expand outward.
[0050] Further, in step D4.1.1;
[0051] D4.1.1.1 If point P3 exceeds the valid range of the image boundary row or column, that is, point P3 is not on image img2, P3 is not added to set L, and P2 is marked as "outline 1";
[0052] D4.1.1.2 If P3 has already been identified as a "spot", P3 is not added to set L, and P2 is identified as a spot and added to set T;
[0053] D4.1.1.3 If P3 has already been identified as a "contour", P3 is not added to set L; P2 is identified as a spot and added to set T.
[0054] D4.1.1.4 If P3 is not one of the three cases above, label P3 as "outline" and add P3 to set L; label P2 as "spot" and add it to set T.
[0055] Further, in step E1;
[0056] E1.1 Traverse each “background” identifier pixel P3 of image Img3 (step D6);
[0057] E1.2 Count the number n of the four pixels above, below, left and right of P3 that are labeled as "outline" or "outline 1";
[0058] E1.3 If n>=3, change the label of point P3 to "outline";
[0059] E1.4 Repeat steps E1.1 to E1.3 until no more conditions in E1.3 are met, then end the hole repair of the spot;
[0060] Further, in step E2;
[0061] E2.1 Traverse each pixel P4 in image Img3 that is identified as "outline" or "outline 1";
[0062] E2.2 Count the number m of the four pixels above, below, left and right of P4 that are labeled as "outline", "outline 1" or "spot";
[0063] E2.3 If m=4, change the label of point P4 to "spot".
[0064] E2.4 Repeat steps E2.1 to E2.3 until no more conditions in E2.3 are met, then end the spot merging process;
[0065] Further, in step F1;
[0066] F1.1 Traverse the image Img4, find the first pixel identified as "blob" and push it onto stack stackA, and define the pixel set W of the blob patch as an empty set;
[0067] F1.2 Pop a pixel P5 from stack stackA, change the pixel value to "background" to indicate that the pixel has been traversed, increment the count by 1, and place p5 into set W;
[0068] F1.3 Process the four adjacent pixels q of p5 one by one. If the value of q is "spot", check if point q is in stack stackA. If not, push point q onto stackA.
[0069] F1.4 Repeat steps F1.2 and F1.3 until there are no pixels in stack A. At this point, set W is the set of all pixels of a spot, and the pop count is the total number of pixels in a spot. count can also indicate the area size of a single spot.
[0070] Further, in step F2;
[0071] F2.1 Single spot area s1: Number of pixels in set W;
[0072] F2.2 The depth of a single spot is calculated by taking the grayscale value avg5 of the pixels in the set W on the image Img1 (step A). avg5 is defined as the depth of the spot.
[0073] F2.3 Distinctness of a single spot, contrast = aveBox - avg5, where aveBox is calculated in step D4.1.2 and avg5 is calculated in F2.2;
[0074] All pixels within set W of F2.4 are designated as "background";
[0075] This invention provides a method for skin image spot recognition and quantitative evaluation based on the RGB color space. It identifies skin surface spots in a skin image based on the RGB color values of the skin image pixels and calculates multiple attribute values for the spots, achieving quantitative evaluation of skin image spots. In this invention, the skin image is the only input parameter. It utilizes computer graphics algorithms and computer image algorithms to identify skin spots and calculate spot indices. This method offers high accuracy and speed in spot identification and quantitative evaluation, and has promising market application prospects and value. Attached Figure Description
[0076] Figure 1 This is a flowchart of the skin image spot recognition and quantitative evaluation algorithm used in a specific implementation of the present invention.
[0077] Figure 2 This is a visualization example of a specific implementation of the present invention, which calculates partial skin images of skin spots and visualizes the recognition results.
[0078] Figure 3 This is a specific implementation of the present invention, which calculates an image of skin spots and visualizes the recognition results. Detailed Implementation
[0079] The present invention will be further illustrated below with reference to the accompanying drawings and embodiments, but the scope of the invention is not limited in any way.
[0080] This invention provides a method for identifying and quantitatively evaluating spots in skin images using the RGB color space. Based on the pixel color values in the RGB color space of the skin image, it identifies surface spots and calculates multiple attribute values for these spots. These attribute values identify the features of spots on the skin surface, thereby achieving quantitative evaluation of spots in skin images. The main steps include:
[0081] 1) A grayscale image is obtained by calculating a fixed combination of the blue and green color components in the skin image color space (RGB);
[0082] 2) Downsampling the grayscale image reduces its resolution;
[0083] 3) Identify and sort seed points on low-resolution grayscale skin images.
[0084] 4) Start from the beginning and traverse the seed point sequence one by one to process each seed point. Gradually expand the spot area starting from the seed point pixel and stop expanding under appropriate conditions to determine the set of spot pixels corresponding to the seed point and the set of pixels on its outer contour line.
[0085] 5) Perform post-processing on the spot pixel set and the outline pixel set respectively to obtain the final spot pixel set and the outer outline pixel set;
[0086] 6) The four-connectivity algorithm yields multiple individual spots, and the area, depth, and visibility of each individual spot are calculated separately.
[0087] 7) For all individual spots, statistically calculate the number, average area, proportion, depth, and visibility of skin spots in the entire image.
[0088] Specifically, the method of the present invention includes the following steps:
[0089] A. A fixed combination of the blue and green color components of the skin image yields the grayscale image img1, as follows:
[0090] A1. Read a skin image file into memory;
[0091] The only parameter of this algorithm is an RGB color space image file stored on the hard disk, which is then read into memory.
[0092] A2. Convert the color image to grayscale to obtain the grayscale image img1;
[0093] The RGB image has three different color components. By weighted summing the blue and green components, a grayscale image img1 is obtained. The calculation method of weighted summing is as follows: Gray = G × 0.15 + B × 0.85, where Gray is the grayscale value of a pixel on the img1 image, and G and B are the green and blue color components of the pixel at the same position on the corresponding input image. The range of the grayscale value Gray is [0, 255].
[0094] B. Downsample the grayscale image img1 to reduce the image resolution and obtain a low-resolution image img2. The specific method is as follows:
[0095] The downsampling step size is fixed at 4. Traverse the img1 image. Calculate the grayscale mean of the 16 pixels in each 4×4 pixel square area on the img1 image as the grayscale value of a pixel on the resulting downsampled image img2. Areas smaller than 4×4 are directly discarded (not sampled). The size of the downsampled image img2 is 1 / 16 of the size of the original image img1 before sampling.
[0096] C. Determine seed points on the low-resolution grayscale image img2 and sort the seed points in ascending order of grayscale value. The specific content is as follows:
[0097] C1. Uniformly divide the image img2 into blocks;
[0098] The image img2 is uniformly divided into 6×6 sub-blocks. Calculate the grayscale mean of each sub-block respectively, obtaining 36 grayscale means for 36 sub-blocks.
[0099] C2. Determine seed points on the image img2. The specific method is as follows:
[0100] Traverse all pixels of the image img2. For each pixel P1, determine its所属 sub-block (the sub-block in step C1) and the grayscale mean avg1 of the sub-block according to the position of pixel P1. Given the seed point threshold tSeed = avg1 - 22 and the dark area threshold t1 = avg1 – 117. The grayscale value of pixel p1 on the image img2 is v1. If v1 > tSeed, the color of point p1 is not dark enough, and p1 is determined as a non-seed point; if v1 < t1, the color of point p1 is too dark, and it is also determined as a non-seed point; other pixel points are determined as seed points.
[0101] C3. Sort the seed points;
[0102] The seed points determined in step C2 are sorted in ascending order of their grayscale values on the image img2 to obtain the seed point sequence S1
[0103] D. Expand the seed points so that the small area around each seed point is speckle pixels;
[0104] For the seed point sequence S1 in step C3, each seed point pixel P is processed one by one starting from the beginning. The specific processing steps are as follows:
[0105] D1. Define all pixels on the outer contour of a single spot as set L, define all pixels constituting a single spot as set T, and define each pixel as having four identifiers: contour, contour 1, spot, and background. Each identifier is actually an arbitrarily defined value between 1 and 250.
[0106] D2. Initialize L and T as empty sets, add seed pixel P to the spot contour set L, and label point P as "contour";
[0107] All pixels in set D3 L are sorted in ascending order of their gray values on image img2 to obtain pixel sequence S;
[0108] D4 iterates through the pixel sequence S from the beginning, finds the first pixel identified as "outline" as the active pixel P2, and performs different processing depending on whether P2 exists. The specific method is as follows:
[0109] D4.1 If an active pixel P2 exists, record its grayscale value as P2Gray. Process the four pixels above, below, left, and right of P2 respectively. The specific processing method for each of the four pixels P3 is as follows:
[0110] D4.1.1 Marking pixel P3 and changing the identifier of pixel P2 are done as follows:
[0111] D4.1.1.1 If point P3 exceeds the valid range of the image boundary row or column, that is, point P3 is not on image img2, P3 is not added to set L, and P2 is marked as "outline 1";
[0112] D4.1.1.2 If P3 has already been identified as a "spot", P3 is not added to set L, and P2 is identified as a spot and added to set T;
[0113] D4.1.1.3 If P3 has already been identified as a "contour", P3 is not added to set L; P2 is identified as a spot and added to set T.
[0114] D4.1.1.4 If P3 is not one of the three cases above, label P3 as "outline" and add P3 to set L; label P2 as "spot" and add it to set T.
[0115] D4.1.2 Calculate the bounding box of the pixels on the contour line (in set L), the number of pixels inside the bounding box and outside the contour line countOut, and the gray mean of all pixels inside the bounding box in image Img1 (step A) aveBox.
[0116] D4.1.3 Calculate the mean gray value aveIn and the number of pixels (countIn) of the blot (in set T);
[0117] In D4.1.4, the grayscale threshold Tgray is set to 3, and the maximum area of the blob is set to Max1 = 115 (in pixels).
[0118] D4.1.5 If condition 1 (P2Gray > aveIn + Tgray and countIn > Max1) or condition 2 (countOut > countIn) is satisfied, the outline of the spot of the seed point P is determined and will not expand outward.
[0119] D4.2 If the active pixel P2 does not exist, the outline of the seed point P is determined and will not expand outward.
[0120] After completing step D4.1.5 or step D4.2 to expand the seed point, we obtain the internal pixel set T of a single spot and the pixel set L on the outer contour line of a single spot.
[0121] D6. Traverse each seed point P in the seed point sequence S1 (step C3). If P is not marked as a "spot", repeat steps D2 to D5 until the process of expanding all seed points into spot blocks is completed (the traversal of sequence S1 is completed), and obtain the labeled image Img3 of image Img2. Each pixel in image Img3 is labeled as: spot, outline, outline 1, background.
[0122] E. Post-processing of spots and outlines, merging spot patches, the specific steps are as follows:
[0123] E1. Spot repair and treatment of cavities within the spot area, the specific methods are as follows:
[0124] E1.1 Traverse each “background” identifier pixel P3 of image Img3 (step D6);
[0125] E1.2 Count the number n of the four pixels above, below, left and right of P3 that are labeled as "outline" or "outline 1";
[0126] E1.3 If n>=3, change the label of point P3 to "outline";
[0127] E1.4 Repeat steps E1.1 to E1.3 until no more conditions in E1.3 are met, then end the hole repair of the spot;
[0128] E2. Outline refining and spot merging, the specific methods are as follows;
[0129] E2.1 Traverse each pixel P4 in image Img3 that is identified as "outline" or "outline 1";
[0130] E2.2 Count the number m of the four pixels above, below, left and right of P4 that are labeled as "outline", "outline 1" or "spot";
[0131] E2.3 If m=4, change the label of point P4 to "spot".
[0132] E2.4 Repeat steps E2.1 to E2.3 until no more conditions in E2.3 are met, then end the spot merging process;
[0133] The image obtained after post-processing of E3 image img3 is identified as Img4;
[0134] F. The 4-connectivity algorithm identifies individual blobs and calculates their attributes. The specific method is as follows:
[0135] In the F1 image Img4, each pixel has one of four values: blob, contour, contour1, or background. The four-connected method is used to identify the pixel set W of a single blob patch. The specific steps are as follows:
[0136] F1.1 Traverse the image Img4, find the first pixel identified as "blob" and push it onto stack stackA, and define the pixel set W of the blob patch as an empty set;
[0137] F1.2 Pop a pixel P5 from stack stackA, change the pixel value to "background" to indicate that the pixel has been traversed, increment the count by 1, and place p5 into set W;
[0138] F1.3 Process the four adjacent pixels q of p5 one by one. If the value of q is "spot", check if point q is in stack stackA. If not, push point q onto stackA.
[0139] F1.4 Repeat steps F1.2 and F1.3 until there are no pixels in stack A. At this point, set W is the set of all pixels of a spot, and the pop count is the total number of pixels in a spot. count can also indicate the area size of a single spot.
[0140] F2 calculates the number of pixels, average grayscale value, and visibility of pixels in set W. The calculation method is as follows:
[0141] F2.1 Single spot area s1: Number of pixels in set W;
[0142] F2.2 The depth of a single spot is calculated by taking the grayscale value avg5 of the pixels in the set W on the image Img1 (step A). avg5 is defined as the depth of the spot.
[0143] F2.3 Distinctness of a single spot, contrast = aveBox - avg5, where aveBox is calculated in step D4.1.2 and avg5 is calculated in F2.2;
[0144] All pixels within set W of F2.4 are designated as "background";
[0145] F3 repeats steps F1 and F2 until step F1.1 can no longer find a pixel marked as a "spot" on the Img4 image. Each repetition is a single spot. The number of spots on the entire skin image is recorded as spotNum (the number of times steps F1 and F2 are repeated).
[0146] G. Statistically analyze the average area, number, proportion, depth, and visibility of spots in the entire skin image, as follows:
[0147] G1. Number of spots, spotNum in step F3 is the number of spots;
[0148] G2. Average spot area: In step F2.1, the area of a single spot s1 was calculated. The sum of the areas of all single spots sSum is calculated. The average spot area = sSum / spotNum.
[0149] G3. Spot depth: In step F2.2, the depth avg5 of a single spot was calculated. The sum of the avg5 values of all individual spots is avg5Sum. Spot depth avg6 = avg5Sum / spotNum.
[0150] G4. Spot prominence, the mean of the prominence of all individual spots compared to (F2.3);
[0151] G5. Spot Ratio: The ratio of the total number of spot pixels (sSum in step G2) to the total number of pixels in the entire image is defined as the spot ratio.
[0152] To verify the spot recognition and quantitative evaluation method based on the RGB color space proposed in this invention, spot recognition and attribute calculation experiments were conducted on more than 1,000 skin images.
[0153] Experimental setup
[0154] In this invention, the skin image is a facial skin image, generally taken by a camera or mobile phone. The shooting location is the facial skin area, excluding facial features and hair. The entire image must be the entire facial skin. The size of the shooting area is not strictly limited, but the corresponding facial skin area is at least 2cm*2cm, and the image resolution is at least 1000*1000.
[0155] The method of this invention requires only one skin image as input, meaning only one image is needed as the data source for computation. The algorithm runs on a single computer, and the output consists of the outer contour lines of the spots in the input skin image (visualized spots) and the spot attribute values for the entire skin image. All experiments using this algorithm were conducted on a standard CPU computer with 12GB of memory.
[0156] Experimental results
[0157] The experimental part of this invention is divided into two aspects: spot recognition and quantitative calculation of multiple attributes of spots. Figure 1 The algorithm flowchart of this invention is provided; Appendix Figure 2 This is a partial image from the experiment and a visualization example of the blob recognition results; attached. Figure 3 It is attached Figure 2 A magnified view of the images in group f; Table 1 gives the calculated values of the blob attributes for these images.
[0158] The results of the embodiments show that the spot recognition and quantitative evaluation method based on the RGB color space implemented according to the method of the present invention has a fast calculation speed and high detection accuracy.
[0159] Table 1. Spot attribute values of each image calculated using the method of this invention.
[0160] Serial Number Skin images Number of spots area depth Obviousness Percentage (‰) 1 Figure 2 a 10 1614 113.4 20.0 1.8 2 Figure 2 b 19 12552 96.4 29.2 14.3 3 Figure 2 c 35 6227 144.5 18.5 7.2 4 Figure 2 d 16 3016 73.4 27.0 3.4 5 Figure 2 e 6 874 88.6 23.3 1.0 6 Figure 2 f 41 7067 109.1 23.1 8.0 7 Figure 2 g 36 6866 107.3 37.7 7.8 8 Figure 2 h 31 8075 114.2 19.3 14.3 9 Figure 2 i 41 14275 97.7 24.4 16.2 10 Figure 2 j 43 21360 102.6 13.6 24.3
[0161] It should be noted that the purpose of disclosing the embodiments is to help further understand the present invention. However, those skilled in the art will understand that various substitutions and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the content disclosed in the embodiments, and the scope of protection of the present invention is defined by the scope of the claims.
Claims
1. A method for skin image speckle recognition and quantitative evaluation based on the RGB color space, which uses a skin image as the only data source, recognizes the speckles on the skin and calculates the quantitative values of multiple attributes of the skin speckles to achieve the evaluation of skin image speckles; it includes the following steps: 1) A grayscale image img1 is obtained by a fixed combination of the blue and green color components of the skin image. The specific method is as follows: The RGB image has three different color components. The blue and green components are weighted and summed to obtain the grayscale image img1. The weighted sum calculation method is as follows: Gray = G × 0.15 + B × 0.85, where Gray is the grayscale value of a pixel on the img1 image, and G and B are the green and blue color components of the pixel at the same position on the input image corresponding to this pixel, and the grayscale value Gray ranges from [0, 255]; 2) Downsampling is performed on the grayscale image img1 to reduce the image resolution, and a low-resolution image img2 is obtained. The specific method is as follows: The downsampling step size is fixed at 4. Traverse the img1 image. The grayscale mean of the 16 pixels in each 4×4 pixel square area on the img1 image is calculated as the grayscale value of a pixel on the resulting downsampled image img2. Areas smaller than 4×4 are directly discarded (not sampled). The size of the downsampled image img2 is 1 / 16 of the size of the image img1 before sampling; 3) Seed points are determined on the low-resolution grayscale image img2, and the seed points are sorted in ascending order of grayscale value. The specific steps are as follows: C1. The image img2 is evenly divided into blocks; The image img2 is evenly divided into 6×6 sub-blocks. For each sub-block, the grayscale mean of the sub-block is calculated respectively, and there are 36 sub-blocks with 36 grayscale means; C2. On the image img2, determine the seed points. The specific method is as follows: Traverse all pixels of the image img2. For each pixel P1, according to the position of the pixel P1, determine its所属 sub-block (the sub-block in step C1) and the grayscale mean avg1 of the sub-block. Given the seed point threshold tSeed = avg1 - 22 and the dark area threshold t1 = avg1 – 117. The grayscale value of the pixel p1 on the image img2 is v1. If v1 > tSeed, the color of the p1 point is not dark enough, and the p1 point is determined as a non-seed point; if v1 < t1, the color of the p1 point is too dark, and it is also determined as a non-seed point; other pixel points are determined as seed points; C3. Sort the seed points. The method is as follows: For the seed points determined in step C2, sort the seed points in ascending order of their grayscale values on the image img2 to obtain the seed point sequence S1 4) Expand the seed points so that the small area around each seed point is speckle pixels. The specific steps are as follows: D1. Define all pixels on the outer contour line of a single speckle as set L, define all pixels constituting a single speckle as set T, and define that each pixel has four identifiers: contour, contour1, speckle, background. Each identifier is actually any value between 1 and 250 defined arbitrarily to represent; D2. Initialize L and T as empty sets. Add the seed point pixel P to the speckle contour line set L, and the identifier of the P point is "contour"; All pixels in set D3 L are sorted in ascending order of their gray values on image img2 to obtain pixel sequence S; D4 traverses the pixel sequence S from the beginning, finds the first pixel marked as "outline" as the active pixel P2, and performs different processing depending on whether P2 exists. After completing step D4.1.5 or step D4.2 to expand the seed point, we obtain the internal pixel set T of a single spot and the pixel set L on the outer contour line of a single spot. D6. Traverse each seed point P in the seed point sequence S1 (step C3). If P is not marked as a "spot", repeat steps D2 to D5 until the process of expanding all seed points into spot blocks is completed (the traversal of sequence S1 is completed), and obtain the labeled image Img3 of image Img2. Each pixel in image Img3 is labeled as: spot, outline, outline 1, background. 5) Post-processing of spots and outlines, merging spot patches, the specific steps are as follows: E1. Spot trimming and treatment of cavities within spot patches; E2. Outline refining and spot merging; The image obtained after post-processing of E3 image img3 is identified as Img4; 6) The 4-connectivity algorithm identifies individual blobs and calculates their attributes. The specific steps are as follows: The F1 image Img4 has a value for each pixel that is one of four values: blob, contour, contour1, and background. The four-connected method identifies the pixel set W of a single blob patch. F2 calculates the number of pixels, average gray value, and visibility of pixels in set W. F3 repeats steps F1 and F2 until step F1.1 can no longer find a pixel marked as a "spot" on the Img4 image. Each repetition is a single spot. The number of spots on the entire skin image is recorded as spotNum (the number of times steps F1 and F2 are repeated). 7) Analyze the average area, number, percentage, depth, and visibility of spots in the entire skin image. The specific steps are as follows: G1. Number of spots, spotNum in step F3 is the number of spots; G2. Average spot area: In step F2.1, the area of a single spot s1 was calculated. The sum of the areas of all single spots sSum is calculated. The average spot area = sSum / spotNum. G3. Spot depth: In step F2.2, the depth avg5 of a single spot was calculated. The sum of the avg5 values of all individual spots is avg5Sum. Spot depth avg6 = avg5Sum / spotNum. G4. Spot prominence, the mean of the prominence of all individual spots compared to (F2.3); G5. Spot Ratio: The ratio of the total number of spot pixels (sSum in step G2) to the total number of pixels in the entire image is defined as the spot ratio.
2. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 1, characterized in that, In step D4: D4.1 If there is an active pixel P2, record its grayscale value as P2Gray, process the four pixels above, below, left, and right of P2 respectively, and process each of the four pixels as P3. D4.2 If the active pixel P2 does not exist, the outline of the seed point P is determined and will not expand outward.
3. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 2, characterized in that, In step D4.1: D4.1.1 Mark pixel P3 and change the identifier of pixel P2; D4.1.2 Calculate the bounding box of the pixels on the contour line (in set L), the number of pixels inside the bounding box and outside the contour line countOut, and the gray mean of all pixels inside the bounding box in image Img1 (step A) aveBox. D4.1.3 Calculate the mean gray value aveIn and the number of pixels (countIn) of the blot (in set T); In D4.1.4, the grayscale threshold Tgray is set to 3, and the maximum area of the blob is set to Max1 = 115 (in pixels). D4.1.5 If condition 1 (P2Gray > aveIn + Tgray and countIn > Max1) or condition 2 (countOut > countIn) is satisfied, the blob outline of seed point P is determined and will not expand outward.
4. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 3, characterized in that, In step D4.1.1: D4.1.1.1 If point P3 exceeds the valid range of the image boundary row or column, that is, point P3 is not on image img2, P3 is not added to set L, and P2 is marked as "outline 1"; D4.1.1.2 If P3 has already been identified as a "spot", P3 is not added to set L, and P2 is identified as a spot and added to set T; D4.1.1.3 If P3 has already been identified as a "contour", P3 is not added to set L; P2 is identified as a spot and added to set T. D4.1.1.4 If P3 is not one of the three cases above, label P3 as "outline" and add P3 to set L; label P2 as "spot" and add it to set T.
5. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 1, characterized in that, In step E1: E1.1 Traverse each "background" identifier pixel P3 in image Img3 (step D6); E1.2 Count the number n of the four pixels above, below, left and right of P3 that are labeled as "outline" or "outline 1"; E1.3 If n>=3, change the label of point P3 to "outline"; E1.4 Repeat steps E1.1 to E1.3 until the conditions of E1.3 are no longer met, then end the hole repair of the spot.
6. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 1, characterized in that, in step E2: E2.1 Traverse each pixel P4 in image Img3 that is identified as "outline" or "outline 1"; E2.2 Count the number m of the four pixels above, below, left and right of P4 that are labeled as "outline", "outline 1" or "spot"; E2.3 If m=4, change the label of point P4 to "spot". E2.4 Repeat steps E2.1 to E2.3 until no more conditions in E2.3 are met, then end the spot merging process.
7. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 1. Its characteristic is that, in step F1: F1.1 Traverse the image Img4, find the first pixel identified as "blob" and push it onto stack stackA, and define the pixel set W of the blob patch as an empty set; In F1.2, pop a pixel P5 from stack A, change the pixel value to "background" to indicate that the pixel has been traversed, increment the counter count by 1, and place p5 into set W. F1.3 Process the four adjacent pixels q of p5 one by one. If the value of q is "spot", check if point q is in stack stackA. If not, push point q onto stackA. F1.4 Repeat steps F1.2 and F1.3 until stack A is empty. At this point, set W is the set of all pixels of a blob, and the pop count is the total number of pixels in the blob. Count can also indicate the area of a single blob.
8. The method for skin image spot recognition and quantitative evaluation based on RGB color space as described in claim 1, characterized in that, In step F2: F2.1 Single spot area s1: Number of pixels in set W; F2.2 The depth of a single spot is calculated by taking the grayscale value avg5 of the pixels in the set W on the image Img1 (step A). avg5 is defined as the depth of the spot. F2.3 Distinctness of a single spot, contrast = aveBox - avg5, where aveBox is calculated in step D4.1.2 and avg5 is calculated in F2.2; All pixels within the F2.4 set W are designated as "background".