A wrinkle detection method, device and computer-readable storage medium
The method improves wrinkle detection accuracy by using Frangi filter wavelet transform and a black hat algorithm to filter out interference from moles, pimples, and hair, enhancing the precision of wrinkle identification.
Patent Information
- Application Number
- CN202510327506.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-03-19
AI Technical Summary
The existing wrinkle detection methods based on traditional image processing are susceptible to factors such as plaques, acne marks and hair, resulting in low accuracy of the detection results.
By collecting the face images to be detected, performing grayscale image processing, filtering and skeleton extraction technology remove the connected domain with roundness greater than the preset threshold, combining with the black hat algorithm to remove the hair area, and further filtering the target wrinkle image by calculating the overlap area and grayscale value of the connecting domain and the hair area, and optimizing linear structure detection using the Frangi filtering algorithm.
Effectively removes interfering factors from plaques, acne marks and hair, improves the accuracy of wrinkle detection, and ensures that the detection results are closer to the wrinkle distribution of the actual face.
Smart Images

Figure CN119850612B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and particularly to a wrinkle detection method, device and computer-readable storage medium. Background Art
[0002] Wrinkle detection technology plays an important role in fields such as dermatological diagnosis and health management, and has significant application value. Existing wrinkle detection methods are mainly divided into two categories: indirect detection and direct detection. Indirect detection involves preparing a silicone sample of the skin and performing microscopic detection or texture analysis on the silicone sample. However, this method requires obtaining accurate skin physical parameters first, such as skin roughness, skin curvature, etc., and then preparing a silicone sample based on these parameters. The operation is complex and time-consuming, and the similarity between the silicone sample and the real skin will affect the accuracy of the detection result. Direct detection refers to the wrinkle detection technology based on computer vision, which analyzes the skin image through image processing technology to extract wrinkle features for wrinkle detection. It does not require invasive operations on the skin and has the characteristics of high efficiency and non-invasiveness. Therefore, it has gradually become a research hotspot.
[0003] The wrinkle detection technology based on computer vision is mainly divided into two categories: deep learning and traditional image processing methods. Deep learning methods use skin images covering different races, ages, and skin types to train a neural network model, enabling the model to learn the mapping relationship between various skin images and wrinkles. The trained model is used to obtain information such as the position, depth, and area of wrinkles in the skin image to be detected. In order for the model to learn sufficient features, it is often necessary to collect skin images covering all types. However, the population of different races, ages, and skin types is large and widely distributed, making it difficult to comprehensively collect these data. This will result in a low wrinkle detection accuracy of the model for skin images that have not been learned. In addition, as more and more image data is collected, the model also requires a large amount of computing resources and time for training. Moreover, since the wrinkle detection task is applied to beauty and medical scenarios, there are relatively high requirements for the stability and interpretability of the detection results. The detection result of the deep learning model is based on the overall performance after a large amount of data training, and its internal calculation process and decision-making mechanism are difficult to intuitively understand and explain. Therefore, it is difficult to provide users with an intuitive and clear result explanation. For the above reasons, although the wrinkle detection method based on deep learning has made progress in the research field, it still cannot be widely popularized in practical applications.
[0004] Traditional image processing methods mainly rely on manually designed features to extract wrinkle-related information through mathematical models. They have the advantages of high detection efficiency, low implementation difficulty, and stable and predictable results, so they are widely used in various wrinkle detection scenarios. Specifically, this method first preprocesses the skin image using feature enhancement technology to highlight the texture structure in the skin image, then uses edge detection operators to extract the boundary features of wrinkles, or uses filtering technology to extract the ridge-like structures in the skin image. Finally, morphological filtering is used to extract wrinkle features. For example, the patent with publication number CN115937952A discloses a method for detecting facial wrinkles based on multiple polarization states. By photographing a human face with a device connected to a skin detector, a parallel polarization image and a cross-polarization image are obtained. The parallel polarization image and the cross-polarization image are filtered using the Frangi filtering technology, and finally, skeleton extraction is performed on the filtered image to obtain the final wrinkle image. Although filtering the image using filtering technology can enhance the linear structures in the image, in actual skin images, wrinkles, patches, acne marks, and hairs also exhibit certain linear features. Therefore, during the filtering process, not only the linear structures at the wrinkle positions will be enhanced, but also the linear structures at the positions of patches, acne marks, and hairs will be enhanced, resulting in the final extracted wrinkle image containing not only wrinkles but also patches, acne marks, and hairs, etc., reducing the accuracy of the wrinkle detection result.
[0005] In summary, the existing wrinkle detection methods based on traditional image processing are vulnerable to interference from factors such as patches, acne marks, and hairs, and there is a problem of low accuracy of the detection results. Summary of the Invention
[0006] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the existing wrinkle detection methods based on traditional image processing are vulnerable to interference from factors such as patches, acne marks, and hairs, resulting in low accuracy of the detection results.
[0007] To solve the above technical problem, the present invention provides a wrinkle detection method, including:
[0008] Collect a face image to be detected, process the face image to be detected to obtain a grayscale image;
[0009] Filter the grayscale image, and perform skeleton extraction on the filtered image to obtain a first wrinkle image to be screened; use the black hat algorithm to process the grayscale image to obtain the hair region in the grayscale image;
[0010] Based on the perimeter and area of each connected component in the first wrinkle image to be screened, calculate the circularity of the connected component, and remove the connected components with a circularity greater than or equal to a first preset threshold to obtain a second wrinkle image to be screened;
[0011] Based on the coordinates of each connected component in the second wrinkle image to be screened, calculate the overlapping area between the connected component and the hair area, and remove the connected components with an overlapping area greater than or equal to the second preset threshold to obtain the target wrinkle image. Based on the connected components in the target wrinkle image, obtain the wrinkle detection result of the face image to be detected.
[0012] Preferably, after obtaining the target wrinkle image, it further includes:
[0013] Obtain the gray value of each connected component in the target wrinkle image, and remove the connected components with a gray value less than or equal to the third preset threshold.
[0014] Preferably, obtaining the gray value of each connected component in the target wrinkle image includes:
[0015] Obtain the gray values of all pixel points within the connected component, average the smallest K gray values, and use the calculated average value as the gray value of the connected component.
[0016] Preferably, use the Frangi filtering algorithm to filter the grayscale image, which specifically includes:
[0017] Calculate the gradient in the vertical direction of the grayscale image to obtain the vertical direction gradient map;
[0018] Scale the vertical direction gradient map until the gray value of the vertical direction gradient map is within the preset range to obtain the scaled bit image;
[0019] Calculate the relative gray smoothness descriptor of the bit image, and substitute the relative gray smoothness descriptor into the negative correlation linear regression equation to calculate the scale parameter of the Frangi filtering algorithm;
[0020] Filter the grayscale image based on the scale parameter of the Frangi filtering algorithm.
[0021] Preferably, the calculation formula of the relative gray smoothness descriptor is:
[0022] ,
[0023] ,
[0024] where, represents the relative gray smoothness descriptor of the bit image; represents the second-order moment of the bit image; represents the gray value; represents the number of gray levels; represents the th gray level; represents the average gray value of the bit image; Represents The probability in the normalized histogram;
[0025] The calculation formula for the scale parameter of the Frangi filtering algorithm is:
[0026] ,
[0027] Wherein, Represents the scale parameter of the Frangi filtering algorithm; Represents the negative correlation coefficient, ; Represents the initial scale parameter.
[0028] Preferably, the value range of the first preset threshold is [0.1, 0.4]; and / or
[0029] The value range of the second preset threshold is [0.2, 0.6].
[0030] Preferably, the value range of the third preset threshold is [50, 150].
[0031] Preferably, processing the face image to be detected to obtain a grayscale image includes:
[0032] Taking the face RGB image collected under parallel polarized light as the face image to be detected;
[0033] Using the Mediapipe machine learning framework to obtain the key points for face wrinkle detection, and based on the key points for face wrinkle detection, cropping the face image to be detected to remove the area that does not contain the key points for face wrinkle detection, obtaining an image to be detected;
[0034] Converting the image to be detected to obtain a grayscale image.
[0035] The present invention also provides a wrinkle detection device, including:
[0036] An image acquisition module, configured to acquire a face image to be detected, and process the face image to be detected to obtain a grayscale image;
[0037] An image filtering and processing module, configured to filter the grayscale image, and perform skeleton extraction on the filtered image to obtain a first image of wrinkles to be screened; using a black hat algorithm to process the grayscale image to obtain the hair region in the grayscale image;
[0038] A first wrinkle screening module, configured to calculate the roundness of each connected domain in the first image of wrinkles to be screened based on the perimeter and area of each connected domain, and remove the connected domains with a roundness greater than or equal to the first preset threshold to obtain a second image of wrinkles to be screened;
[0039] A second wrinkle screening module, configured to calculate the overlapping area between each connected component in the second image of wrinkles to be screened and the hair area based on the coordinates of each connected component in the second image of wrinkles to be screened, and remove the connected components with an overlapping area greater than or equal to a second preset threshold to obtain a target wrinkle image, and obtain the wrinkle detection result of the face image to be detected based on the connected components in the target wrinkle image.
[0040] The present invention also provides 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 above-mentioned wrinkle detection method are implemented.
[0041] The wrinkle detection method provided by this application has the following beneficial effects:
[0042] 1. Considering the different characteristics of wrinkle structures and other interference features on the face comprehensively, after filtering the grayscale image and extracting the skeleton to obtain the first image of wrinkles to be screened, the perimeter and area of each connected component in the image are obtained, so as to calculate the roundness of each connected component. Since the wrinkle structure is usually slender, its roundness is small, while the plaque and acne mark structures are usually circular or approximately circular, and the roundness is large. Therefore, based on the maximum roundness of the general wrinkle structure, a first preset threshold is set to remove the connected components with a roundness greater than or equal to the first preset threshold, so as to remove the connected components representing plaques and acne marks in the first image of wrinkles to be screened and obtain the second image of wrinkles to be screened; since the hair structure in the facial hair area is similar to the wrinkle structure in the skeleton extraction image, it will be misidentified as a wrinkle area. Therefore, this application uses a black hat algorithm to process the grayscale image to obtain the facial hair area. By calculating the overlapping area between each connected component in the second image of wrinkles to be screened and the hair area, when the overlapping area between the connected component and the hair area is too large, it indicates that the connected component is a hair structure in the hair area, and this connected component is removed, so as to obtain a target wrinkle image. The connected components in the target wrinkle image are the facial wrinkles after removing the interference of plaques, acne marks and hair. By comparing the characteristics between the wrinkles and various interference factors in facial wrinkle detection, the connected components in the image after skeleton extraction are effectively screened, thereby improving the accuracy of the wrinkle detection result.
[0043] 2. Since there may be some plaque structures with irregular shapes on the face, the roundness of this kind of plaque structure may be small, and this part of interference factors cannot be removed only by comparing the roundness. Therefore, after obtaining the target wrinkle image, this application also obtains the grayscale value of each connected component in the image, and determines whether the connected component is a wrinkle structure or an irregular plaque structure by comparing the grayscale values of the connected components, further screening the facial wrinkle detection result, and filtering out the interference factors in the facial wrinkle detection process to the greatest extent, making the final wrinkle detection result more accurate and closer to the actual wrinkle distribution on the human face.
[0044] 3. The present application uses the Frangi filtering algorithm to filter the grayscale image to highlight the linear structures in the grayscale image, so that the wrinkle image can be extracted based on the filtered image. Since the thicknesses of different linear structures are different, and the scale parameter of the Frangi filtering algorithm determines the scale range of the linear structures that the algorithm can detect. When the scale parameter matches the scale of the actual linear structures in the image, the algorithm can more accurately identify and highlight the linear structures. In the prior art, when using the Frangi filtering algorithm, the scale parameter is generally determined based on experience or a large number of experiments. However, in the present application, the gray-scale change information of the image in the vertical direction is obtained by calculating the gradient in the vertical direction of the grayscale image. By processing the gradient map in the vertical direction and calculating the relative gray-scale smoothness descriptor of the processed image, the roughness of the facial skin is reflected. Since a larger scale parameter is required to highlight the linear structures in the image when the roughness of the facial skin is large, and a smaller scale parameter is only required to highlight the linear structures when the roughness of the facial skin is small. Therefore, there is a negative correlation between the relative gray-scale smoothness descriptor and the scale parameter of the filtering algorithm. Based on this, the present application can calculate the scale parameter that matches the characteristics of the grayscale image by using the relative gray-scale smoothness descriptor and the negative correlation linear regression equation, so as to achieve the optimal filtering effect on the grayscale image and improve the wrinkle detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to make the content of the present invention easier to be clearly understood, the following further details the present invention according to the specific embodiments of the present invention in conjunction with the accompanying drawings, wherein:
[0046] Figure 1 is the flow chart of the wrinkle detection method provided by the present application;
[0047] Figure 2 is the grayscale image provided by the embodiment of the present application;
[0048] Figure 3 is the filtered image provided by the embodiment of the present application;
[0049] Figure 4 is the first wrinkle image to be screened provided by the embodiment of the present application;
[0050] Figure 5 For Example 1 Figure 4 is the second wrinkle image to be screened obtained by processing the first wrinkle image to be screened shown in;
[0051] Figure 6 For Example 1 Figure 5 is the target wrinkle image obtained by processing the second wrinkle image to be screened shown in;
[0052] Figure 7 The schematic diagram of the wrinkle detection result obtained by processing the target wrinkle image shown in Example 1 Figure 6 for Example 1;
[0053] Figure 8 The second wrinkle image to be screened obtained by processing the first wrinkle image to be screened shown in Example 2 Figure 4 for Example 2;
[0054] Figure 9 The target wrinkle image obtained by processing the second wrinkle image to be screened shown in Example 2 Figure 8 for Example 2;
[0055] Figure 10 The schematic diagram of the wrinkle detection result obtained by processing the target wrinkle image shown in Example 2 Figure 9 for Example 2;
[0056] Figure 11 The second wrinkle image to be screened obtained by processing the first wrinkle image to be screened shown in Example 3 Figure 4 for Example 3;
[0057] Figure 12 The target wrinkle image obtained by processing the second wrinkle image to be screened shown in Example 3 Figure 11 for Example 3;
[0058] Figure 13 The schematic diagram of the wrinkle detection result obtained by processing the target wrinkle image shown in Example 3 Figure 12 for Example 3;
[0059] Figure 14 The schematic diagram of the wrinkle detection result obtained by processing the first wrinkle image to be screened shown in Comparative Example 1 Figure 4 for Comparative Example 1;
[0060] Figure 15 The schematic diagram of the wrinkle detection result obtained by processing the first wrinkle image to be screened shown in Comparative Example 2 Figure 4 for Comparative Example 2;
[0061] Figure 16 The schematic diagram of the wrinkle detection result obtained by processing the first wrinkle image to be screened shown in Comparative Example 3 Figure 4 for Comparative Example 3;
[0062] Figure 17 The schematic diagram of the structure of the wrinkle detection device provided by this application Specific embodiments
[0063] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand the present invention and be able to implement it, but the embodiments given are not intended to limit the present invention.
[0064] Please refer to Figure 1 , Figure 1 The following is a flowchart of the wrinkle detection method provided by this application. The method includes:
[0065] S10: Collect the face image to be detected, and process the face image to be detected to obtain a grayscale image.
[0066] Furthermore, in some embodiments of this application, step S10 specifically includes:
[0067] S100: Use the face RGB image collected under parallel polarized light as the face image to be detected;
[0068] Specifically, using parallel polarized light as the illumination condition when collecting face images can enhance the details of facial wrinkles, thereby providing high-quality image data for wrinkle detection.
[0069] S101: Use the Mediapipe machine learning framework to obtain the key points for face wrinkle detection, and crop the face image to be detected based on the key points for face wrinkle detection, removing the areas that do not contain the key points for face wrinkle detection, to obtain the image to be detected;
[0070] Specifically, the Mediapipe machine learning framework is an open-source machine learning framework developed by Google.
[0071] S102: Convert the image to be detected to obtain a grayscale image.
[0072] S20: Filter the grayscale image, and perform skeleton extraction on the filtered image to obtain the first wrinkle image to be screened; use the black hat algorithm to process the grayscale image to obtain the hair area in the grayscale image.
[0073] Exemplarily, in a specific example of this application, a 3*3 cross-shaped structuring element is selected to perform skeleton extraction on the filtered image, thereby obtaining the first wrinkle image to be screened containing multiple connected domains. In other embodiments, other structuring elements can also be selected for skeleton extraction.
[0074] Specifically, the steps of the black hat algorithm for grayscale image processing include: selecting a circular or elliptical structuring element to perform a black hat operation on the grayscale image, that is, first performing a closing operation on the grayscale image to connect the hair regions and highlight the dark regions in the grayscale image, and then subtracting the grayscale image from the result of the closing operation to enhance the contrast between the hair and the background, making the hair region more prominent; then converting the image after the black hat operation into a black-and-white binary image, and performing morphological post-processing on the black-and-white binary image to optimize the extraction effect of the hair region. Among them, the erosion operation can be used to remove isolated noise points in the black-and-white binary image, and the dilation operation can be used to fill small holes in the black-and-white binary image; the black regions in the black-and-white binary image after morphological post-processing are the hair regions.
[0075] S30: Based on the perimeter and area of each connected component in the first image to be screened for wrinkles, calculate the circularity of the connected component, and remove the connected components with a circularity greater than or equal to the first preset threshold to obtain a second image to be screened for wrinkles.
[0076] Specifically, the calculation formula for the circularity of a connected component is:
[0077] ,
[0078] where, represents the circularity of the connected component; represents the area of the connected component; represents the perimeter of the connected component.
[0079] S40: Based on the coordinates of each connected component in the second image to be screened for wrinkles, calculate the overlapping area between the connected component and the hair region, and remove the connected components with an overlapping area greater than or equal to the second preset threshold to obtain a target wrinkle image, and obtain the wrinkle detection result of the face image to be detected based on the connected components in the target wrinkle image.
[0080] This application comprehensively considers the different characteristics of wrinkle structures and other various interference features on the face. After filtering the grayscale image and extracting the skeleton to obtain the first image of wrinkles to be screened, the perimeter and area of each connected component in the image are obtained, and then the circularity of each connected component is calculated. Since the wrinkle structure is usually slender and has a small circularity, while the plaque and acne mark structures are usually circular or approximately circular and have a large circularity. Therefore, based on the maximum circularity of the general wrinkle structure, a first preset threshold is set, and the connected components with a circularity greater than or equal to the first preset threshold are removed, thereby removing the connected components representing plaques and acne marks in the first image of wrinkles to be screened and obtaining the second image of wrinkles to be screened. Since the hair structure in the facial hair area is similar to the wrinkle structure in the skeleton extraction image and will be misrecognized as a wrinkle area, this application uses the black hat algorithm to process the grayscale image to obtain the facial hair area. By calculating the overlapping area between each connected component in the second image of wrinkles to be screened and the hair area, when the overlapping area between the connected component and the hair area is too large, it indicates that the connected component is a hair structure in the hair area, and this connected component is removed, thereby obtaining the target wrinkle image. The connected components in this target wrinkle image are the facial wrinkles that have removed the interference of plaques, acne marks, and hair. By comparing the features between the wrinkles and various interference factors for facial wrinkle detection, the connected components in the image after skeleton extraction are effectively screened, thereby improving the accuracy of the wrinkle detection result.
[0081] Further, the value range of the first preset threshold is [0.1, 0.4]. For example, the first preset threshold can be 0.1, 0.2, 0.3, or 0.4; and / or, the value range of the second preset threshold is [0.2, 0.6]. For example, the second preset threshold can be 0.2, 0.3, 0.4, 0.5, or 0.6.
[0082] Since the first preset threshold is used to remove the connected components with a large circularity and screen the connected components with a smaller circularity that are closer to the wrinkle shape, its value should be as close as possible to the circularity of the connected components in most wrinkle shapes. If the first preset threshold is too small, some connected components of wrinkle shapes that are slender but have a slightly larger circularity may be removed. If the first preset threshold is too large, some connected components of plaque or acne mark shapes that are close to slender and have a small circularity will be retained, affecting the accuracy of wrinkle detection. The value range of the first preset threshold provided in this application is set by comprehensively considering the circularity of the connected components in a large number of wrinkle shapes and the circularity of the connected components in plaque and acne mark shapes. In detection scenarios with higher precision requirements, a smaller value can be taken within this value range, and in detection scenarios with looser precision requirements, a larger value can be taken within this value range. Similar to the first preset threshold, the second preset threshold is used to remove the connected components that are misrecognized as wrinkle shapes in the hair area. In detection scenarios with higher precision requirements, a smaller value can be taken within this value range, and in detection scenarios with looser precision requirements, a larger value can be taken within this value range.
[0083] Further, since the roundness of some patch structures with irregular shapes may be small, it is very likely to misidentify them as wrinkles with an elongated shape only by comparing the roundness. To further improve the screening accuracy, some embodiments of the present application further include, after obtaining the target wrinkle image:
[0084] Obtain the gray value of each connected component in the target wrinkle image, and remove the connected components with gray values less than or equal to the third preset threshold.
[0085] Further, the value range of the third preset threshold is [50, 150]. For example, the third preset threshold can be 50, 70, 90, 110, 130 or 150.
[0086] Optionally, obtaining the gray value of each connected component in the target wrinkle image includes:
[0087] Obtain the gray values of all pixel points in the target wrinkle image, and use the minimum gray value as the gray value of this connected component.
[0088] However, to avoid screening errors caused by inaccurate gray values of individual pixel points, the present application also provides another method for obtaining the gray value of a connected component, which specifically includes:
[0089] Obtain the gray values of all pixel points in the connected component, calculate the average of the K smallest gray values, and use the calculated average value as the gray value of the connected component.
[0090] Exemplarily, the value of K here can be set based on the number of pixel points in the connected component. In a specific example of the present application, the value of K is 10% of the number of pixel points in the connected component.
[0091] Further, in some embodiments of the present application, the gray image is filtered using the Frangi filtering algorithm, which specifically includes:
[0092] Step 1: Calculate the gradient in the vertical direction of the gray image to obtain a vertical direction gradient map.
[0093] Step 2: Scale the vertical direction gradient map until the gray value of the vertical direction gradient map is within a preset range to obtain a scaled bit image.
[0094] In a specific example of the present application, the vertical direction gradient map is scaled to an 8-bit image with a gray value in the range of [0, 255].
[0095] Step 3: Calculate the relative gray smoothness descriptor of the bit image, and substitute the relative gray smoothness descriptor into the negative correlation linear regression equation to calculate the scale parameter of the Frangi filtering algorithm.
[0096] Specifically, the calculation formula for the relative gray-scale smoothness descriptor is as follows:
[0097] ,
[0098] ,
[0099] wherein, represents the relative gray-scale smoothness descriptor of the binary image; represents the second moment of the binary image; represents the gray scale; represents the number of gray levels; represents the th gray level; represents the average gray scale of the binary image; represents the probability in the normalized histogram;
[0100] The calculation formula for the scale parameter of the Frangi filtering algorithm is as follows:
[0101] ,
[0102] wherein, represents the scale parameter of the Frangi filtering algorithm; represents the negative correlation coefficient, ; represents the initial scale parameter.
[0103] Specifically, when the vertical gradient map is scaled to an 8-bit image with gray values in the range of [0, 255], the number of gray levels in the above calculation formula for the relative gray-scale smoothness descriptor takes a value of 256.
[0104] Step 4: Filter the grayscale image based on the scale parameter of the Frangi filtering algorithm.
[0105] Since the scale parameter of the Frangi filtering algorithm controls the sensitivity of the algorithm to linear structures of different scales, when the scale parameter matches the scale of the actual linear structures in the image, the algorithm can more accurately identify and highlight the linear structures. In the prior art, when using the Frangi filtering algorithm, the scale parameter is generally determined based on experience or a large number of experiments. The former has low accuracy and cannot set corresponding scale parameters according to the characteristics of different images, and the latter requires a large number of experiments before filtering each image, with high computational and time costs.
[0106] Based on the above problems, in this application, the vertical gradient map of the grayscale image is obtained, and after processing the gradient map, a bit image is obtained. The relative grayscale smoothness descriptor of the bit image is calculated to reflect the roughness of the grayscale image. When the relative grayscale smoothness descriptor is small, it indicates that the roughness of the grayscale image is large, that is, there are more fine lines on the face of the currently detected person, and a smaller scale parameter is required to match the linear structures in the image. When the relative grayscale smoothness descriptor is large, it indicates that the roughness of the grayscale image is small, that is, there are fewer wrinkles on the face of the currently detected person, and a larger scale parameter can match the linear structures in the image. It can be seen that there is a negative correlation between the relative grayscale smoothness descriptor and the scale parameter. Based on this, in this application, by substituting the calculated relative grayscale smoothness descriptor into the negative correlation linear regression equation, the scale parameter that can match the features of the current grayscale image can be calculated, thereby improving the filtering accuracy and the wrinkle detection accuracy.
[0107] The technical solution of this application will be described in more detail below in combination with multiple embodiments and comparative examples. However, it should be understood that the following embodiments are only for explaining and illustrating the technical solution and do not limit the scope of this application. Embodiment 1
[0108] This embodiment provides a wrinkle detection method, which specifically includes the following steps:
[0109] S100: Collect the face image to be detected, process the face image to be detected, and obtain the Figure 2 grayscale image as shown.
[0110] S200: Filter the grayscale image to obtain the filtered image as shown, perform skeleton extraction on the filtered image, and obtain the first wrinkle image to be screened as shown; use the black hat algorithm to process the grayscale image to obtain the hair area in the grayscale image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated by the method provided in the above embodiment. Figure 3 Figure 4
[0111] S300: Based on the perimeter and area of each connected domain in the first wrinkle image to be screened, calculate the roundness of the connected domain, and remove the connected domains with a roundness greater than or equal to 0.1 to obtain the second wrinkle image to be screened as shown. Figure 5
[0112] Figure 6 S400: Based on the coordinates of each connected domain in the second wrinkle image to be screened, calculate the overlapping area between the connected domain and the hair area, and remove the connected domains with an overlapping area greater than or equal to 0.2 to obtain the target wrinkle image as shown.
[0113] S500: Obtain the gray values of all pixel points in each connected component in the target wrinkle image, calculate the average of the smallest K gray values, use the calculated average value as the gray value of the connected component, and remove the connected components with gray values less than or equal to 50, obtaining as Figure 7 shown in the schematic diagram of the wrinkle detection result. Example 2
[0114] This example provides a wrinkle detection method, which specifically includes the following steps:
[0115] S100: Collect the face image to be detected, process the face image to be detected, and obtain a Figure 2 gray image as shown.
[0116] S200: Filter the gray image to obtain a Figure 3 filtered image as shown, perform skeleton extraction on the filtered image to obtain a Figure 4 first wrinkle image to be screened; use the black hat algorithm to process the gray image to obtain the hair region in the gray image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated using the method provided in the above example.
[0117] S300: Based on the perimeter and area of each connected component in the first wrinkle image to be screened, calculate the roundness of the connected component, and remove the connected components with roundness greater than or equal to 0.2, obtaining a Figure 8 second wrinkle image to be screened as shown.
[0118] S400: Based on the coordinates of each connected component in the second wrinkle image to be screened, calculate the overlapping area between the connected component and the hair region, and remove the connected components with overlapping area greater than or equal to 0.4, obtaining a Figure 9 target wrinkle image as shown.
[0119] S500: Obtain the gray values of all pixel points in each connected component in the target wrinkle image, calculate the average of the smallest K gray values, use the calculated average value as the gray value of the connected component, and remove the connected components with gray values less than or equal to 100, obtaining a Figure 10 schematic diagram of the wrinkle detection result as shown. Example 3
[0120] This example provides a wrinkle detection method, which specifically includes the following steps:
[0121] S100: Collect the face image to be detected, process the face image to be detected, and obtain a Figure 2 gray image as shown.
[0122] S200: Filter the gray image to obtain a Figure 3The filtered image shown is subjected to skeleton extraction to obtain a first wrinkle image to be screened as shown in Figure 4 ; the black hat algorithm is used to process the grayscale image to obtain the hair region in the grayscale image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated by the method provided in the above embodiment.
[0123] S300: Based on the perimeter and area of each connected component in the first wrinkle image to be screened, calculate the circularity of the connected component, and remove the connected components with a circularity greater than or equal to 0.4 to obtain a second wrinkle image to be screened as shown in Figure 11 ;
[0124] S400: Based on the coordinates of each connected component in the second wrinkle image to be screened, calculate the overlapping area between the connected component and the hair region, and remove the connected components with an overlapping area greater than or equal to 0.6 to obtain the target wrinkle image as shown in Figure 12 ;
[0125] S500: Obtain the grayscale values of all pixel points in each connected component in the target wrinkle image, average the smallest K grayscale values, use the calculated average value as the grayscale value of the connected component, and remove the connected components with a grayscale value less than or equal to 150 to obtain a schematic diagram of the wrinkle detection result as shown in Figure 13 ; Comparative Example 1
[0126] This comparative example provides a wrinkle detection method, which specifically includes the following steps:
[0127] S100: Collect the face image to be detected, process the face image to be detected to obtain a grayscale image as shown in Figure 2 ;
[0128] S200: Filter the grayscale image to obtain a filtered image as shown in Figure 3 ; subject the filtered image to skeleton extraction to obtain a first wrinkle image to be screened as shown in Figure 4 ; the black hat algorithm is used to process the grayscale image to obtain the hair region in the grayscale image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated by the method provided in the above embodiment.
[0129] S300: Based on the coordinates of each connected component in the first wrinkle image to be screened, calculate the overlapping area between the connected component and the hair region, and remove the connected components with an overlapping area greater than or equal to 0.6 to obtain the target wrinkle image.
[0130] S400: Obtain the grayscale values of all pixel points within each connected component in the target wrinkle image, calculate the average of the smallest K grayscale values, use the calculated average value as the grayscale value of the connected component, and remove the connected components with grayscale values less than or equal to 150, obtaining the schematic diagram of the wrinkle detection result as shown in Figure 14 shown. Comparative Example 2
[0131] This comparative example provides a wrinkle detection method, which specifically includes the following steps:
[0132] S100: Collect the face image to be detected, process the face image to be detected, and obtain the grayscale image as shown in Figure 2 shown.
[0133] S200: Filter the grayscale image to obtain the filtered image as shown in Figure 3 shown, perform skeleton extraction on the filtered image to obtain the first image to be screened for wrinkles as shown in Figure 4 shown; process the grayscale image using the black hat algorithm to obtain the hair region in the grayscale image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated using the method provided in the above embodiment.
[0134] S300: Based on the perimeter and area of each connected component in the first image to be screened for wrinkles, calculate the roundness of the connected component, and remove the connected components with roundness greater than or equal to 0.4 to obtain the second image to be screened for wrinkles.
[0135] S400: Obtain the grayscale values of all pixel points within each connected component in the second image to be screened for wrinkles, calculate the average of the smallest K grayscale values, use the calculated average value as the grayscale value of the connected component, and remove the connected components with grayscale values less than or equal to 150, obtaining the schematic diagram of the wrinkle detection result as shown in Figure 15 shown. Comparative Example 3
[0136] This comparative example provides a wrinkle detection method, which specifically includes the following steps:
[0137] S100: Collect the face image to be detected, process the face image to be detected, and obtain the grayscale image as shown in Figure 2 shown.
[0138] S200: Filter the grayscale image to obtain the filtered image as shown in Figure 3 shown, perform skeleton extraction on the filtered image to obtain the first image to be screened for wrinkles as shown in Figure 4 shown; process the grayscale image using the black hat algorithm to obtain the hair region in the grayscale image. Specifically, the Frangi filtering algorithm is adopted, and its scale parameter is calculated using the method provided in the above embodiment.
[0139] S300: Calculate the roundness of each connected component in the first image to be screened for wrinkles based on the perimeter and area of the connected component, and remove the connected components with a roundness greater than or equal to 0.4 to obtain the second image to be screened for wrinkles.
[0140] S400: Calculate the overlapping area between the connected component and the hair area based on the coordinates of each connected component in the second image to be screened for wrinkles, and remove the connected components with an overlapping area greater than or equal to 0.6 to obtain Figure 16 the schematic diagram of the wrinkle detection result as shown.
[0141] It should be noted that in the above embodiments and comparative examples Figure 4 the images shown are the schematic diagrams of the detection results obtained by using the wrinkle detection method in the prior art.
[0142] By comparing Figure 5 , Figure 6 and Figure 7 in Embodiment 1, or Figure 8 , Figure 9 and Figure 10 in Embodiment 2, or Figure 11 , Figure 12 and Figure 13 in Embodiment 3, it can be seen that the present application can gradually remove interference factors such as plaques, acne marks, and hair in the facial wrinkle detection process by screening the connected components from three aspects: the roundness of the connected component, the overlapping area between the connected component and the hair area, and the gray value of the connected component, and retain the connected components that only include the wrinkle shape, thereby improving the wrinkle detection accuracy. At the same time, by comparing Figure 14 , Figure 15 and Figure 16 it can also be seen that the three aspects of the roundness of the connected component, the overlapping area between the connected component and the hair area, and the gray value of the connected component can effectively remove the interference factors in the detection results.
[0143] Based on the wrinkle detection method provided in the above embodiments, the present application also provides a wrinkle detection device, as Figure 17 shown, the device specifically includes:
[0144] An image acquisition module 10, configured to acquire a face image to be detected, process the face image to be detected, and obtain a grayscale image.
[0145] An image filtering processing module 20, configured to filter the grayscale image, extract the skeleton of the filtered image, and obtain the first image to be screened for wrinkles; process the grayscale image using a black hat algorithm to obtain the hair area in the grayscale image.
[0146] The first wrinkle screening module 30 is configured to calculate the roundness of each connected component in the first image of wrinkles to be screened based on the perimeter and area of each connected component, and remove the connected components with a roundness greater than or equal to a first preset threshold to obtain a second image of wrinkles to be screened.
[0147] The second wrinkle screening module 40 is configured to calculate the overlapping area between each connected component and the hair region based on the coordinates of each connected component in the second image of wrinkles to be screened, and remove the connected components with an overlapping area greater than or equal to a second preset threshold to obtain a target wrinkle image, and obtain the wrinkle detection result of the face image to be detected based on the connected components in the target wrinkle image.
[0148] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned wrinkle detection method are implemented.
[0149] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0150] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0151] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0152] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus, so that a series of operational steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing steps for implementing the functions specified in one process or a plurality of processes and / or blocks Figure 1 in one block or a plurality of blocks Figure 1 in the computer or other programmable apparatus.
[0153] Obviously, the above embodiments are merely examples for clear illustration and are not limitations on the implementation manners. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to exhaustively list all the implementation manners here. And the obvious changes or modifications derived therefrom are still within the protection scope of the present invention.
Claims
1. A wrinkle detection method, characterized in that, Including: Collect the face image to be detected, process the face image to be detected to obtain a grayscale image; Use the Frangi filtering algorithm to filter the grayscale image, including: Calculate the gradient in the vertical direction of the grayscale image to obtain a vertical gradient map; Scale the vertical gradient map until the grayscale values of the vertical gradient map are within a preset range to obtain a scaled bit image; Calculate the relative gray smoothness descriptor of the bit image , and substitute the relative gray smoothness descriptor into the negative correlation linear regression equation to calculate the scale parameter of the Frangi filtering algorithm ; where represents the relative gray smoothness descriptor of the bit image; represents the second moment of the bit image, ; represents the gray level; represents the number of gray levels; represents the th gray level; represents the average gray level of the bit image; represents the probability in the normalized histogram; represents the scale parameter of the Frangi filtering algorithm; represents the negative correlation coefficient, ; represents the initial scale parameter; Filter the grayscale image based on the scale parameter of the Frangi filtering algorithm; Extract the skeleton of the filtered image to obtain a first wrinkle image to be screened; use the black hat algorithm to process the grayscale image to obtain the hair region in the grayscale image; Based on the perimeter and area of each connected component in the first wrinkle image to be screened, calculate the roundness of the connected component, and remove the connected components with a roundness greater than or equal to the first preset threshold to obtain a second wrinkle image to be screened; Based on the coordinates of each connected component in the second wrinkle image to be screened, calculate the overlapping area between the connected component and the hair region, and remove the connected components with an overlapping area greater than or equal to the second preset threshold to obtain a target wrinkle image, and obtain the wrinkle detection result of the face image to be detected based on the connected components in the target wrinkle image.
2. The wrinkle detection method according to claim 1, wherein After obtaining the target wrinkle image, it further includes: Obtain the grayscale value of each connected component in the target wrinkle image, and remove the connected components with a grayscale value less than or equal to the third preset threshold.
3. The wrinkle detection method according to claim 2, wherein Obtaining the grayscale value of each connected component in the target wrinkle image includes: Obtain the grayscale values of all pixel points in the connected component, average the smallest K grayscale values, and use the calculated average value as the grayscale value of the connected component.
4. The wrinkle detection method according to claim 1, wherein The value range of the first preset threshold is [0.1, 0.4]; and / or The value range of the second preset threshold is [0.2, 0.6].
5. The wrinkle detection method according to claim 2, characterized in that, The value range of the third preset threshold is [50, 150].
6. The wrinkle detection method according to claim 1, wherein Processing the face image to be detected to obtain a grayscale image includes: Use the face RGB image collected under parallel polarized light as the face image to be detected; Use the Mediapipe machine learning framework to obtain the key points for face wrinkle detection, and crop the face image to be detected based on the key points for face wrinkle detection, and remove the regions that do not contain the key points for face wrinkle detection to obtain an image to be detected; Convert the image to be detected to obtain a grayscale image.
7. A wrinkle detection device, characterized in that, Including: An image acquisition module, configured to collect a face image to be detected, process the face image to be detected to obtain a grayscale image; An image filtering processing module for filtering a grayscale image using the Frangi filtering algorithm, including: calculating the gradient in the vertical direction of the grayscale image to obtain a vertical direction gradient map; scaling the vertical direction gradient map until the grayscale values of the vertical direction gradient map are within a preset range to obtain a scaled bit image; calculating the relative grayscale smoothness descriptor of the bit image , and substituting the relative grayscale smoothness descriptor into a negative correlation linear regression equation to calculate and obtain the scale parameter of the Frangi filtering algorithm ; where represents the relative grayscale smoothness descriptor of the bit image; represents the second moment of the bit image, ; represents the grayscale; represents the number of gray levels; represents the th gray level; represents the average grayscale of the bit image; represents the probability in the normalized histogram; represents the scale parameter of the Frangi filtering algorithm; represents the negative correlation coefficient, ; represents the initial scale parameter; filtering the grayscale image based on the scale parameter of the Frangi filtering algorithm; and performing skeleton extraction on the filtered image to obtain a first wrinkle image to be screened; processing the grayscale image using a black hat algorithm to obtain the hair region in the grayscale image; A first wrinkle screening module, configured to calculate the roundness of the connected component based on the perimeter and area of each connected component in the first wrinkle image to be screened, and remove the connected components with a roundness greater than or equal to the first preset threshold to obtain a second wrinkle image to be screened; A second wrinkle screening module, configured to calculate the overlapping area between the connected component and the hair region based on the coordinates of each connected component in the second wrinkle image to be screened, and remove the connected components with an overlapping area greater than or equal to the second preset threshold to obtain a target wrinkle image, and obtain the wrinkle detection result of the face image to be detected based on the connected components in the target wrinkle image.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the wrinkle detection method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Face wrinkle detection method based on multiple polarization states
CN115937952A
Face wrinkle detection method, electronic equipment and computer readable storage medium
CN115984191A