Living body recognition method based on binocular infrared face detection

By linking a binocular infrared camera with an LED fill light component, and combining inter-frame position calibration and dark channel data calculation, the contour features of the infrared image are extracted, and a three-level defense system is constructed. This solves the problems of inaccurate edge detection and insufficient anti-attack capability in infrared scene liveness detection, and achieves efficient and stable liveness detection effect.

CN121838280APending Publication Date: 2026-04-10SHANGHAI FULLHAN MICROELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing liveness detection algorithms based on RGB images are inaccurate in edge detection in infrared scenes, fail to effectively utilize the characteristics of infrared images, resulting in a high false positive rate, insufficient resistance to forgery attacks, and inability to adapt to low-performance hardware environments.

Method used

By using a dual-lens infrared camera and an LED fill light component, a face detection algorithm is used to locate the inter-frame position offset. The depth of field is calculated by combining dark channel data, the face contour is extracted and weighted edge detection is performed, and a three-level defense system is built to improve recognition accuracy and anti-attack capability.

Benefits of technology

It significantly improves the success rate of liveness detection in infrared environments, enhances adaptability to low-light and complex lighting scenarios, reduces the false positive rate, and can run stably on low-performance hardware, possessing strong anti-attack capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121838280A_ABST
    Figure CN121838280A_ABST
Patent Text Reader

Abstract

The invention relates to a living body recognition method based on binocular infrared face detection. The method comprises the following steps: acquiring infrared image data in different illumination states through linkage of a binocular infrared camera and an LED light supplementing assembly; positioning the position of a face frame in continuous frames, and extracting dark channel data in the frame; calculating an inter-frame face position offset, and comparing a preset threshold to obtain a comparison identifier; calculating depth-of-field data in combination with the comparison identifier and the dark channel data, and obtaining a binarized depth-of-field image through binarization; extracting a face contour, and comparing the contour perimeter with a preset threshold to obtain a contour set conforming to the size; polygon approximation is carried out on the contour set, the number of vertexes is obtained and compared with a preset threshold interval, and candidate face depth-of-field images are obtained; gradient information is obtained through edge detection, weighting calculation is carried out by presetting a face outer side weighting point and giving a weight, and a preset living body threshold value is compared through normalization operation, so that living body recognition based on binocular infrared face detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of biometrics and computer vision technology, specifically relating to a liveness detection method based on binocular infrared face detection. Background Technology

[0002] Currently, liveness detection based on binocular infrared face detection still has the following areas for improvement: With the widespread application of biometric technology in fields such as smart security, smart terminals, and in-vehicle interaction, facial liveness recognition, as a core component of identity verification, has become a key requirement for technological development in terms of security and environmental adaptability. Infrared facial liveness recognition, with its advantages of strong resistance to light interference and effective avoidance of RGB images being susceptible to visible light spoofing attacks, is gradually becoming the preferred solution in low-light and complex lighting scenarios, especially in the urgent application of smart camera terminals.

[0003] Existing technologies include liveness detection algorithms based on RGB images. These algorithms calculate frame differences by acquiring image depth information, and then extract image edge information using dual-threshold filtering and edge detection to achieve liveness detection. However, in practical applications, it has been found that edge detection results for RGB images show that facial contour information is mainly concentrated in the central area. In contrast, images captured by infrared cameras are affected by the imaging characteristics of infrared light, resulting in effective facial information being concentrated in the outer regions. This leads to inaccurate edge feature extraction and insufficient utilization of contour information when traditional RGB liveness detection algorithms are directly transferred to infrared scenes, severely impacting the success rate of liveness detection.

[0004] Existing infrared liveness detection solutions lack specific optimization designs for the characteristics of infrared images. On the one hand, they fail to consider the interference of positional shifts between frames in infrared images on depth calculations, easily leading to distortion of depth information due to excessive inter-frame displacement, thus causing misjudgments. On the other hand, they rely solely on single edge detection or threshold filtering, without designing targeted judgment mechanisms for the contour discontinuities inherent in forgery attacks (such as photo attacks) in infrared images, making it difficult to effectively resist planar forgery attacks. Furthermore, some algorithms have high computational complexity, making them unsuitable for the low-performance chip requirements of smart camera terminals, limiting their widespread deployment on the terminal side.

