Living body detection method based on structured light spot gradient energy
By analyzing the difference in spot clarity in structured light images, the problem of difficulty in detecting 3-dimensional masks and distorted photos in the prior art is solved, and the accurate detection of living areas is achieved, and the security of the face recognition system is improved.
Patent Information
- Application Number
- PCT/CN2023/116842
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-13
AI Technical Summary
Existing facial recognition systems are difficult to effectively detect living bodies when facing 3-dimensional masks or distorted photos attacks, resulting in safety hazards and public safety management challenges.
The living organism detection method based on the gradient energy of structured light spots is adopted. By positioning and analyzing the clarity of each spot in the structured light image, the difference between the low spot sharpness of the spot in the living area and the high spot sharpness of the non-living area is achieved accurately detecting the living area.
This method can effectively overcome the defects of the prior art that it is difficult to deal with 3-dimensional mask attacks, realize the positioning and detection of living areas in speckled structured light images, and improve the security of the face recognition system.
Smart Images

Figure CN2023116842_13032025_PF_FP_ABST
Abstract
Description
Living body detection method based on structured light spot gradient energy Technical Field
[0001] The present invention relates to the technical field of liveness detection, and in particular to a liveness detection method based on structured light spot gradient energy. Background Art
[0002] Existing facial recognition systems still present numerous security risks. Due to the easy availability of facial information, imposters can easily deceive facial recognition systems by impersonating legitimate users. Common facial spoofing attacks include printing photos of faces, displaying faces on screen, and wearing 3D masks. This behavior not only poses significant security risks to users' property and privacy, but also poses significant challenges to public safety management.
[0003] With the increasingly widespread application of facial recognition technology in all walks of life and production, it is necessary and urgent to develop facial fraud detection technology to ensure the security of facial recognition systems. Researchers have proposed a large number of related technologies, and some of them have been put into practical application. One common method is liveness detection based on structured light analysis. Specifically, this method first projects a speckle structured light image onto the detection target, and then uses a binocular camera or a monocular camera to detect the degree of deformation of the speckle structured light to determine the three-dimensional morphology of the object. This method can effectively detect printed photos or screen displays with flat structures, but it is difficult to deal with attacks such as 3D masks or distorted photos. Technical issues
[0004] The purpose of the present invention is to address the technical deficiencies in the security of existing face recognition systems and to provide a liveness detection method based on the gradient energy of structured light spots. Unlike the existing liveness detection method that detects the overall deformation of structured light images, the present invention performs clarity detection on each light spot in the structured light image, and utilizes the difference between the low clarity of the light spots in the living area and the high clarity of the light spots in the non-living area to innovate a liveness detection method based on structured light analysis. Technical Solutions
[0005] To achieve the above object, the present invention provides the following technical solution: a method for detecting living bodies based on the gradient energy of structured light spots, characterized in that it comprises the following steps:
[0006] S1. Structured light image acquisition: using an optical imaging device to acquire a structured light image containing human skin;
[0007] S2. Locate all light spots in the structured light image. First, calculate the optimal pixel value threshold for distinguishing light spots from the background. Then, binarize the image based on the threshold to obtain a mask highlighting the light spot area. Then, obtain the position information of all light spots, including the center coordinates and the position of the smallest rectangle containing the corresponding area.
[0008] S3. Select the light spot in the living body area. First, traverse all the light spot images in the original image, then calculate the clarity of each light spot image, and finally select the light spot image with a clarity lower than a preset value as the detection result of the light spot in the living body area;
[0009] S4. Mark the liveness detection results in the structured light image, divide the image evenly into N sub-images, and perform an ordered search on the sub-images. The ordered search includes searching the sub-image for the light spots of the living area detected in step S3. If there are no light spots of the living area in the sub-image, jump to the next sub-image to continue searching. Otherwise, use the first light spot of the living area searched in the sub-image as the initial light spot of the light spot set, search for light spots of the living area in the neighborhood of the initial light spot, include the searched light spots in the light spot set, and start the next round of search in the neighborhood of these light spots. Repeat the addition of the searched light spots to the light spot set and start the next round of search in the neighborhood of these light spots until no new light spots of the living area are found, and repeat the ordered search until all sub-images are traversed. Finally, compare all the obtained light spot sets, retain the non-repeated light spot sets, and mark the retained light spot sets in the original image with different colors.
[0010] Preferably, the energy gradient function in step S3 is:
[0011] (1)
[0012] Where D represents the image clarity, f represents the image, h and w represent the height and width of the image.
[0013] Preferably, the light spot image clarity value selected in step S3 needs to be adjusted according to the brightness of the structured light and the distance between the camera and the face.
[0014] Preferably, the initial spot neighborhood size of the spot set in step S4 is 100 x 100 pixels.
[0015] The algorithm for calculating the optimal pixel value threshold for distinguishing the light spot from the background in step S2 is the Otsu threshold method.
[0016] The method for obtaining the position information of all light spots in step S2 is to input the mask of the highlighted light spot area into the regionprops function in Matlab software for calculation.
[0017] In step S3, all the spot images in the original image are traversed, including the images within the smallest rectangle of the spot area and the spot images with an area less than 45 pixels are screened out.
[0018] In step S3, the energy gradient function is used to calculate the clarity of each spot image. Finally, the spot images with a clarity lower than 900 are selected as the detection results of the living area spot. If there are no spots that meet the conditions or there are no more than 10 spots that meet the conditions, it is determined that there is no living body in the image, and a mark related to no living body detected is marked on the original image. Beneficial effects
[0019] Compared with the existing technology, the beneficial effect of the present invention is that the liveness detection method based on structured light spot gradient energy overcomes the defect that liveness detection based on structured light analysis is difficult to cope with the attack of 3D masks, and at the same time realizes the positioning of the living area in the speckle structured light image. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] FIG1 is a schematic diagram showing the comparison of light spot clarity between living area and non-living area;
[0021] FIG2 is a flow chart of a method for detecting living bodies based on structured light spot clarity according to the present invention. Best Mode for Carrying Out the Invention
[0022] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0023] Referring to FIG1-2 , the present invention provides a method for detecting living bodies based on structured light spot gradient energy, which is used to accurately detect the living body skin area under the interference of high-definition photos and dummy models, including the following steps:
[0024] S1. Structured light image acquisition: Use an optical imaging device to acquire a structured light image containing human skin. The optical imaging device has an infrared camera sensor, includes a monitoring function in the 760-940 nanometer near-infrared band, and can emit a light source with a speckle structured light emission power of 180 mW, providing continuous and stable illumination.
[0025] To achieve the goal of liveness detection of the detection object, this embodiment uses a near-infrared industrial camera with a resolution of 2592 x 1944 to capture images of the detection object under structured light illumination, significantly enhancing the difference in clarity between the light spots in the living area and the non-living area. Based on this, an algorithm is designed to detect the clarity and position of the light spots in the image. If a living organism is present, the presence of the living organism in the image can be determined, and the location of the living organism can be given.
[0026] S2. Locate all light spots in the structured light image. First, use the Otsu threshold method to calculate the optimal pixel value threshold that can distinguish the light spots from the background. Then, binarize the image based on this threshold to obtain a mask that highlights the light spot area. Then, input this mask into the regionprops function in Matlab software to obtain the position information of all light spots, including the center coordinates and the position of the smallest rectangle containing the corresponding area.
[0027] S3. Select the light spot located in the living area. First, traverse all the light spot images in the original image, including the image within the smallest rectangle of the light spot area, and filter out the light spot images with an area of less than 45 pixels. Then, use the energy gradient function to calculate the clarity of each light spot image. The definition of the modified energy gradient function is shown in Formula 1:
[0028] (1)
[0029] Where D represents the image clarity, f represents the image, and h and w represent the height and width of the image. Finally, the spot image with a clarity lower than 900 (this parameter needs to be adjusted based on the brightness of the structured light and the distance between the camera and the face) is selected as the detection result of the living area spot. If there are no spots that meet the conditions or there are no more than 10 spots that meet the conditions, it is determined that there is no living person in the image, and "No living person detected in this image" is marked at the top of the original image.
[0030] S4. Mark the liveness detection results in the structured light image, divide the image into N sub-images, N is more than two, preferably 16 sub-images, and perform an orderly search on the sub-images. The orderly search includes: A. Searching for the light spot of the living area detected in step S3 in the sub-image. If there is no light spot of the living area in the sub-image, skip to the next sub-image to continue searching. Otherwise, the light spot of the first living area found in the sub-image is used as the initial light spot of the light spot set. B. In the neighborhood of the initial light spot, for example, the size of the initial light spot neighborhood is 100 x Search for light spots in the living area within 100 pixels. C. Add the searched light spots to the light spot set and start the next round of search in the neighborhood of these light spots. D. Repeat C to add the searched light spots to the light spot set and start the next round of search in the neighborhood of these light spots until no new light spots in the living area are found. Repeat the orderly search A, B, C, D until all sub-graphs are traversed. Finally, compare all the obtained light spot sets, retain the non-duplicate light spot sets, and mark the retained light spot sets in the original image with different colors.
[0031] The following specific implementation is also included, which uses real-time analysis of images collected from the imaging device end, including the following specific steps:
[0032] a. Structured light spot detection module: Detects all light spots larger than 45 pixels in the structured light image and provides their location information.
[0033] b. Structured light spot image clarity module: uses the modified energy gradient function of the present invention to calculate the clarity of the spot image.
[0034] c. Living body area spot detection module: Determines whether the light spot is in the living body area based on the clarity of the light spot.
[0035] d. UI: Display the captured structured light image on the UI and mark the detection results. If more than 10 spots of light representing living areas are detected, the locations of all the spots will be marked on the UI. Otherwise, a non-living area marker will be marked on the original image, such as "No living area detected in this image" at the top of the original image.
[0036] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
Claims
1. A living body detection method based on structured light spot gradient energy, characterized in that: The following steps are involved: S1. acquiring a structured light image, using an optical imaging device to acquire a structured light image containing human skin; S2. Locate all the light spots in the structured light image. First, calculate the optimal pixel value threshold for distinguishing the light spots from the background. Then, binarize the image according to the threshold to obtain a mask highlighting the light spot area. Then, obtain the position information of all the light spots, including the center coordinates and the position of the smallest rectangle containing the corresponding area. S3, selecting the light spot located in the living body area, first traversing all the light spot images in the original image, then calculating the clarity of each light spot image, and finally selecting the light spot image with a clarity lower than a preset value as the detection result of the light spot in the living body area; S4. Mark the liveness detection result in the structured light image, divide the image evenly into N sub-images, and perform an orderly search on the sub-images. The orderly search includes searching the sub-image for the light spot of the live area detected in step S3. If there is no light spot of the live area in the sub-image, jump to the next sub-image to continue the search. Otherwise, use the first light spot of the live area searched in the sub-image as the initial light spot of the light spot set, search for the light spot of the live area in the neighborhood of the initial light spot, incorporate the searched light spots into the light spot set and start the next round of search in the neighborhood of these light spots, repeatedly incorporate the searched light spots into the light spot set and start the next round of search in the neighborhood of these light spots, until no new light spots of the live area are found, and repeat the orderly search until all sub-images are traversed. Finally, compare all the acquired light spot sets, retain the non-repeated light spot sets, and mark the retained light spot sets in the original image with different colors.
2. The method for detecting living bodies based on structured light spot gradient energy according to claim 1, characterized in that: The energy gradient function in step S3 is: (1) Where D represents the clarity of the image, f represents the image, and h and w represent the height and width of the image.
3. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The light spot image clarity value selected in step S3 needs to be adjusted according to the brightness of the structured light and the distance between the camera and the face.
4. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The initial spot neighborhood size of the spot set in step S4 is 100 x 100 pixels.
5. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The N sub-graphs are 16 sub-graphs.
6. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The optical imaging device used in step S1 is an infrared camera sensor having a monitoring function in the near-infrared band of 760-940 nanometers.
7. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The algorithm for calculating the optimal pixel value threshold for distinguishing the light spot from the background in step S2 is the Otsu threshold method.
8. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: The method for obtaining the position information of all light spots in step S2 is to input the mask of the highlighted light spot area into the regionprops function in Matlab software for calculation.
9. The method for liveness detection based on structured light spot gradient energy according to claim 1, characterized in that: In step S3, all the spot images in the original image are traversed, including the images within the smallest rectangle of the spot area and the spot images with an area less than 45 pixels are screened out.
10. The method for liveness detection based on structured light spot gradient energy according to claim 9, characterized in that: In step S3, the clarity of each spot image is calculated using the energy gradient function, and finally the spot image with a clarity lower than 900 is selected as the detection result of the spot in the living area. When there is no spot that meets the conditions or there are no more than 10 spots that meet the conditions, it is determined that there is no living body in the image, and a mark related to no detection of living body is marked on the original image.
Citation Information
Patent Citations
Face scanning payment system based on depth camera
CN113255587A
Living body detection method, system and device based on face light spot image and medium
CN113468920A
Light spot center positioning method and device
CN116188588A
Focusing device and method for rapid intelligent high-precision infrared imaging lens
CN116224531A
Liveness detection method, liveness detection system, and computer program product
US20170286788A1