A face detection method without interruption, an electronic device and a storage medium
By using a sliding detection method that directly utilizes RAW images and predefined templates, the problem of high computational resource consumption and high storage requirements for face detection in low-power applications is solved, achieving efficient and uninterrupted face detection, suitable for application scenarios with low power consumption and low storage requirements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GALAXYCORE SHANGHAI
- Filing Date
- 2024-11-29
- Publication Date
- 2026-05-29
AI Technical Summary
Existing face detection methods consume large amounts of computational resources and have high storage requirements in low-power applications, and rely on complex image processing steps, resulting in low detection efficiency.
The method directly extracts a single color component from RAW images, extracts pre-detection images by sliding a predefined face template, performs contrast enhancement, binarization and morphological operations, sets filtering conditions to remove images that do not meet the conditions, and introduces weights and weighted average error to calculate the matching degree, thus avoiding unnecessary image processing.
It saves computing resources and storage requirements, reduces power consumption, and improves detection efficiency, making it suitable for uninterrupted detection applications with low power consumption and low storage requirements.
Smart Images

Figure CN122116437A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for uninterrupted face detection, as well as an electronic device and a storage medium. Background Technology
[0002] In recent years, "Always On (AO)" technology has emerged in the field of face detection, enabling devices to continuously perceive and respond instantly, allowing devices to continuously monitor the surrounding environment and recognize faces without manual operation by the user.
[0003] While current mainstream face detection methods rely on neural network architectures, these algorithms require significant data and computational resources during training, posing a clear obstacle for applications prioritizing low power consumption. Furthermore, the large storage requirements of neural network models limit their applicability on various hardware devices. In addition, existing methods typically utilize transformed visual information, such as RGB or grayscale images that have undergone white balance, color correction, and interpolation. While these preprocessing steps can reduce noise and improve color consistency, making the algorithms more suitable for specific tasks like feature extraction and object recognition, they also increase processing complexity and consume more computational resources.
[0004] The statements herein provide only background information in relation to this invention and do not necessarily constitute prior art. Summary of the Invention
[0005] The purpose of this invention is to provide a continuous face detection method, electronic device, and storage medium, which saves computing resources, reduces power consumption, and improves detection efficiency, and is suitable for continuous detection application scenarios with low power consumption and low storage requirements.
[0006] To achieve the above objectives, the present invention provides a continuous face detection method, comprising:
[0007] Extracting a single color component from the original image in real time to form an initial image;
[0008] A predefined face template is slid across the initial image to extract multiple pre-detection images corresponding to different regions of the initial image. The pixel size of the pre-detection images is consistent with that of the face template.
[0009] The multiple pre-detection images are preprocessed to obtain candidate images;
[0010] Pre-screening is performed on the plurality of pre-detection images and / or the plurality of candidate images to remove images that meet the screening criteria and to put images that do not meet the screening criteria into the image dataset.
[0011] Calculate the matching degree between the images in the image dataset and the face template, and determine the best matching region of the initial image;
[0012] Face detection is performed based on the matching degree of the optimal matching region. If the matching conditions are met, it is determined that a face has been detected in the original image.
[0013] The preprocessing includes:
[0014] A contrast enhancement operation is performed on the pre-detection image to obtain a first image, wherein the difference between different brightness regions in the first image is greater than the difference between different brightness regions in the pre-detection image;
[0015] The first image is binarized to obtain the second image, which contains only black and white pixel values.
[0016] The facial features are extracted from the second image to obtain the third image.
[0017] The facial feature extraction operation includes: performing a morphological closing operation on the second image, and XORing the result of the closing operation with the second image to obtain the third image.
[0018] The filtering criteria include:
[0019] No facial features were extracted from the third image;
[0020] Alternatively, the faces or facial features in the pre-detection images and the candidate images may be distorted.
[0021] Methods for identifying facial or feature distortion include:
[0022] If the face or facial features extracted from the pre-detection image and the candidate image meet any one or more of the distortion conditions, then it is determined that the face or facial features are distorted.
[0023] The distortion conditions include:
[0024] In the upper half of the second image, the ratio of the number of facial pixels without facial features to the total number of pixels in the upper half is less than a first threshold, and in the lower half of the candidate image, the ratio of the number of facial pixels without facial features to the total number of pixels in the lower half is less than a second threshold.
[0025] In the second image, the aspect ratio of the face is less than the third threshold;
[0026] In the pre-detection image, the difference between the maximum and minimum pixel values in the central region of the face is less than the fourth threshold.
[0027] In the pre-detection image, the maximum pixel value in the central region of the face is greater than the fifth threshold.
[0028] In the first image, the average pixel value of the central facial region is greater than the sixth threshold;
[0029] The average pixel value of the largest facial feature position in the first image is greater than a seventh threshold, wherein the position of the largest facial feature is derived from the third image.
[0030] The first threshold is 0.2 to 0.5, the second threshold is 0.1 to 0.5, the third threshold is 0.5 to 1, the fourth threshold is 5 to 10, the fifth threshold is 90 to 150, the sixth threshold is 180 to 220, and the seventh threshold is 95 to 115.
[0031] The method for calculating the matching degree includes:
[0032] Calculate the matching degree between the pre-detection image and the face template to obtain the first matching degree M1;
[0033] Perform a contrast enhancement operation on the face template to obtain a contrast-enhanced face template, calculate the matching degree between the first image and the contrast-enhanced face template, and obtain a second matching degree M2.
[0034] The formula for calculating the matching degree is:
[0035]
[0036] Where N is the number of pixels in the face template, w l Let I be the weight corresponding to the l-th pixel of the face template. l I' is the value of the l-th pixel in the pre-detection image or the first image. l The value of the l-th pixel in a face template or a contrast-enhanced face template.
[0037] The weights of each pixel in the face template are predefined:
[0038] The weight of the pixels in the facial features region is 3 to 5 times the ratio of the number of pixels in the face region to the number of pixels in the facial features region of the face template;
[0039] The weight of pixels in the area surrounding the facial features is the ratio of the sum of the pixel weights in the facial feature area to the number of pixels in the area surrounding the facial features.
[0040] Determining the optimal matching region of the initial image includes: comparing the first matching degree and the second matching degree in the image dataset respectively, and selecting the initial image region corresponding to the smallest first matching degree and the smallest second matching degree as the optimal matching region.
[0041] Face recognition based on the matching degree of the optimal matching region includes:
[0042] If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is less than the second matching threshold, then the matching condition is satisfied.
[0043] If the first matching degree corresponding to the best matching region is greater than or equal to the first matching threshold, and the second matching degree is less than the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied.
[0044] If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is greater than or equal to the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied.
[0045] The first matching threshold is 65-70, the second matching threshold is 17.5-18.5, and the symmetry threshold is 0.75-0.85.
[0046] The pixel size of the face template is smaller than the pixel size of the initial image, and the sliding step size is the pixel size of the face template.
[0047] The single color component is either the red component of the R channel, or the green component of the G channel, or the blue component of the B channel.
[0048] The contrast enhancement operation employs a histogram equalization method.
[0049] The present invention also provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the uninterrupted face detection method described above.
[0050] The present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the uninterrupted face detection method.
[0051] This invention directly uses RAW images for face detection, avoiding unnecessary image processing and conversion operations, saving computational resources, and improving detection efficiency. By setting filtering conditions to pre-screen images, images that clearly lack any facial features or have facial distortions are excluded in advance, eliminating the need for further processing. This saves computational resources, reduces memory requirements, lowers power consumption, and improves detection efficiency. Introducing weights and weighted average errors to calculate the matching degree reduces computational complexity, saves computational resources, and improves computational accuracy. This invention is particularly suitable for uninterrupted detection applications with low power consumption and low storage requirements. Attached Figure Description
[0052] Figure 1 This is a flowchart of the uninterrupted face detection method provided in the embodiments of the present invention.
[0053] Figure 2 This is a schematic diagram of using a face template to extract pre-detection images.
[0054] Figure 3 This is a schematic diagram of the first image.
[0055] Figure 4a It is the histogram distribution of the pre-detection images.
[0056] Figure 4b It is the histogram distribution of the pre-detection image after contrast enhancement.
[0057] Figure 5 This is a schematic diagram of the second image.
[0058] Figure 6 This is a schematic diagram of the third image.
[0059] Figure 7 This is a schematic diagram for calculating the aspect ratio of a surface.
[0060] Figure 8 This is a diagram illustrating pixel weights in a face template.
[0061] Figure 9 This is a schematic diagram of a face template with enhanced contrast.
[0062] Figure 10 This is a diagram illustrating the optimal matching region. Detailed Implementation
[0063] The following is based on Figures 1-10 The preferred embodiments of the present invention will be described in detail below.
[0064] like Figure 1 As shown, an embodiment of the present invention provides a method for uninterrupted face detection, specifically including the following steps:
[0065] Step S1: Extract a single color component from the original image in real time to form an initial image.
[0066] The original image is a RAW image, which is an unprocessed image data format captured directly from an image sensor (such as the CMOS or CCD of a digital camera). RAW images contain all the information captured by the sensor, including data on color, brightness, and exposure, but without any compression or color processing. This means that RAW images retain more detail and dynamic range, providing greater flexibility to adjust and optimize the final image.
[0067] The RAW image has RGGB color channels. A typical RGGB array arrangement is a 2x2 array, containing two green pixels and one red and one blue pixel, forming an RG / GB arrangement. The initial image is formed by extracting the green component, the red component, or the blue component from the RAW image. Preferably, the initial image is formed by extracting the green component because the human eye is most sensitive to green, which can improve the accuracy of subsequent detection.
[0068] Step S2: Slide a predefined face template on the initial image to extract a pre-detection image corresponding to the first region of the initial image.
[0069] like Figure 2 As shown, the face template uses a standard face image, and the white box represents the current matching area of the face template. The pixel size of the face template is smaller than the pixel size of the initial image. The sliding step size can be set according to the size of the initial image and the size of the face template; generally, the step size is set to a fraction of the face template's pixel size. For example, in an environment where the initial image size is 32×24 pixels and the face template size is 17×17 pixels, it is more appropriate to set the step size to 2 to 4. The smaller the step size, the higher the detection accuracy.
[0070] The face template is placed at the top left corner of the initial image to obtain a pre-detection image corresponding to the first region of the initial image. The pre-detection image has the same pixel size as the face template. Then, it slides to the right by one step to obtain a pre-detection image corresponding to the second region of the initial image. This process is repeated, moving to the right by a set step. After each slide, the overlapping area with the initial image is taken as the current matching area, and pre-detection images corresponding to other regions of the initial image are obtained. This continues until the face template reaches the rightmost end of the initial image. Then, the face template slides down by one step and returns to the leftmost end of the initial image. The above rightward sliding operation is repeated to continue obtaining pre-detection images corresponding to other regions of the initial image until the face template reaches the bottom right corner of the initial image, at which point the sliding extraction can be terminated.
[0071] Step S3: Preprocess the pre-detection image to obtain the candidate image.
[0072] The candidate images include a first image, a second image, and a third image. The preprocessing specifically includes the following steps:
[0073] Step S3.1: Perform a contrast enhancement operation on the pre-detection image to obtain a first image (e.g., ...). Figure 3 (As shown).
[0074] Contrast enhancement can reduce the blurriness of an image, making it appear clearer and sharper, and enabling more effective identification and detection of objects within the image.
[0075] In this embodiment, the contrast enhancement operation employs a histogram equalization method, such as... Figure 4a and Figure 4b As shown, after performing contrast enhancement on the pre-detection image using the histogram equalization method, the difference between different brightness regions in the obtained first image is greater than the difference between different brightness regions in the pre-detection image.
[0076] Step S3.2: Perform a binarization operation on the first image to obtain the second image (e.g., ...). Figure 5 As shown in the image, the second image contains only black and white pixel values, which facilitates subsequent facial feature extraction operations.
[0077] Step S3.3: Perform facial feature extraction on the second image to obtain the third image (e.g., Figure 6 (As shown).
[0078] The facial feature extraction operation includes: performing a morphological closing operation on the second image, and performing an XOR operation between the result of the closing operation and the second image to obtain the third image, in which only facial features are displayed.
[0079] The morphological operation closing, through a dilation-erosion sequence, can effectively fill small holes and cracks inside foreground objects in an image, smooth object edges, connect neighboring objects, eliminate minor noise, and enhance image features, thereby improving the overall quality and continuity of the image and providing a solid foundation for image preprocessing and subsequent analysis.
[0080] Step S4: Pre-screen the pre-detection image and the candidate image, remove images that meet the screening criteria, and put the images that do not meet the screening criteria into the image dataset;
[0081] The filtering criteria include: no facial features are extracted from the third image, or the face or facial features in the pre-detection image and the candidate image are distorted. A result is considered compliant if any one of the above filtering criteria is met.
[0082] By setting filtering conditions to pre-screen images, images that clearly do not contain any facial features or have facial distortions are excluded in advance. These images will not be processed again in the future, which can save computing resources, reduce memory requirements, reduce power consumption, and improve detection efficiency.
[0083] The method for determining facial or facial feature distortion includes: if the facial or facial features extracted from the pre-detection image and the candidate image meet any one or more of the distortion conditions, then the facial or facial features are determined to be distorted.
[0084] The distortion conditions include at least the following:
[0085] First condition: In the upper half of the second image, the ratio of the number of facial pixels (i.e., white pixels) excluding facial features to the total number of pixels in the upper half is less than a first threshold; and in the lower half of the candidate image, the ratio of the number of facial pixels excluding facial features to the total number of pixels in the lower half is less than a second threshold; the first threshold is 0.2 to 0.5, and the second threshold is 0.1 to 0.5. If the first condition is met, it indicates that the proportion of the face compared to facial features is too small, resulting in distortion.
[0086] The second condition is that in the second image, the aspect ratio of the face is less than a third threshold, where the third threshold is between 0.5 and 1. For example... Figure 7 As shown, the length 'a' of the face is calculated, and the maximum length value in the face pixel column is considered the face length. Multiple distance line segments corresponding to the face pixel columns are identified in the second image (e.g., ...). Figure 7 (As shown by the black solid line segments in the image), the longest of these line segments is selected as the face length 'a'. Similarly, the face width 'b' is calculated. The maximum length value in the face pixel row is considered the face width. In the second image, the distance line segments corresponding to multiple face pixel rows are identified (e.g., ...). Figure 7 (As shown by the black dashed line segments in the image), select the longest of these segments as the width b of the face, and calculate the ratio of a to b. If the second condition is met, the face length-to-width ratio is considered too low, and the face proportion is judged to be distorted.
[0087] The third condition is that the difference between the maximum and minimum pixel values in the central facial region of the pre-detection image is less than a fourth threshold, which is 5 to 10. The center point of the pre-detection image is defined as the center point of the central facial region, and the central facial region occupies approximately 30% to 50% of the pre-detection image; that is, the ratio of pixels in the central facial region to pixels in the pre-detection image is approximately 0.3 to 0.5. If the third condition is met, it indicates that the range of pixel value variation in the central facial region is too small.
[0088] Fourth condition: In the pre-detection image, the maximum pixel value in the central region of the face is greater than the fifth threshold, which is 90-150. If the fourth condition is met, it indicates that there are pixels with excessively large pixel values in the central region of the face.
[0089] Fifth condition: In the first image, the average pixel value of the central facial region is greater than the sixth threshold, which is 180-220. If the fifth condition is met, it indicates that the central facial region is too bright after contrast enhancement.
[0090] Sixth condition: The average pixel value of the largest facial feature location in the first image is greater than the seventh threshold, which is 95-115. The location of the largest facial feature is derived from the third image. If the sixth condition is met, it indicates that the region corresponding to the largest connected component (the largest facial feature) is too bright after contrast enhancement following facial feature extraction.
[0091] After pre-screening the current image, it is determined whether all regions on the initial image have been matched, that is, whether a pre-detection image corresponding to all regions in the initial image has been obtained; if not, the matching region is updated and the process returns to step S2, that is, the predefined face template is used to continue sliding on the initial image according to the set step size to extract the pre-detection image corresponding to the next region of the initial image, and the preprocessing and pre-screening are continued; if yes, step S5 is executed.
[0092] Step S5: Calculate the matching degree between the images in the image dataset and the face template, and determine the best matching region of the initial image.
[0093] The matching degree is the weighted average of the pixel differences (weighted average absolute error) between the images in the image dataset and the face template. To improve detection accuracy, both the first matching degree and the second matching degree are calculated for each match.
[0094] The predefined weights of each pixel in the face template are as follows: pixels around the facial features have higher weights, the face itself (excluding the facial features) has lower weights, and pixels excluding the facial features have a weight of 0. For example... Figure 8 As shown, the darker the color, the lower the weight; black represents a weight of 0, and dark gray represents a weight of 1. The weight of pixels (white) in the facial features area is 3 to 5 times the ratio of the number of pixels (light gray and dark gray) in the facial region of the face template to the number of pixels (white) in the facial features area. The weight of pixels (light gray) in the area surrounding the facial features is the ratio of the sum of the pixel weights in the facial features area to the number of pixels in the area surrounding the facial features.
[0095] Calculate the first matching degree: Calculate the matching degree between the pre-detection image and the face template to obtain the first matching degree M1;
[0096]
[0097] Where N is the number of pixels in the face template, w l Let I be the weight corresponding to the l-th pixel of the face template.1l Let I' be the value of the l-th pixel in the pre-detection image. 1l This is the value of the l-th pixel in the face template.
[0098] Calculate the second matching degree: Perform a contrast enhancement operation on the face template to obtain a contrast-enhanced face template (e.g., Figure 9 As shown), calculate the matching degree between the first image and the contrast-enhanced face template to obtain the second matching degree M2;
[0099]
[0100] Where N is the number of pixels in the face template, w l Let I be the weight corresponding to the l-th pixel of the face template. 2l Let I' be the value of the l-th pixel in the first image. 2l The value of the l-th pixel in the face template for enhanced contrast.
[0101] The first and second matching degrees of the images in the image dataset are compared respectively, and the initial image region corresponding to the smallest first matching degree and the smallest second matching degree is selected as the best matching region.
[0102] like Figure 10 As shown, after calculating the matching degree between the face template and all regions of the initial image, the minimum value of each of the two matching degrees is taken among all matching regions to find the optimal matching region in the initial image with the smallest pixel difference from the face template. Figure 10 The area within the white box in the diagram. It's possible that the two minimum values of the two matching degrees correspond to the same area; in this case, the area is considered the best matching area. Alternatively, it's possible that the two minimum values of the two matching degrees correspond to two different areas; in this case, both of these different areas are considered the best matching areas.
[0103] Step S6: Perform face detection based on the matching degree of the best matching region. If the matching conditions are met, it is determined that a face has been detected in the original image.
[0104] If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is less than the second matching threshold, then the matching condition is determined to be met; the first matching threshold is 65 to 70, and the second matching threshold is 17.5 to 18.5.
[0105] If the first matching degree corresponding to the best matching region is greater than or equal to the first matching threshold, and the second matching degree is less than the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied. The symmetry threshold is 0.75 to 0.85.
[0106] If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is greater than or equal to the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied. The symmetry threshold is 0.75 to 0.85.
[0107] If there are two optimal matching regions, then as long as either optimal matching region meets the above matching conditions, it can be determined that a face has been detected.
[0108] In one embodiment, the uninterrupted face detection method provided by the present invention was used to detect 100 RAW images with a size of 32×24 pixels. Among them, 47 out of 50 face images were detected to contain faces, and 3 out of 50 background images were misidentified as containing faces. Overall, the recognition rate is relatively high.
[0109] This invention directly uses RAW images for face detection, avoiding unnecessary image processing and conversion operations, saving computational resources, and improving detection efficiency. By setting filtering conditions to pre-screen images, images that clearly lack any facial features or have facial distortions are excluded in advance, eliminating the need for further processing. This saves computational resources, reduces memory requirements, lowers power consumption, and improves detection efficiency. Introducing weights and weighted average errors to calculate the matching degree reduces computational complexity, saves computational resources, and improves computational accuracy. This invention is particularly suitable for uninterrupted detection applications with low power consumption and low storage requirements.
[0110] It should be noted that, in the embodiments of the present invention, the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential," etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the accompanying drawings and are only for the convenience of describing the embodiments. They do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0111] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0112] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described feature, integral, step, operation, element and / or component, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0113] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0114] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0115] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0116] Although the present invention has been described in detail through the preferred embodiments above, it should be understood that the above description should not be considered as a limitation of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present invention. After reading the above content, various modifications and substitutions to the present invention will be obvious to those skilled in the art. Therefore, the scope of protection of the present invention should be defined by the appended claims.
Claims
1. A method for uninterrupted face detection, characterized in that, Include: Extracting a single color component from the original image in real time to form an initial image; A predefined face template is slid across the initial image to extract multiple pre-detection images corresponding to different regions of the initial image. The pixel size of the pre-detection images is consistent with that of the face template. The multiple pre-detection images are preprocessed to obtain candidate images; Pre-screening is performed on the plurality of pre-detection images and / or the plurality of candidate images to remove images that meet the screening criteria and to put images that do not meet the screening criteria into the image dataset. Calculate the matching degree between the images in the image dataset and the face template, and determine the best matching region of the initial image; Face detection is performed based on the matching degree of the optimal matching region. If the matching conditions are met, it is determined that a face has been detected in the original image.
2. The uninterrupted face detection method as described in claim 1, characterized in that, The preprocessing includes: A contrast enhancement operation is performed on the pre-detection image to obtain a first image, wherein the difference between different brightness regions in the first image is greater than the difference between different brightness regions in the pre-detection image; The first image is binarized to obtain the second image, which contains only black and white pixel values. The facial features are extracted from the second image to obtain the third image.
3. The uninterrupted face detection method as described in claim 2, characterized in that, The facial feature extraction operation includes: performing a morphological closing operation on the second image, and XORing the result of the closing operation with the second image to obtain the third image.
4. The uninterrupted face detection method as described in claim 2, characterized in that, The filtering criteria include: No facial features were extracted from the third image; Alternatively, the faces or facial features in the pre-detection images and the candidate images may be distorted.
5. The uninterrupted face detection method as described in claim 4, characterized in that, Methods for identifying facial or feature distortion include: If the face or facial features extracted from the pre-detection image and the candidate image meet any one or more of the distortion conditions, then it is determined that the face or facial features are distorted. The distortion conditions include: In the upper half of the second image, the ratio of the number of facial pixels without facial features to the total number of pixels in the upper half is less than a first threshold, and in the lower half of the candidate image, the ratio of the number of facial pixels without facial features to the total number of pixels in the lower half is less than a second threshold. In the second image, the aspect ratio of the face is less than the third threshold; In the pre-detection image, the difference between the maximum and minimum pixel values in the central region of the face is less than the fourth threshold. In the pre-detection image, the maximum pixel value in the central region of the face is greater than the fifth threshold. In the first image, the average pixel value of the central facial region is greater than the sixth threshold; The average pixel value of the largest facial feature position in the first image is greater than a seventh threshold, wherein the position of the largest facial feature is derived from the third image.
6. The uninterrupted face detection method as described in claim 5, characterized in that, The first threshold is 0.2 to 0.5, the second threshold is 0.1 to 0.5, the third threshold is 0.5 to 1, the fourth threshold is 5 to 10, the fifth threshold is 90 to 150, the sixth threshold is 180 to 220, and the seventh threshold is 95 to 115.
7. The uninterrupted face detection method as described in claim 4, characterized in that, The method for calculating the matching degree includes: Calculate the matching degree between the pre-detection image and the face template to obtain the first matching degree M1; Perform a contrast enhancement operation on the face template to obtain a contrast-enhanced face template, calculate the matching degree between the first image and the contrast-enhanced face template, and obtain a second matching degree M2.
8. The uninterrupted face detection method as described in claim 7, characterized in that, The formula for calculating the matching degree is: Where N is the number of pixels in the face template, w l Let I be the weight corresponding to the l-th pixel of the face template. l I' is the value of the l-th pixel in the pre-detection image or the first image. l The value of the l-th pixel in a face template or a contrast-enhanced face template.
9. The uninterrupted face detection method as described in claim 8, characterized in that, The weights of each pixel in the face template are predefined: The weight of the pixels in the facial features region is 3 to 5 times the ratio of the number of pixels in the face region to the number of pixels in the facial features region of the face template; The weight of pixels in the area surrounding the facial features is the ratio of the sum of the pixel weights in the facial feature area to the number of pixels in the area surrounding the facial features.
10. The uninterrupted face detection method as described in claim 7, characterized in that, Determining the optimal matching region of the initial image includes: comparing the first matching degree and the second matching degree in the image dataset respectively, and selecting the initial image region corresponding to the smallest first matching degree and the smallest second matching degree as the optimal matching region.
11. The uninterrupted face detection method as described in claim 10, characterized in that, Face recognition based on the matching degree of the optimal matching region includes: If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is less than the second matching threshold, then the matching condition is satisfied. If the first matching degree corresponding to the best matching region is greater than or equal to the first matching threshold, and the second matching degree is less than the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied. If the first matching degree corresponding to the best matching region is less than the first matching threshold, and the second matching degree is greater than or equal to the second matching threshold, then the symmetry of the second image corresponding to the best matching region is calculated. If the symmetry is greater than the symmetry threshold, then the matching condition is satisfied.
12. The uninterrupted face detection method as described in claim 11, characterized in that, The first matching threshold is 65-70, the second matching threshold is 17.5-18.5, and the symmetry threshold is 0.75-0.
85.
13. The uninterrupted face detection method as described in claim 1, characterized in that, The pixel size of the face template is smaller than the pixel size of the initial image, and the sliding step size is the pixel size of the face template.
14. The uninterrupted face detection method as described in claim 1, characterized in that, The single color component is either the red component of the R channel, or the green component of the G channel, or the blue component of the B channel.
15. The uninterrupted face detection method as described in claim 2, characterized in that, The contrast enhancement operation employs a histogram equalization method.
16. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the uninterrupted face detection method according to any one of claims 1 to 15.
17. A readable storage medium, characterized in that, The readable storage medium stores a computer program, which, when executed by a processor, implements the uninterrupted face detection method according to any one of claims 1 to 15.