[0005] Therefore, optimizing the liveness detection process based on the imaging characteristics of infrared images, improving the accuracy and anti-attack capability of liveness detection in infrared scenes through precise inter-frame processing, contour judgment and lightweight computing, while adapting to low-performance hardware environments on the terminal side, has become a technical challenge that current infrared face liveness detection technology urgently needs to solve. Summary of the Invention

[0006] To address the aforementioned problems in the existing technology, this invention provides a liveness detection method based on binocular infrared face detection; The objective of this invention can be achieved through the following technical solutions: S1: By linking a preset binocular infrared camera with an LED fill light component, infrared image data of the lighting conditions is obtained; S2: Based on the infrared image data, a preset face detection algorithm is called to locate the face bounding box position information in consecutive frame images, and the dark channel data of the face bounding box region is extracted; based on the face bounding box position information and the dark channel data, the inter-frame face position offset is calculated, and the inter-frame face position offset is compared with a preset threshold to obtain comparison identification information; based on the comparison identification information and the dark channel data, depth data is calculated, and the depth data is binarized to obtain a binarized depth image; S3: Obtain the face contour based on the binarized depth image, calculate the contour perimeter and compare it with a preset face contour perimeter threshold to obtain a face size range contour set; perform polygon approximation processing on the face size range contour set to obtain the number of polygon vertices, and compare the number of vertices using a preset face contour vertex threshold range to obtain a candidate face depth image. S4: Perform edge detection based on the candidate face depth image to obtain edge gradient information; calculate and normalize the edge gradient information by pre-setting weighted points in the outer region of the face and assigning weight coefficients to obtain the processing result; compare the processing result with a preset liveness threshold to obtain the liveness recognition result of the candidate face depth image.

[0007] As a preferred technical solution of the present invention, the specific process of locating the position information of the face box in the continuous frame image includes: calling a preset face detection algorithm to perform traversal scanning on the acquired continuous frame infrared images respectively, and identifying the regions in the image that conform to the face contour features; Based on the confidence score of the candidate bounding boxes in the face detection algorithm, the candidate regions are screened, and the coordinates are calibrated to obtain the first identifier of the face bounding box position information. The first identifier of the face bounding box position information is then adapted and verified with the image resolution to obtain the second identifier of the face bounding box position information in the consecutive frame images.

[0008] Specifically, the process of extracting the dark channel data of the region within the face frame includes: based on the second identifier of the face frame position information, cropping the corresponding pixel region within the face frame to obtain a partial face image; reading the pixel brightness values ​​of the R, G, and B channels of the partial face image to obtain the brightness data of the pixel in the three channels; The dark channel luminance value of each pixel is calculated using the dark channel algorithm formula to obtain the luminance characteristics of the image; the dark channel luminance values ​​are then arranged in relative coordinate order to obtain the dark channel data matrix of consecutive frames.

[0009] Specifically, obtaining the comparison identification information includes: calculating the center coordinates of the face box based on the second identifier of the face box position information of the consecutive frame images, and calculating the offset of the face box center position between consecutive frames using the Manhattan distance formula; comparing the position offset with the coordinate displacement threshold by a preset coordinate displacement threshold to generate identification information.

[0010] Specifically, the binarization operation on the depth data includes: obtaining depth data by using depth calculation based on the identification information and the dark channel data matrix; By using preset dual threshold parameters, the depth difference of pixels is traversed and judged to generate a binarization judgment result. Based on the binarization judgment result, the binarization results of pixels are integrated in the original coordinate order to obtain a binarized depth image. Specifically, the process of obtaining the facial contour includes: performing contour detection on the binarized depth image using a contour extraction algorithm to obtain the contour detection result; performing polygon approximation processing based on the contour detection result to obtain the vertex coordinate sequence, and fitting the curve contour into a polygon contour using the Douglas-Puk algorithm; performing closure verification on the polygon contour to obtain a set of candidate facial contours.

[0011] Specifically, obtaining the face size range contour set includes: obtaining the bounding rectangle size of the candidate face contour based on the candidate face contour set, comparing the bounding rectangle size using a preset threshold range, and obtaining the face size range contour set.

[0012] Specifically, obtaining the number of polygon vertices includes: based on the face size range contour set and the vertex coordinate sequence, counting the number of vertices corresponding to the contours, performing a reasonableness check on the number of vertices, and obtaining the check result; associating and storing the check result with the number of vertices to obtain a mapping table between contours and the number of vertices.

[0013] Specifically, obtaining the candidate face depth image includes: extracting the number of vertices of the face size range contour based on the contour-vertex mapping table, and comparing it with the face contour vertex threshold range to obtain the candidate face region; The candidate face region is cropped, and the edges of the fragment are smoothed. The coordinate information of the processed candidate face region image and the binarized depth image are associated and labeled to obtain a standardized candidate face depth image.

[0014] Specifically, obtaining edge gradient information includes: converting the candidate face depth image into a single-channel grayscale image, using the Sobel operator to obtain the edge gradient matrix after parameter fusion, normalizing the edge gradient matrix, mapping the gradient intensity values, and obtaining the gradient image of the edge gradient information.

[0015] Specifically, obtaining the processing result includes: dividing the candidate face depth image into regions, setting weight coefficients for the region division result based on the edge gradient matrix, obtaining the gradient integral by summation, and standardizing the gradient integral to obtain the normalized processing result.

[0016] Specifically, the process of obtaining the liveness detection result of the candidate face depth image includes: comparing the normalized result with the liveness detection threshold by setting a liveness determination threshold, generating a recognition result, associating and storing the recognition result with corresponding parameters, and obtaining a standardized recognition result signal.

[0017] The beneficial effects of this invention are as follows: Adapting to the characteristics of infrared images and improving recognition accuracy: In response to the core characteristic that facial information in infrared images is concentrated on the outer side, a dedicated optimization mechanism for weighted facial region and contour continuity verification is designed to solve the problem of inaccurate feature extraction when traditional RGB algorithms are transferred to infrared scenes. This significantly improves the success rate of liveness recognition in infrared environments, and is especially more adaptable to low-light and complex lighting scenes.

[0018] Enhanced anti-attack capabilities and guaranteed identification security: Through a three-level defense system of inter-frame position calibration, binarized depth-of-field filtering and contour continuity judgment, it accurately identifies photos, screens, etc.; 2D planar forgery attacks: by taking advantage of the three-dimensional structural differences between real faces and forgeries, it blocks the attack path from the underlying data level, significantly improving the anti-forgery attack capability compared to traditional solutions and reducing the risk of identity theft.

[0019] Lightweight algorithm design adapts to terminal deployment requirements: It adopts a simplified gradient calculation method and Douglas-Puk contour simplification algorithm to reduce computational complexity while ensuring recognition accuracy. It avoids over-reliance on high-performance hardware and can run stably in low-performance chip environments such as smart camera terminals, thus broadening the application scenarios of the technology. Optimized inter-frame data processing improves recognition stability: It calculates the inter-frame face position offset by Manhattan distance and performs validity verification, eliminating invalid data with excessive displacement. This ensures the homogeneity and accuracy of depth calculation, reduces misjudgments caused by inter-frame interference, and makes the liveness detection results more stable and reliable, adapting to scenarios with slight face movement in real-world applications.

[0020] A standardized process for image acquisition, data processing, contour verification, and liveness detection is established. Each step is tightly integrated with data flow and operates in a closed-loop logic. Furthermore, core parameters (such as thresholds and weighting coefficients) can be flexibly adjusted according to specific scenarios, reducing deployment and adaptation costs and facilitating large-scale applications in fields such as security access control and vehicle interaction. Attached Figure Description

[0021] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.

[0022] Figure 1 This is a flowchart illustrating a liveness detection method based on binocular infrared face detection according to the present invention. Figure 2 This is a flowchart of the process for obtaining candidate face depth images in this invention. Detailed Implementation

[0023] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following detailed description of the specific implementation methods, structures, features and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided.

[0024] Please see Figure 1-2 A liveness detection method based on binocular infrared face detection includes: S1: By linking a preset binocular infrared camera with an LED fill light component, infrared image data of the lighting conditions is obtained; S2: Based on the infrared image data, a preset face detection algorithm is called to locate the face bounding box position information in consecutive frame images, and the dark channel data of the face bounding box region is extracted; based on the face bounding box position information and the dark channel data, the inter-frame face position offset is calculated, and the inter-frame face position offset is compared with a preset threshold to obtain comparison identification information; based on the comparison identification information and the dark channel data, depth data is calculated, and the depth data is binarized to obtain a binarized depth image; S3: Obtain the face contour based on the binarized depth image, calculate the contour perimeter and compare it with a preset face contour perimeter threshold to obtain a face size range contour set; perform polygon approximation processing on the face size range contour set to obtain the number of polygon vertices, and compare the number of vertices using a preset face contour vertex threshold range to obtain a candidate face depth image. S4: Perform edge detection based on the candidate face depth image to obtain edge gradient information; calculate and normalize the edge gradient information by pre-setting weighted points in the outer region of the face and assigning weight coefficients to obtain the processing result; compare the processing result with a preset liveness threshold to obtain the liveness recognition result of the candidate face depth image.

[0025] As a preferred technical solution of the present invention, the specific process of locating the position information of the face box in the continuous frame image includes: calling a preset face detection algorithm to perform traversal scanning on the acquired continuous frame infrared images respectively, and identifying the regions in the image that conform to the face contour features; Based on the confidence score of the candidate bounding boxes in the face detection algorithm, the candidate regions are screened, and the coordinates are calibrated to obtain the first identifier of the face bounding box position information. The first identifier of the face bounding box position information is then adapted and verified with the image resolution to obtain the second identifier of the face bounding box position information in the consecutive frame images.

[0026] In this embodiment, the preset face detection algorithm can be a deep learning algorithm suitable for infrared images. This type of algorithm can learn the general contour features of a face through training, such as the layout relationship of eyebrows, eyes, mouth, and nose. When scanning consecutive frames of infrared images, the algorithm will determine whether each region matches the face contour features and output multiple candidate boxes and their corresponding confidence scores. The confidence score is used to measure the probability that the candidate box is a real face. During the screening process, candidate boxes with confidence scores higher than the set standard are retained, while candidate boxes in non-face areas with low confidence scores are removed. Coordinate calibration is to fine-tune the position of the screened candidate boxes to ensure that the box accurately selects the face region, forming a first identifier (x, y) containing the coordinates (x, y) of the upper left corner vertex of the face box and the width w and height h of the box. Then, the first identifier is adapted and verified with the image resolution to avoid the face box exceeding the effective display range of the image. If it exceeds the effective display range, the coordinates are adjusted to finally obtain a second identifier that can accurately locate the face and adapt to the image size.

[0027] Specifically, the process of extracting the dark channel data of the region within the face frame includes: based on the second identifier of the face frame position information, cropping the corresponding pixel region within the face frame to obtain a partial face image; reading the pixel brightness values ​​of the R, G, and B channels of the partial face image to obtain the brightness data of the pixel in the three channels; The dark channel luminance value of each pixel is calculated using the dark channel algorithm formula to obtain the luminance characteristics of the image; the dark channel luminance values ​​are then arranged in relative coordinate order to obtain the dark channel data matrix of consecutive frames.

[0028] In this embodiment, the second identifier (x, y, w, h) of the face bounding box location information clearly defines the specific range of the face in the image. Based on this identifier, the pixel area within the face bounding box can be accurately extracted to obtain a local image containing only the face, eliminating interference from the background area. The R, G, and B channels of the infrared image each carry different brightness information. By reading the brightness data R(x,y), G(x,y), and B(x,y) of each pixel in the three channels (where x and y are the relative coordinates of the pixel within the local face image), the brightness distribution of the local face image can be comprehensively obtained. The dark channel algorithm formula is adopted, and its formula is as follows: , Calculate the dark channel luminance value H(x) for each pixel, where H(x) represents the core luminance information of that pixel. By taking the minimum value of the three-channel luminance, interference from color information can be effectively suppressed, making subsequent calculations based on luminance differences more accurate. Arrange the dark channel luminance values ​​of all pixels in order of their relative coordinates in the local face image to form a two-dimensional dark channel data matrix with the same size as the local face image. This matrix represents the dark channel data of the face bounding box region in that frame. Two sets of dark channel data matrices are generated for each of the two frames and stored together.

[0029] Specifically, obtaining the comparison identification information includes: calculating the center coordinates of the face box based on the second identifier of the face box position information of the consecutive frame images, and calculating the offset of the face box center position between consecutive frames using the Manhattan distance formula; comparing the position offset with the coordinate displacement threshold by a preset coordinate displacement threshold to generate identification information.

[0030] In this embodiment, based on the second identifiers (x1, y1, w1, h1) and (x2, y2, w2, h2) of the face bounding box position information, the center coordinates (cx1, cy1) and (cx2, cy2) of the face bounding boxes in the two frames are calculated respectively. The calculation logic is cx1 = x1 + w1 / 2, cy1 = y1 + h1 / 2, cx2 = x2 + w2 / 2, cy2 = y2 + h2 / 2. The Manhattan distance formula is used, and its formula is: , Calculate the position offset dc of the centers of the face frames in two frames. This value can quantify the degree of change in the face positions in the two frames. The coordinate displacement threshold Th_c is a reasonable range set based on factors such as the acquisition frame rate of the infrared camera and the common face movement speed, and is used to determine whether the change in the face position between frames is within the allowable range. When the offset dc ≤ Th_c, a valid comparison flag is generated, indicating that the change in the face position in the two frames is small and can be used for subsequent depth of field calculation; when dc > Th_c, an invalid comparison flag is generated, indicating that the difference in the face positions in the two frames is too large and does not meet the homology requirement for depth of field calculation, and the data acquisition module needs to be triggered to re-acquire the image.

[0031] Specifically, the binarization operation on the depth of field data includes: based on the identification information and the dark channel data matrix, obtaining the depth of field data by depth of field calculation; By presetting double threshold parameters, traverse and judge the depth of field difference of pixel points to generate a binarization judgment result. Based on the binarization judgment result, integrate the binarization results of pixel points in the original coordinate order to obtain a binarized depth of field image; In this embodiment, only when the identification information is "valid comparison", the depth of field calculation is performed based on the dark channel data matrix of consecutive frames. According to the frame difference formula, the formula is as follows: , Calculate the depth of field difference of each pixel point, where H1 is the brightness value of the i-th pixel point in the dark channel data matrix of the supplementary light frame, and H0 i is the brightness value of the pixel point at the corresponding position in the dark channel data matrix of the non-supplementary light frame. The value of d diff(i) directly reflects the three-dimensional undulation degree of the corresponding position. The double threshold parameters include a low threshold Th_l and a high threshold Th_h, which are reasonable numerical ranges determined through training with a large number of infrared face samples and are used to distinguish effective three-dimensional features, invalid features, and abnormal interference features. The double threshold filtering algorithm is used to perform binarization processing on the depth of field data, and the judgment rule is: when d diff(i) < Th_l, it is determined that there is no effective three-dimensional feature, and the binarization result is set to 0; when Th_l < d diff(i) < Th_h, it is determined that there is an effective three-dimensional feature, and the binarization result is set to 255; when d diff(i) < Th_h, it is determined that there is an abnormal interference feature, and the binarization result is set to 0. Integrate the binarization results of all pixel points in the original coordinate order. In the formed binarized depth of field image, white pixel points (255) constitute the effective three-dimensional feature region, and black pixel points (0) constitute the invalid region, which can clearly highlight the three-dimensional contour features of the face.

[0032] Specifically, the process of obtaining the facial contour includes: performing contour detection on the binarized depth image using a contour extraction algorithm to obtain the contour detection result; performing polygon approximation processing based on the contour detection result to obtain the vertex coordinate sequence, and fitting the curve contour into a polygon contour using the Douglas-Puk algorithm; performing closure verification on the polygon contour to obtain a set of candidate facial contours.

[0033] In this embodiment, a contour extraction algorithm (such as the findContours function in OpenCV) is used to detect contours in the binarized depth image. The contour retrieval mode is set to external contour retrieval, and only the external edge contours of the white pixel region (255) are extracted to obtain a contour detection result containing all edge lines that meet the conditions. Among them, there may be noisy contours that are not human faces. The detected contours are processed by polygon approximation, and the vertex coordinate sequence is extracted. Then, the curve contour is fitted and simplified by Douglas-Puk algorithm. This algorithm can remove redundant vertices while retaining the main features of the contour, thereby reducing the computational complexity of subsequent calculations. The closure of the fitted polygon contours is checked. If there are gaps in the contour, they are closed by completing the shortest path. Finally, a complete and continuous set of candidate face contours is obtained. Each contour corresponds to storing its vertex coordinate sequence and total contour length information.

[0034] Specifically, obtaining the face size range contour set includes: obtaining the bounding rectangle size of the candidate face contour based on the candidate face contour set, comparing the bounding rectangle size using a preset threshold range, and obtaining the face size range contour set.

[0035] In this embodiment, the circumscribed rectangle size refers to the width W and height H of the smallest rectangle that can completely enclose the contour of each candidate face. The calculation logic is W = max_x − min_x, H = max_y − min_y (where max_x and min_x are the maximum and minimum values ​​of the x-coordinate of the contour vertex, and max_y and min_y are the maximum and minimum values ​​of the y-coordinate of the contour vertex). This size can indirectly reflect the actual size of the contour. The preset threshold range of the circumscribed rectangle size of the face contour is determined based on the conventional size range of the human face and the imaging ratio of the infrared camera, and is used to filter out contours that conform to the characteristics of the real face size. By comparing the circumscribed rectangle size of each candidate face contour with this threshold range, non-face contours that are too large or too small are eliminated, and contours with a size within a reasonable range and an H / W ratio that conforms to the preset face ratio range are retained, forming a set of face size range contours.

[0036] Specifically, obtaining the number of polygon vertices includes: based on the face size range contour set and the vertex coordinate sequence, counting the number of vertices corresponding to the contours, performing a reasonableness check on the number of vertices, and obtaining the check result; associating and storing the check result with the number of vertices to obtain a mapping table between contours and the number of vertices.

[0037] In this embodiment, each contour in the face size range contour set corresponds to a vertex coordinate sequence after polygon approximation. The vertex coordinate sequences are counted one by one according to their storage order, and the total number of vertices N corresponding to each contour is calculated. During the counting process, vertices with duplicate coordinates are excluded (if adjacent vertices have completely identical coordinates, they are counted as only one vertex). The calculated vertex count N is validated for reasonableness, and contours with fewer than a preset minimum number of vertices or more than a preset maximum number of vertices are removed. Too few vertices may indicate non-regular face shapes, while too many may indicate noise caused by overfitting. The validated results are associated with and stored with the corresponding vertex count N, forming a mapping table between contours and vertex counts, providing data support for subsequent determination of contour continuity based on vertex count.

[0038] Specifically, obtaining the candidate face depth image includes: extracting the number of vertices of the face size range contour based on the contour-vertex mapping table, and comparing it with the face contour vertex threshold range to obtain the candidate face region; The candidate face region is cropped, and the edges of the fragment are smoothed. The coordinate information of the processed candidate face region image and the binarized depth image are associated and labeled to obtain a standardized candidate face depth image.

[0039] In this embodiment, the face contour vertex threshold range is obtained through training with a large number of real infrared face samples and fake attack samples. The number of vertices within this range corresponds to continuous and complete real face contour features. The number of vertices for each contour is extracted from the mapping table and compared with the threshold range. The region corresponding to the contour whose vertex count falls within the range is the candidate face region. After cropping this region, edge smoothing can eliminate jagged interference from the contour, making the image edges more regular. Associating and annotating the coordinate information of the processed candidate face region image with the original binarized depth image ensures that the position of the candidate face region in the original image is traceable. The resulting standardized candidate face depth image can provide high-quality input data for subsequent edge detection.

[0040] Specifically, obtaining edge gradient information includes: converting the candidate face depth image into a single-channel grayscale image, using the Sobel operator to obtain the edge gradient matrix after parameter fusion, normalizing the edge gradient matrix, mapping the gradient intensity values, and obtaining the gradient image of the edge gradient information.

[0041] In this embodiment, converting the candidate face depth image into a single-channel grayscale image simplifies the image data structure, focuses on brightness information, and provides a simpler input for edge detection. The Sobel operator includes convolution kernels in the X and Y directions, used to detect horizontal and vertical edges of the image, respectively. Gradient data (M) in both directions can be obtained through convolution operations. g x and M g y).

[0042] The operator in the X direction is: , The operator in the Y direction is: , To adapt to the operating requirements of low-performance chips, a simplified gradient calculation formula is adopted: , Pixel-by-pixel operations are performed on the gradient matrices in both directions to obtain the fused edge gradient matrix. The edge gradient matrix is ​​normalized, and the gradient intensity values ​​are mapped to the range of 0-255 to form a gradient image containing complete edge gradient information. The higher the gradient value, the more obvious the facial edge features.

[0043] Specifically, obtaining the processing result includes: dividing the candidate face depth image into regions, setting weight coefficients for the region division result based on the edge gradient matrix, obtaining the gradient integral by summation, and standardizing the gradient integral to obtain the normalized processing result.

[0044] In this embodiment, based on the characteristic that facial information in infrared images is concentrated on the outer side, the depth image of the candidate face is divided into regions: a virtual coordinate system is established with the geometric center of the bounding rectangle of the face contour as the origin, dividing the face region into an outer region (a ring-shaped region near the contour edge) and an inner region (the central region). A first weight coefficient k1 is assigned to the outer region, and a second weight coefficient k2 is assigned to the inner region, where k1 > k2, thereby strengthening the role of outer edge features in recognition. The corresponding weight coefficients are applied to the edge gradient matrix according to the region division results, that is, the gradient value of the outer region is multiplied by k1, and the gradient value of the inner region is multiplied by k2, to obtain a weighted gradient matrix. The summation of all elements of the weighted gradient matrix is ​​calculated to obtain the total gradient integral value S; the total gradient integral value S is substituted into the normalization formula, the formula of which is as follows: , Standardization is performed, where S minS is the preset minimum gradient integral (obtained from statistics of a large number of attack samples). max The final normalized output result S is the preset maximum gradient integral (obtained from a large number of real face samples). norm The value ranges from 0 to 1, which can intuitively quantify the edge feature strength of candidate faces.

[0045] Specifically, the process of obtaining the liveness detection result of the candidate face depth image includes: comparing the normalized result with the liveness detection threshold by setting a liveness determination threshold, generating a recognition result, associating and storing the recognition result with corresponding parameters, and obtaining a standardized recognition result signal.

[0046] In this embodiment, a preset liveness detection threshold T (determined through ROC curve analysis, with a value range of 0-1) is used. This threshold effectively distinguishes the normalized result distribution between genuine liveness detection and spoofing attacks. The normalized result S is then processed... norm Compare with the liveness detection threshold T: If S norm If the value is greater than T, then the candidate face depth image is determined to correspond to a real live subject, a liveness detection result is generated, and the corresponding parameters of this detection are recorded (including the two-frame offset dc, the number of contour vertices N, and the normalized score S). norm ); if S norm If the value is less than or equal to T, it is determined to be an attack (such as a photo attack or a screen attack). A liveness rejection result is generated, and the rejection reason is marked (e.g., insufficient number of contour vertices, low weighted gradient score). The recognition result is associated with key parameters and rejection reasons (if any) and stored. At the same time, a standardized recognition result signal is output to drive the response actions of subsequent terminal devices (e.g., access control unlocking, device startup, or alarm prompt).

[0047] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A liveness detection method based on binocular infrared face detection, characterized in that, include: S1: By linking a preset binocular infrared camera with an LED fill light component, infrared image data of the lighting conditions is obtained; S2: Based on the infrared image data, call the preset face detection algorithm to locate the face box position information in the continuous frame images, and extract the dark channel data of the face box region; calculate the inter-frame face position offset based on the face box position information and the dark channel data, compare the inter-frame face position offset with the preset threshold, and obtain the comparison identification information; Based on the comparison identification information and dark channel data, depth data is calculated, and the depth data is binarized to obtain a binarized depth image. S3: Obtain the face contour based on the binarized depth image, calculate the contour perimeter and compare it with a preset face contour perimeter threshold to obtain a face size range contour set; perform polygon approximation processing on the face size range contour set to obtain the number of polygon vertices, and compare the number of vertices using a preset face contour vertex threshold range to obtain a candidate face depth image. S4: Perform edge detection based on the candidate face depth image to obtain edge gradient information; calculate and normalize the edge gradient information by pre-setting weighted points in the outer region of the face and assigning weight coefficients to obtain the processing result; compare the processing result with a preset liveness threshold to obtain the liveness recognition result of the candidate face depth image.

2. The method according to claim 1, characterized in that, The specific process of locating the position information of the face box in the continuous frame image includes: calling a preset face detection algorithm to scan the acquired continuous frame infrared images one by one, and identifying the regions in the image that conform to the face contour features; Based on the confidence score of the candidate bounding boxes in the face detection algorithm, the candidate regions are screened, and the coordinates are calibrated to obtain the first identifier of the face bounding box position information. The first identifier of the face bounding box position information is then adapted and verified with the image resolution to obtain the second identifier of the face bounding box position information in the consecutive frame images.

3. The method according to claim 1, characterized in that, The specific process of extracting the dark channel data of the region within the face frame includes: based on the second identifier of the face frame position information, cropping the corresponding pixel region within the face frame to obtain a partial face image; reading the pixel brightness values ​​of the R, G, and B channels of the partial face image to obtain the brightness data of the pixel in the three channels; The dark channel luminance value of each pixel is calculated using the dark channel algorithm formula to obtain the luminance characteristics of the image; the dark channel luminance values ​​are then arranged in relative coordinate order to obtain the dark channel data matrix of consecutive frames.

4. The method according to claim 1, characterized in that, The step of obtaining the comparison identification information includes: calculating the center coordinates of the face box based on the second identifier of the face box position information of the consecutive frame images, and calculating the offset of the face box center position between consecutive frames using the Manhattan distance formula; comparing the position offset with the coordinate displacement threshold through a preset coordinate displacement threshold to generate identification information.

5. The method according to claim 1, characterized in that, The binarization operation on the depth data includes: obtaining depth data by using depth calculation based on the identification information and the dark channel data matrix; By using preset dual threshold parameters, the depth difference of pixels is traversed and judged to generate a binarized judgment result. Based on the binarized judgment result, the binarized results of the pixels are integrated in the original coordinate order to obtain a binarized depth image.

6. The method according to claim 1, characterized in that, The specific process of obtaining the face contour includes: using a contour extraction algorithm to perform contour detection on the binarized depth image and obtain the contour detection result; performing polygon approximation processing based on the contour detection result to obtain the vertex coordinate sequence, and fitting the curve contour into a polygon contour using the Douglas-Puk algorithm; performing closure verification on the polygon contour to obtain a set of candidate face contours.

7. The method according to claim 1, characterized in that, The process of obtaining the face size range contour set includes: obtaining the bounding rectangle size of the candidate face contour based on the candidate face contour set, comparing the bounding rectangle size using a preset threshold range, and obtaining the face size range contour set.

8. The method according to claim 1, characterized in that, The process of obtaining the number of polygon vertices includes: based on the face size range contour set and the vertex coordinate sequence, counting the number of vertices corresponding to the contours, performing a reasonableness check on the number of vertices, and obtaining the check result; and storing the check result in association with the number of vertices to obtain a mapping table between contours and the number of vertices.

9. The method according to claim 1, characterized in that, The process of obtaining the candidate face depth image includes: extracting the number of vertices of the face size range contour based on the contour-vertex mapping table, and comparing it with the face contour vertex threshold range to obtain the candidate face region; The candidate face region is cropped, and the edges of the fragment are smoothed. The coordinate information of the processed candidate face region image and the binarized depth image are associated and labeled to obtain a standardized candidate face depth image.

10. The method according to claim 1, characterized in that, The step of obtaining edge gradient information includes: converting the candidate face depth image into a single-channel grayscale image, using the Sobel operator to obtain the edge gradient matrix after parameter fusion, normalizing the edge gradient matrix, mapping the gradient intensity values, and obtaining the gradient image of the edge gradient information.

11. The method according to claim 1, characterized in that, The process of obtaining the processing result includes: dividing the candidate face depth image into regions, setting weight coefficients for the region division result based on the edge gradient matrix, obtaining the gradient integral by summation, and standardizing the gradient integral to obtain the normalized processing result.

12. The method according to claim 1, characterized in that, The process of obtaining the liveness detection result of the candidate face depth image includes: comparing the normalized result with the liveness detection threshold by setting a liveness determination threshold, generating a recognition result, associating and storing the recognition result with corresponding parameters, and obtaining a standardized recognition result signal.