Face recognition method, device, electronic device, chip and storage medium

The iToF camera module obtains the measurement depth at different frequencies, determines whether the face is a real face, solves the problem of face recognition being easily attacked in the existing technology, and improves security.

CN114445902BActive Publication Date: 2025-06-13GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210121056.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-09
Publication Date
2025-06-13
Estimated Expiration
2042-02-09

AI Technical Summary

Technical Problem

The existing two-dimensional image-based face recognition technology is easily attacked by photos, simulated three-dimensional masks, etc., resulting in insufficient security.

Method used

By using the iToF camera module to obtain the measured depth of the face to be tested at different first modulation frequencies, determine whether its material is human skin, and determine whether it is a real face.

Benefits of technology

Improves the security of face recognition and prevents attacks from non-real faces such as photos and simulated stereo masks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445902B_ABST
    Figure CN114445902B_ABST
Patent Text Reader

Abstract

This application is applicable to the field of face recognition technology, and provides a face recognition method, device, electronic device, chip and storage medium. The face recognition method includes: when the face to be measured is the face of a target user, obtaining the measured depths of the face to be measured at N different first modulation frequencies, where the measured depths of the face to be measured at the N different first modulation frequencies are obtained by the iToF camera module taking pictures of the face to be measured at the N different first modulation frequencies respectively, and N is an integer greater than 1; judging whether the face to be measured is a real face according to the measured depths of the face to be measured at the N different first modulation frequencies; if the face to be measured is a real face, determining that the face recognition is successful. Face recognition can be achieved through this application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of face recognition, and particularly relates to a face recognition method, device, electronic device, chip and storage medium. Background Art

[0002] With the development of the mobile Internet, electronic devices such as mobile phones and tablet computers have more and more functions, such as face recognition. Face recognition is a biometric identification technology based on facial feature information of a face, and its application scenarios are relatively extensive, such as face payment, face unlocking and other scenarios. Summary of the Invention

[0003] Embodiments of this application provide a face recognition method, device, electronic device, chip and storage medium to achieve face recognition.

[0004] In a first aspect, embodiments of this application provide a face recognition method, including:

[0005] When the face to be measured is the face of a target user, obtaining the measured depths of the face to be measured at N different first modulation frequencies, where the measured depths of the face to be measured at the N different first modulation frequencies are obtained by the iToF camera module taking pictures of the face to be measured at the N different first modulation frequencies respectively, and N is an integer greater than 1;

[0006] Judging whether the face to be measured is a real face according to the measured depths of the face to be measured at the N different first modulation frequencies;

[0007] If the face to be measured is a real face, determining that face recognition is successful.

[0008] In the embodiments of this application, when the face to be measured is the face of a target user, by obtaining the measured depths of the face to be measured at N different first modulation frequencies, it is possible to judge whether the material of the face to be measured is human skin, so as to judge whether the face to be measured is a real face, and when the face to be measured is a real face, determining that face recognition is successful. This solution can solve attacks on face recognition by means such as photos and simulated three-dimensional masks, thereby improving the security of face recognition.

[0009] In a second aspect, embodiments of this application provide a face recognition device, including:

[0010] A depth acquisition module, configured to obtain the measured depths of the face to be measured at N different first modulation frequencies when the face to be measured is the face of a target user, where the measured depths of the face to be measured at the N different first modulation frequencies are obtained by the iToF camera module taking pictures of the face to be measured at the N different first modulation frequencies respectively, and N is an integer greater than 1;

[0011] A face judgment module, configured to judge whether the face to be measured is a real face according to the measured depths of the face to be measured at the N different first modulation frequencies;

[0012] A face recognition module, configured to determine that the face recognition is successful if the face to be measured is a real face.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and further including an iToF camera module. When the processor executes the computer program, the steps of the face recognition method described in the first aspect above are implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a chip, including a processor, where the processor is configured to read and execute a computer program stored in a memory to execute the steps of the face recognition method described in the first aspect above.

[0015] Optionally, the memory is connected to the processor through a circuit or a wire.

[0016] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the face recognition method described in the first aspect above are implemented.

[0017] In a sixth aspect, an embodiment of the present application provides a computer program product, when the computer program product runs on an electronic device, the electronic device is enabled to execute the steps of the face recognition method described in the first aspect above.

[0018] It can be understood that the second aspect, the third aspect, the fourth aspect, the fifth aspect, and the sixth aspect provided above are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be elaborated here. Description of the Drawings

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0020] Figure 1 It is an example diagram of the iToF camera module arranged on a mobile phone;

[0021] Figure 2 It is a waveform example diagram of the received light and the transmitted light of the iToF camera module;

[0022] Figure 3a It is an example diagram of the RGB photo of the checkerboard;

[0023] Figure 3b It is an example diagram of the result of measuring depth using the iToF camera module;

[0024] Figure 4 It is a schematic diagram of the implementation process of the face recognition method provided by an embodiment of the present application;

[0025] Figure 5 It is a schematic diagram of the implementation process of the face recognition method provided by another embodiment of the present application;

[0026] Figure 6a It is an example diagram of error testing for different materials at 15 MHz;

[0027] Figure 6b It is an example diagram of error testing for different materials at 60 MHz;

[0028] Figure 7 It is a schematic diagram of the structure of the face recognition device provided by an embodiment of the present application;

[0029] Figure 8 It is a schematic diagram of the structure of the electronic device provided by an embodiment of the present application. Detailed implementation manners

[0030] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures, technologies, etc. are presented in order to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to impede the description of the present application with unnecessary details.

[0031] It should be understood that when used in the specification and the appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0032] It should also be understood that the term "and / or" used in the specification and the appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0033] As used in the specification of this application and the appended claims, the term "if" may be construed contextually as "when", "once", "in response to determining", or "in response to detecting". Similarly, the phrase "if determined" or "if [the described condition or event] is detected" may be construed contextually to mean "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]".

[0034] In addition, in the description of the specification of this application and the appended claims, the terms "first", "second", "third", etc. are only used for differential description and cannot be construed as indicating or implying relative importance.

[0035] The reference to "one embodiment" or "some embodiments" etc. described in the specification of this application means that a specific feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprise", "include", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0036] Before describing the solution of this application, for the convenience of readers' understanding, the nouns involved in this solution are first explained.

[0037] Indirect Time of Flight (iToF) indirectly measures the flight time of light by measuring the phase shift.

[0038] The core components of the iToF camera module include a Vertical-Cavity Surface-Emitting Laser (VCSEL) and an image sensor. Among them, the above image sensor may be an iToF chip using continuous wave modulation, including but not limited to models such as IMX516, IMX518, IMX316 of Sony. Of course, the above image sensor may also be an iToF chip using pulse modulation, which is not limited here.

[0039] This application does not limit the position of the iToF camera module on the electronic device. For example, as Figure 1The following is an example diagram of the iToF camera module arranged on a mobile phone. It can be arranged on the front panel of the mobile phone (i.e., the front screen of the mobile phone), which is convenient for users to perform face recognition and realize functions such as fast payment and unlocking based on face recognition.

[0040] The VCSEL emits modulated infrared light of a specific frequency. The image sensor receives the reflected light during the exposure (integration) time and performs photoelectric conversion. After the exposure (integration) ends, the data is read out, passed through an analog-to-digital converter, and then transmitted to the calculation unit. Finally, the calculation unit calculates the phase shift of each pixel. The iToF camera module uses 4 sampling signals with phase delays of 0°, π, to calculate the depth. Among them, the depth in this application is the distance between the iToF camera module and the object being photographed.

[0041] According to different modulation methods, i-ToF can be divided into two types: continuous wave modulation (CW-iToF) and pulse modulation (PL-iToF), which emit continuous sine signals and repetitive pulse signals respectively; CW-iToF analyzes the depth by analyzing the phase of the sine signal, while PL-iToF analyzes the depth by analyzing the phase of the pulse signal.

[0042] Taking CW-iToF as an example to introduce the ranging principle of the iToF camera module, assume that the emitted sine signal (i.e., the emitted light) is:

[0043] A·sin(wt)

[0044] where A is the amplitude and w is the angular frequency.

[0045] The received light (i.e., the received reflected light) can be expressed as:

[0046]

[0047] where A' is the amplitude after reflection attenuation and B is the background light signal.

[0048] As Figure 2 shown, sampling is performed on four points respectively, and the results are as follows:

[0049]

[0050]

[0051]

[0052]

[0053] There are:

[0054]

[0055] Similarly, there is:

[0056]

[0057] Therefore, the phase can be expressed as:

[0058]

[0059] The depth can be expressed as:

[0060]

[0061] Where c is the speed of light, f is the modulation frequency, and the value of the modulation frequency is usually between 10 MHz and 300 MHz.

[0062] From the above derivation process of the phase and depth, it can be seen that the result of CW-iToF ranging is related to the modulation frequency of the received light and the phase.

[0063] In the above CW-iToF ranging principle, the different diffuse reflection characteristics of light by different materials are not considered. In fact, due to the differences in the reflection and absorption of light by the surfaces of different materials, there will be a certain error between the actually measured depth and the true depth, and this error has a certain pattern. Specifically, according to different materials, different modulation frequencies generate different depth errors. That is, d 测量深度 = d 真实深度 + Δd(f), where Δd(f) is the error caused by the absorption and reflection of light by different materials, and it is also a function of the modulation frequency f of the infrared light emitted by iToF.

[0064] Through experiments, it is measured that for different shooting objects, there are often slight deviations between the actual depth measured by the iToF camera module and the true depth. A typical example is to use the iToF camera module to shoot a flat "checkerboard" with black and white colors. Assume that the depth between the "checkerboard" and the iToF camera module is 1m. Actually, for the white part of the checkerboard, the depth measured by the iToF camera module is 1.01m, while for the black part of the checkerboard, the depth measured by the iToF camera module is 0.99m. The reason is that the phases of the infrared light reflected by the materials of the white part and the black part for the iToF camera module are different, and the depth of each pixel is calculated by using the measured phase. From the above analysis, it can be seen that the iToF camera module has the characteristic of obtaining different deviations from the true depth for different materials. Therefore, this characteristic can be used to detect the material information of the shooting object. Since the materials of real human skin, photos, and simulated three-dimensional masks are usually different, the iToF camera module can be used to distinguish them. Among them, the material of a real human face is human skin, the material of a photo is usually non-human skin materials such as photographic paper, and a simulated three-dimensional mask is usually non-human skin materials such as plastic, silicone, and wood.

[0065] As Figure 3a shown is an example diagram of the RGB photo of the checkerboard, Figure 3b shown is an example diagram of the result of measuring the depth by using the iToF camera module. Figure 3b The depth information of the "checkerboard" cardboard for testing is within the dashed box in

[0066] To implement face recognition, an existing solution is based on two-dimensional images. This solution is vulnerable to attacks such as photos and simulated three-dimensional masks. Therefore, for some applications that require face recognition, especially payment-level applications, the face recognition solution based on two-dimensional images cannot be widely applied due to insufficient security. To solve the problem that the face recognition solution based on two-dimensional images is vulnerable to attacks such as photos and simulated three-dimensional masks, considering that there are some differences in the optical properties of real human skin and the materials of photos and simulated three-dimensional masks, this application introduces material recognition technology. Starting from the application side, it relies on the iToF camera module to obtain the depth information of the photographed object, and judges the material characteristics of the photographed object based on the depth information, so as to improve the accuracy and security of face recognition. Among them, the above two-dimensional image refers to a planar image that does not contain depth information, such as Figure 3a the RGB photo of the checkerboard shown is a two-dimensional image.

[0067] The face recognition method provided in the embodiments of this application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The embodiments of this application do not impose any restrictions on the specific types of electronic devices.

[0068] It should be understood that the magnitudes of the sequence numbers of the steps in this embodiment do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of this application.

[0069] To illustrate the technical solutions described in this application, the following will be described through specific embodiments.

[0070] See Figure 4 , which is a schematic diagram of the implementation process of the face recognition method provided in an embodiment of this application. This face recognition method is applied to an electronic device including an iToF camera module, specifically, it can be a processor in the electronic device. As Figure 4 shown, this face recognition method may include the following steps:

[0071] Step 401, when the face to be detected is the face of the target user, obtain the measured depth of the face to be detected at N different first modulation frequencies.

[0072] Among them, the measured depths of the to-be-detected human face at N different first modulation frequencies are obtained by the iToF camera module taking pictures of the to-be-detected human face at N different first modulation frequencies respectively, where N is an integer greater than 1.

[0073] For example, N is 3, and the three different first modulation frequencies are 15 MHz, 30 MHz, and 60 MHz respectively. When the iToF camera module takes a picture of the to-be-detected human face with the modulation frequency of the emitted infrared light being 15 MHz, the measured depth of the to-be-detected human face at 15 MHz can be obtained; when the iToF camera module takes a picture of the to-be-detected human face with the modulation frequency of the emitted infrared light being 30 MHz, the measured depth of the to-be-detected human face at 30 MHz can be obtained; when the iToF camera module takes a picture of the to-be-detected human face with the modulation frequency of the emitted infrared light being 60 MHz, the measured depth of the to-be-detected human face at 60 MHz can be obtained.

[0074] In some application scenarios, when performing face recognition on the to-be-detected human face, it is usually used to perform target operations such as payment and unlocking. Therefore, the above-mentioned target user can be understood as a user with the permission to perform the above-mentioned target operations. The number of target users can be one or at least two, which is not limited here.

[0075] The face image of the target user can be pre-stored in the electronic device. If the face image of the to-be-detected human face matches the face image of the target user successfully, it is determined that the to-be-detected human face is the face of the target user. However, this face may be a real face, or it may be a photo of the face of the target user, a simulation three-dimensional mask of the target user, etc. Therefore, in order to improve the accuracy of face recognition, it can be further determined whether the face of the target user is a real face through subsequent steps; if the face image of the to-be-detected human face does not match the face image of the target user, it is determined that the to-be-detected human face is not the face of the target user, and the face recognition fails, and target operations such as payment and unlocking cannot be performed. Among them, the number of pre-stored face images of the target user can be one, or at least two, which is not limited here.

[0076] Step 402: Determine whether the to-be-detected human face is a real face according to the measured depths of the to-be-detected human face at N different first modulation frequencies.

[0077] For shooting objects of different materials, when using the iToF camera module for shooting, the difference in materials affects the depth actually measured by the iToF camera module (i.e., the measured depth). Therefore, according to the measured depths of the to-be-detected human face at N different first modulation frequencies, it can be determined whether the material of the to-be-detected human face is the material of a real face. When the material of the to-be-detected human face is the material of a real face, it is determined that the to-be-detected human face is a real face. When the material of the to-be-detected human face is not the material of a real face, it is determined that the to-be-detected human face is not a real face, so as to realize the judgment of the authenticity of the to-be-detected human face.

[0078] Step 403, if the face to be tested is a real face, it is determined that the face recognition is successful.

[0079] When the face recognition is successful, the electronic device can perform target operations such as payment and unlocking, improving the security of target operations such as payment and unlocking.

[0080] In some application scenarios, when a user performs a payment operation through a mobile phone, the face payment function can be activated. After activating the face payment function, usually the user's face is photographed, and face recognition is performed based on the photographed two-dimensional image. When the face image in the two-dimensional image matches the pre-stored face image successfully, the payment operation can be performed. However, this solution is vulnerable to attacks by means such as photos and simulated three-dimensional masks, reducing the security of payment. Based on this, in this application, by further judging the authenticity of the user's face and performing the payment operation only when the user's face is a real face, the security of payment can be improved, and the problem that the face recognition solution based on two-dimensional images is vulnerable to attacks by means such as photos and simulated three-dimensional masks can be solved.

[0081] In some embodiments, if the face to be tested is not a real face, a prompt (such as a voice prompt or a text prompt, etc.) can be issued to prompt the user to re-take a face photo. When the number of re-identifications exceeds the preset number of times, the user can be restricted from activating the face payment function within a subsequent preset duration (such as 5 minutes), and / or a prompt message can be sent to a pre-set contact, and the prompt message can include the location information of the electronic device, so as to improve the security of the data in the electronic device and reduce the risk of the electronic device being illegally used by others.

[0082] In the embodiment of this application, when the face to be tested is the face of the target user, by obtaining the measured depths of the face to be tested at N different first modulation frequencies, it can be judged whether the material of the face to be tested is human skin, so as to judge whether the face to be tested is a real face. When the face to be tested is a real face, it is determined that the face recognition is successful. This solution can solve the attacks on face recognition by means such as photos and simulated three-dimensional masks, thereby improving the security of face recognition.

[0083] See Figure 5 , which is a schematic flowchart of the implementation of a face recognition method provided by another embodiment of this application. This face recognition method is applied to an electronic device including an iToF camera module, specifically a processor in the electronic device. As Figure 5 shown, this face recognition method may include the following steps:

[0084] Step 501, when the face to be tested is the face of the target user, obtain the measured depths of the face to be tested at N different first modulation frequencies.

[0085] This step is the same as step 401. For specific details, please refer to the relevant description of step 401 and will not be elaborated here.

[0086] In an optional embodiment, the solution for determining whether the face to be detected is the face of the target user is as follows:

[0087] Obtain the grayscale image of the face to be detected captured by the iToF camera module at the first first modulation frequency. The first first modulation frequency is the modulation frequency that the iToF camera module first adopts among N different first modulation frequencies;

[0088] Match the face image of the face to be detected in the grayscale image with the preset face image;

[0089] If the face image in the grayscale image matches the preset face image successfully, determine that the face to be detected is the face of the target user;

[0090] If the face image in the grayscale image fails to match the preset face image, determine that the face to be detected is not the face of the target user.

[0091] Exemplarily, N is 3. The three different first modulation frequencies are 15 MHz, 30 MHz, and 60 MHz respectively. The iToF camera module first captures the face to be detected at the modulation frequency of 15 MHz, then captures the face to be detected at the modulation frequency of 30 MHz, and finally captures the face to be detected at the modulation frequency of 60 MHz. It can be seen that the order in which the above three different first modulation frequencies are adopted by the iToF camera module is 15 MHz, 30 MHz, and 60 MHz in sequence. Then it can be determined that 15 MHz is the first first modulation frequency among the above three different first modulation frequencies.

[0092] When the iToF camera module captures the face to be detected at each first modulation frequency, it outputs a grayscale image and a depth image corresponding one-to-one to the pixels in the grayscale image. When the iToF camera module captures the face to be detected at the first first modulation frequency, it can first send the grayscale image of the face to be detected captured at the first first modulation frequency to the processor. The processor performs face detection on the above grayscale image. When a face area is detected in the grayscale image, the image of the face area (i.e., the face image in the grayscale image) is matched with the preset face image.

[0093] It should be noted that the present application does not limit the matching algorithm between the face image in the grayscale image and the preset face image. For example, the matching between the two can be achieved by calculating the similarity between the face image in the grayscale image and the preset face image. Specifically, if the similarity between the face image in the grayscale image and the preset face image exceeds the similarity threshold, it is determined that the face image in the grayscale image matches the preset face image successfully; if the similarity between the face image in the grayscale image and the preset face image does not exceed the similarity threshold, it is determined that the face image in the grayscale image fails to match the preset face image.

[0094] In an optional embodiment, when the face to be measured is the face of the target user, obtaining the measured depths of the face to be measured at N different first modulation frequencies includes:

[0095] When the face to be measured is the face of the target user, obtaining the measured depth of the face to be measured at the first first modulation frequency, where the first first modulation frequency is the modulation frequency first adopted by the iToF camera module among the N different first modulation frequencies;

[0096] According to the measured depth of the face to be measured at the first first modulation frequency, determining whether the face to be measured is a three-dimensional face;

[0097] If the face to be measured is a three-dimensional face, obtaining the measured depths of the face to be measured at the remaining N - 1 first modulation frequencies, where the remaining N - 1 first modulation frequencies refer to the modulation frequencies among the N different first modulation frequencies except the first first modulation frequency.

[0098] The measured depth of the face to be measured at each first modulation frequency may refer to the measured depth of the pixels in the corresponding grayscale image of the face to be measured.

[0099] For example, the measured depth of the face to be measured at the first first modulation frequency refers to the measured depth of the pixels in the grayscale image captured of the face to be measured at the first first modulation frequency.

[0100] A photo is a planar image that does not contain depth information. If the face to be measured is the face in a photo, then the measured depths of all pixels of the face to be measured at the first first modulation frequency are the same, while for a three-dimensional face (such as a real face), there are pixels with different measured depths in the corresponding grayscale image (for example, the distance between the corners of the eyes of a three-dimensional face and the iToF camera module is farther than the distance between the tip of the nose and the iToF camera module, so the measured depth of the corners of the eyes in the corresponding grayscale image of the three-dimensional face is greater than the measured depth of the tip of the nose in the corresponding grayscale image). Therefore, it is determined whether the face to be measured is a three-dimensional face according to the measured depth of the face to be measured at the first first modulation frequency.

[0101] If the face to be measured is not a three-dimensional face, it is determined that face recognition fails, and there is no need to obtain the measured depth of the face to be measured at the remaining N-1 first modulation frequencies.

[0102] In this embodiment, before determining whether the face to be measured is a real face, it is first determined whether the face to be measured is a three-dimensional face, which can filter out plane images such as photos containing the face to be measured, reduce the calculation amount in the real face judgment, and improve the judgment efficiency of the real face.

[0103] In an optional embodiment, if the face to be measured is a three-dimensional face, obtaining the measured depth of the face to be measured at the remaining N-1 first modulation frequencies includes:

[0104] If the face to be measured is a three-dimensional face, a frequency switching instruction is sent to the iToF camera module, and the frequency switching instruction is used to instruct the iToF camera module to capture the face to be measured at the remaining N-1 first modulation frequencies;

[0105] Obtain the measured depth of the face to be measured at the remaining N-1 first modulation frequencies.

[0106] When the processor determines that the face to be measured is a three-dimensional face, it can send a frequency switching instruction to the iToF camera module. After receiving the above frequency switching instruction, the iToF camera module can sequentially switch the iToF camera module from the first first modulation frequency to the remaining N-1 first modulation frequencies.

[0107] In an optional embodiment, according to the measured depth of the face to be measured at the first first modulation frequency, determining whether the face to be measured is a three-dimensional face includes:

[0108] According to the measured depths of at least two preset key points in the face to be measured at the first first modulation frequency, determine whether the face to be measured is a three-dimensional face.

[0109] Among them, the preset key points can be key points that are preset and can reflect the three-dimensional face features, such as face key points like the corners of the eyes, forehead, tip of the nose, eyes, etc. Each preset key point may correspond to multiple pixels in the grayscale image. The average value of the measured depths of multiple pixels or the average value of the measured depths of at least two of the multiple pixels can be used as the measured depth of the corresponding preset key point, or the measured depth of any one of the multiple pixels can be used as the measured depth of the corresponding preset key point, which is not limited here.

[0110] Judging whether the face to be measured is a three-dimensional face according to the measured depths of at least two preset key points can reduce the calculation amount in the three-dimensional face judgment and improve the judgment efficiency of the three-dimensional face.

[0111] When determining whether a face to be measured is a three-dimensional face based on the measurement depths at the first first modulation frequency for at least two preset key points, the present application does not limit its specific determination algorithm. For example, it is determined whether the measurement depths of at least two preset key points at the first first modulation frequency are all unequal. If they are all unequal, it is determined that the face to be measured is a three-dimensional face. If there are preset key points with the same measurement depth among at least two preset key points, it is determined that the face to be measured is not a three-dimensional face.

[0112] Step 502: Calculate the depth errors between the measurement depths of the face to be measured at N-1 measurement frequencies and the measurement depth of the face to be measured at the reference frequency, obtaining N-1 first depth errors.

[0113] Among them, the depth error (i.e., the first depth error) between the measurement depth of the face to be measured at the measurement frequency and the measurement depth of the face to be measured at the reference frequency may refer to the difference obtained by subtracting the measurement depth of the face to be measured at the reference frequency from the measurement depth of the face to be measured at the measurement frequency.

[0114] Exemplarily, N is 3, and the three different modulation frequencies are 15 MHz, 30 MHz, and 60 MHz. 30 MHz is selected as the reference frequency. Then 15 MHz and 60 MHz are the measurement frequencies. Calculate the depth error between the measurement depth of the face to be measured at the first modulation frequency of 15 MHz and the measurement depth at the first modulation frequency of 30 MHz (obtaining one depth error), and the depth error between the measurement depth of the face to be measured at the first modulation frequency of 60 MHz and the measurement depth at the first modulation frequency of 30 MHz (obtaining one depth error), for a total of two depth errors.

[0115] For the i-th measurement frequency among the N-1 measurement frequencies, where the i-th measurement frequency is any one of the N-1 measurement frequencies, and i is an integer greater than zero and less than or equal to N-1. When calculating the depth error between the measurement depth of the face to be measured at the i-th measurement frequency and the measurement depth of the face to be measured at the reference frequency, the average value of the measurement depths of all pixels or some pixels (such as the pixels of the nose tip) in the grayscale image of the face to be measured at the i-th measurement frequency (i.e., the first average value) and the average value of the measurement depths of all pixels or the corresponding some pixels (such as the pixels of the nose tip) in the grayscale image of the face to be measured at the reference frequency (i.e., the second average value) can be calculated first, and then the difference obtained by subtracting the second average value from the first average value is used as the depth error between the measurement depth of the face to be measured at the i-th measurement frequency and the measurement depth of the face to be measured at the reference frequency.

[0116] Step 503: Match the N-1 first depth errors with the corresponding target errors respectively.

[0117] Wherein, the target error is the depth error between the measured depth of the real face at the corresponding measurement frequency and the target depth, and the target depth is the distance between the real face and the iToF camera module, and the target depth is equal to the measured depth of the face to be measured at the reference frequency.

[0118] For example, when the measurement frequency is 15 MHz and the reference frequency is 30 MHz, the measured depth of the face to be measured at 15 MHz is 408 mm, the measured depth of the face to be measured at 30 MHz is 400 mm, the pre-set depth error between the measured depth of the real face at 15 MHz and 400 mm is 8 mm, and the depth error between the measured depth of the face to be measured at 15 MHz and the measured depth of the face to be measured at 30 MHz calculated through step 502 is 7.95 mm. The 7.95 mm calculated through step 502 can be matched with the pre-set 8 mm.

[0119] It should be noted that the present application does not limit the matching algorithm for the N-1 first depth errors and the corresponding target errors. For example, the matching can be achieved by separately calculating the absolute values of the differences between the N-1 first depth errors and the corresponding target errors. Taking the i-th measurement frequency as an example, calculate the absolute value of the difference between the first depth error corresponding to the i-th measurement frequency and the target error corresponding to the i-th measurement frequency (i.e., the pre-set depth error between the measured depth of the real face at the i-th measurement frequency and the target depth). If the absolute value of the difference exceeds the difference threshold, it is determined that the first depth error corresponding to the i-th measurement frequency and the target error corresponding to the i-th measurement frequency do not match. If the absolute value of the difference does not exceed the difference threshold, it is determined that the first depth error corresponding to the i-th measurement frequency and the target error corresponding to the i-th measurement frequency match. Wherein, the first depth error corresponding to the i-th measurement frequency refers to the depth error between the measured depth of the face to be measured at the i-th measurement frequency and the measured depth of the face to be measured at the reference frequency. The target error corresponding to the i-th measurement frequency refers to the depth error between the pre-set measured depth of the real face at the i-th measurement frequency and the target depth.

[0120] The target errors corresponding to the N-1 measurement frequencies can be pre-stored in the database of the electronic device, so that when the electronic device judges the real face of the face to be measured, it can quickly retrieve the target errors corresponding to the N-1 measurement frequencies, improving the judgment speed of the real face.

[0121] In an optional embodiment, the target errors corresponding to the N-1 measurement frequencies can be obtained by pre-testing the errors of the real face. Specifically:

[0122] At L reference depths, the measured depths of the real face at M second modulation frequencies are obtained respectively. The reference depth is the distance between the real face and the iToF camera module. The M second modulation frequencies include at least N - 1 measurement frequencies, and the L reference depths include at least the target depth. M is an integer greater than or equal to N - 1, and L is an integer greater than zero;

[0123] For the j-th reference depth, where the j-th reference depth is any one of the L reference depths, calculate the depth error between the measured depths of the real face at M second modulation frequencies obtained at the j-th reference depth and the j-th reference depth, and obtain M second depth errors corresponding to the j-th reference depth;

[0124] Store the M second depth errors corresponding to each of the L reference depths.

[0125] Taking the j-th reference depth as an example, when the distance between the real face and the iToF camera module is the j-th reference depth, control the iToF camera module to capture the real face at M second modulation frequencies, and the measured depths of the real face at M second modulation frequencies at the j-th reference depth can be obtained.

[0126] Based on the calculation method of the M second depth errors corresponding to the j-th reference depth, by traversing the L reference depths, M second depth errors corresponding to each of the L reference depths can be obtained. Storing the M second depth errors corresponding to each of the L reference depths can facilitate the electronic device to quickly retrieve the target errors corresponding to N - 1 measurement frequencies from the stored second depth errors when judging the real face of the face to be measured, and improve the judgment speed of the real face.

[0127] In the actual application of face recognition, the electronic device can search for the M second depth errors corresponding to the target depth from the M second depth errors corresponding to each of the L reference depths stored; from the M second depth errors corresponding to the target depth, search for the target errors corresponding to N - 1 first depth errors respectively.

[0128] The M second depth errors corresponding to the target depth are the depth errors between the measured depths of the real face at M second modulation frequencies obtained at the target depth and the target depth. Therefore, each second depth error has a corresponding second modulation frequency. The second depth error with the second modulation frequency equal to the measurement frequency corresponding to the N - 1 first depth errors can be searched from the M second depth errors corresponding to the target depth, and this second depth error is the target error.

[0129] For example, taking the i-th first depth error as an example, the i-th first depth error is the first depth error corresponding to the i-th measurement frequency. The second depth error with the second modulation frequency equal to the i-th measurement frequency can be found from the M second depth errors corresponding to the target depth. The second depth error with the second modulation frequency equal to the i-th measurement frequency is the target error corresponding to the i-th first depth error.

[0130] Step 504, if all of the N - 1 first depth errors are successfully matched, then determine that the face to be measured is a real face.

[0131] If all of the N - 1 first depth errors are successfully matched, then it can be determined that the material of the face to be measured is the material of a real face, and thus it can be determined that the face to be measured is a real face.

[0132] Step 505, if there is a depth error that fails to match among the N - 1 first depth errors, then determine that the face to be measured is not a real face.

[0133] If there is a depth error that fails to match among the N - 1 first depth errors, then it can be determined that the material of the face to be measured is not the material of a real face, and it may be the material of a photo or a simulated three-dimensional mask. Thus, it can be determined that the face to be measured is not a real face.

[0134] Step 506, if the face to be measured is a real face, then determine that face recognition is successful.

[0135] This step is the same as step 403. For specific details, please refer to the relevant description of step 403 and will not be elaborated here.

[0136] As an optional embodiment, if the face to be measured is a real face, then determining that face recognition is successful includes:

[0137] If the face to be measured is a real face, then determine whether the face to be measured is a three-dimensional face;

[0138] If the face to be measured is a three-dimensional face, then determine that face recognition is successful.

[0139] The step of determining whether the face to be measured is a three-dimensional face can be executed before the step of obtaining the measured depths of the face to be measured at the remaining N - 1 first modulation frequencies, or can be executed after determining that the face to be measured is a real face, and is not limited herein.

[0140] In the case where the face to be measured is the face of the target user, by calculating the depth errors between the measured depths of the face to be measured at N-1 measurement frequencies and the measured depth of the face to be measured at the reference frequency, it is possible to determine whether the material of the face to be measured is human skin, thereby determining whether the face to be measured is a real face. When the face to be measured is a real face, it is determined that the face recognition is successful. This solution can solve the attacks on face recognition by means such as photos and simulated three-dimensional masks, thereby improving the security of face recognition.

[0141] Starting from the application of the electronic device, this application realizes face recognition, and the face recognition technology can be easily integrated into the existing electronic device, with low cost and high practicability.

[0142] In addition, for an electronic device integrated with an iToF camera module, without increasing additional hardware costs, it is possible to judge the material of the face to be measured on the basis of not changing the hardware configuration of the existing iToF camera module, thereby improving the security of three-dimensional face recognition.

[0143] In an application scenario of face recognition, the distance range between the face and the iToF camera module is usually 300mm to 800mm. In order to more intuitively reflect that the solution of this application can more accurately distinguish human skin (such as the material of a real face) from other materials (such as plastic, silicone, wood, etc.), error tests can be carried out on various materials such as human skin, photos, silicone masks, and white walls within the above distance range. As Figure 6a shown is an example diagram of error testing different materials at 15MHz, and as Figure 6b shown is an example diagram of error testing different materials at 60MHz. From Figure 6a and Figure 6b it can be seen that at the same real depth and the same modulation frequency, the depth errors corresponding to different materials are different (for example, when the real depth is 400mm and the modulation frequency is 15MHz, the depth error corresponding to human skin is about 8mm, the depth error corresponding to a photo is about 16mm, the depth error corresponding to a silicone mask is about 2mm, and the depth error corresponding to a white wall is about -11.5mm). Therefore, different materials can be distinguished according to the depth error, and thus it is possible to more accurately judge whether the face to be measured is a real face in the face recognition scenario, improving the accuracy of face recognition. From Figure 6a and Figure 6bIt can be seen that at the same true depth and different modulation frequencies, the error depth corresponding to the same material is also different (for example, when the true depth is 400mm and the modulation frequency is 15MHz, the depth error corresponding to human skin is about 8mm; when the true depth is 400mm and the modulation frequency is 60MHz, the depth error corresponding to human skin is about 20mm). Therefore, the accuracy of face recognition can be further improved by performing multiple error tests at different modulation frequencies. Among them, the true depth is the distance between the photographed object and the iToF camera module. Figure 6a and Figure 6b The human skin, photos, silicone masks and white walls are all photographed objects. Figure 6a The depth error in is the difference between the measured depth and the true depth of subjects such as human skin, photos, silicone masks and white walls at 15MHz. Figure 6b The depth error in is the difference between the measured depth at 60MHz and the true depth of objects such as human skin, photos, silicone masks and white walls.

[0144] It should be noted that the present application pre-stores the depth error of human skin and matches the pre-stored depth error of human skin with the depth error of the face to be tested actually measured, thereby realizing recognition of human skin, thereby judging whether the face to be tested is a real face. Therefore, the present application can also pre-store the depth error of different materials, and match the pre-stored depth error of different materials with the depth error of the actually measured subject, thereby realizing recognition of the material of the subject, for example, identifying whether the material of the subject is plastic, silicone, wood, etc.

[0145] See also Figure 7 , is a structural diagram of a face recognition device provided in an embodiment of the present application. For the sake of convenience of explanation, only the parts related to the embodiment of the present application are shown.

[0146] The above-mentioned face recognition device comprises:

[0147] A depth acquisition module 71 is used to obtain the measured depths of the face to be tested at N different first modulation frequencies when the face to be tested is the face of the target user, where the measured depths of the face to be tested at the N different first modulation frequencies are obtained by photographing the face to be tested by the iToF camera module at the N different first modulation frequencies, respectively, where N is an integer greater than 1;

[0148] A face judgment module 72, configured to judge whether the face to be tested is a real face according to the measured depths of the face to be tested at the N different first modulation frequencies;

[0149] A face recognition module 73, which is used to determine that the face recognition is successful if the face to be measured is a real face.

[0150] Optionally, the N different first modulation frequencies include a reference frequency and N - 1 measurement frequencies; specifically, the face judgment module 72 is configured to:

[0151] Calculate the depth errors between the measured depths of the face to be measured at the N - 1 measurement frequencies and the measured depth of the face to be measured at the reference frequency, respectively, to obtain N - 1 first depth errors;

[0152] Match the N - 1 first depth errors with the corresponding target errors respectively, where the target error is the depth error between the measured depth of the real face at the corresponding measurement frequency and the target depth, the target depth is the distance between the real face and the iToF camera module, and the target depth is equal to the measured depth of the face to be measured at the reference frequency;

[0153] If all the N - 1 first depth errors are successfully matched, determine that the face to be measured is the real face;

[0154] If there is a depth error that fails to match among the N - 1 first depth errors, determine that the face to be measured is not the real face.

[0155] Optionally, the above face recognition device further includes:

[0156] A reference acquisition module, which is used to respectively acquire the measured depths of the real face at M second modulation frequencies at L reference depths, where the reference depth is the distance between the real face and the iToF camera module, the M second modulation frequencies at least include the N - 1 measurement frequencies, the L reference depths at least include the target depth, M is an integer greater than or equal to N - 1, and L is an integer greater than zero;

[0157] An error calculation module, which is used to calculate, for the jth reference depth, where the jth reference depth is any one of the L reference depths, the depth errors between the measured depths of the real face at the M second modulation frequencies acquired at the jth reference depth and the jth reference depth, to obtain M second depth errors corresponding to the jth reference depth;

[0158] An error storage module, which is used to store the M second depth errors respectively corresponding to the L reference depths;

[0159] A first search module, which is used to search for the M second depth errors corresponding to the target depth from the M second depth errors respectively corresponding to the L reference depths stored;

[0160] A second search module, configured to search for the target error corresponding to each of the N-1 first depth errors from the M second depth errors corresponding to the target depth.

[0161] Optionally, the above-mentioned face recognition device further includes:

[0162] A grayscale image acquisition module, configured to acquire a grayscale image of the face to be measured captured by the iToF camera module at the first first modulation frequency, where the first first modulation frequency is the modulation frequency first adopted by the iToF camera module among the N different first modulation frequencies;

[0163] An image matching module, configured to match the face image of the face to be measured in the grayscale image with a preset face image;

[0164] A first determination module, configured to determine that the face to be measured is the face of the target user if the face image in the grayscale image matches the preset face image successfully;

[0165] A second determination module, configured to determine that the face to be measured is not the face of the target user if the face image in the grayscale image does not match the preset face image successfully.

[0166] Optionally, the above-mentioned depth acquisition module 71 includes:

[0167] A first acquisition unit, configured to acquire the measured depth of the face to be measured at the first first modulation frequency when the face to be measured is the face of the target user, where the first first modulation frequency is the modulation frequency first adopted by the iToF camera module among the N different first modulation frequencies;

[0168] A judgment unit, configured to judge whether the face to be measured is a three-dimensional face according to the measured depth of the face to be measured at the first first modulation frequency;

[0169] A second acquisition unit, configured to acquire the measured depths of the face to be measured at the remaining N-1 first modulation frequencies if the face to be measured is the three-dimensional face, where the remaining N-1 first modulation frequencies refer to the modulation frequencies other than the first first modulation frequency among the N different first modulation frequencies.

[0170] Optionally, the above-mentioned second acquisition unit is specifically configured to:

[0171] If the face to be measured is the three-dimensional face, send a frequency switching instruction to the iToF camera module, where the frequency switching instruction is used to instruct the iToF camera module to capture the face to be measured at the remaining N-1 first modulation frequencies;

[0172] Obtain the measured depth of the face to be measured at the remaining N - 1 first modulation frequencies.

[0173] Optionally, the above - mentioned judgment unit is specifically configured to:

[0174] Judge whether the face to be measured is a three - dimensional face according to the measured depths of at least two preset key points in the face to be measured at the first first modulation frequency.

[0175] Optionally, the above - mentioned face recognition module 73 is specifically configured to:

[0176] If the face to be measured is a real face, judge whether the face to be measured is a three - dimensional face;

[0177] If the face to be measured is the three - dimensional face, determine that the face recognition is successful.

[0178] The face recognition device provided by the embodiments of the present application can be applied to the foregoing method embodiments. For details, refer to the description of the foregoing method embodiments and will not be elaborated here.

[0179] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 8 shown, the electronic device 8 of this embodiment includes: one or more processors 80 (only one is shown in the figure), a memory 81, a computer program 82 stored in the memory 81 and executable on the at least one processor 80, and an iToF camera module 83. When the processor 80 executes the computer program 82, the steps in the foregoing face recognition method embodiments are implemented.

[0180] The electronic device may include, but is not limited to, the processor 80 and the memory 81. Those skilled in the art can understand that Figure 8 this is only an example of the electronic device 8 and does not constitute a limitation on the electronic device 8. It may include more or fewer components than shown in the figure, or combine some components, or different components. For example, the electronic device may further include input - output devices, network access devices, buses, etc.

[0181] The so-called processor 80 may be a Central Processing Unit (CPU), and the processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0182] The memory 81 may be an internal storage unit of the electronic device 8, such as the hard disk or memory of the electronic device 8. The memory 81 may also be an external storage device of the electronic device 8, such as a plug-in hard disk equipped on the electronic device 8, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory 81 may also include both the internal storage unit and the external storage device of the electronic device 8. The memory 81 is used to store the computer program and other programs and data required by the electronic device. The memory 81 may also be used to temporarily store data that has been output or is to be output.

[0183] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above-mentioned functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the foregoing method embodiment and will not be elaborated here.

[0184] The embodiment of this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.

[0185] The embodiments of the present application also provide a computer program product. When the computer program product runs on an electronic device, it enables the electronic device to execute and implement the steps in the above-mentioned method embodiments.

[0186] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0187] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this document can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0188] In the embodiments provided in the present application, it should be understood that the disclosed device / electronic device and method can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0189] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0190] When the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of the present application, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice within the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0191] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A face recognition method, characterized in that, it includes: When the face to be measured is the face of the target user, obtaining the measured depths of the face to be measured at N different first modulation frequencies, where the measured depths of the face to be measured at the N different first modulation frequencies are obtained by the iToF camera module taking pictures of the face to be measured at the N different first modulation frequencies respectively, and N is an integer greater than 1; Judging whether the face to be measured is a real face according to the measured depths of the face to be measured at the N different first modulation frequencies; If the face to be measured is a real face, it is determined that the face recognition is successful; The N different first modulation frequencies include a reference frequency and N - 1 measurement frequencies; the judging whether the face to be measured is a real face according to the measured depths of the face to be measured at the N different first modulation frequencies includes: Calculating the depth errors between the measured depths of the face to be measured at the N - 1 measurement frequencies and the measured depth of the face to be measured at the reference frequency respectively, to obtain N - 1 first depth errors; Matching the N - 1 first depth errors with the corresponding target errors respectively, where the target error is the depth error between the measured depth of the real face at the corresponding measurement frequency and the target depth, the target depth is the distance between the real face and the iToF camera module, and the target depth is equal to the measured depth of the face to be measured at the reference frequency; If all the N - 1 first depth errors are successfully matched, it is determined that the face to be measured is the real face; If there is a depth error that fails to match among the N - 1 first depth errors, it is determined that the face to be measured is not the real face.

2. The face recognition method according to claim 1, characterized in that, Before obtaining the measured depths of the face to be measured at N different first modulation frequencies, it further includes: At L reference depths, respectively obtaining the measured depths of the real face at M second modulation frequencies, where the reference depth is the distance between the real face and the iToF camera module, the M second modulation frequencies at least include the N - 1 measurement frequencies, the L reference depths at least include the target depth, M is an integer greater than or equal to N - 1, and L is an integer greater than zero; For the jth reference depth, where the jth reference depth is any one of the L reference depths, calculating the depth errors between the measured depths of the real face at the M second modulation frequencies obtained at the jth reference depth and the jth reference depth, to obtain M second depth errors corresponding to the jth reference depth; Storing the M second depth errors corresponding to each of the L reference depths; Correspondingly, before matching the N - 1 first depth errors with the corresponding target errors respectively, it further includes: Searching for the M second depth errors corresponding to the target depth from the M second depth errors corresponding to each of the L reference depths stored. From the M second depth errors corresponding to the target depth, find the target errors corresponding to each of the N-1 first depth errors.

3. The face recognition method according to claim 1, wherein, further comprising: obtaining a grayscale image of the face to be measured captured by the iToF camera module at the first first modulation frequency, where the first first modulation frequency is the modulation frequency first adopted by the iToF camera module among the N different first modulation frequencies; matching the face image of the face to be measured in the grayscale image with a preset face image; if the face image in the grayscale image matches the preset face image successfully, determining that the face to be measured is the face of the target user; if the face image in the grayscale image does not match the preset face image, determining that the face to be measured is not the face of the target user.

4. The face recognition method according to any one of claims 1 to 3, wherein, in the case where the face to be measured is the face of the target user, obtaining the measurement depths of the face to be measured at N different first modulation frequencies includes: in the case where the face to be measured is the face of the target user, obtaining the measurement depth of the face to be measured at the first first modulation frequency, where the first first modulation frequency is the modulation frequency first adopted by the iToF camera module among the N different first modulation frequencies; judging whether the face to be measured is a three-dimensional face according to the measurement depth of the face to be measured at the first first modulation frequency; if the face to be measured is the three-dimensional face, obtaining the measurement depths of the face to be measured at the remaining N-1 first modulation frequencies, where the remaining N-1 first modulation frequencies refer to the modulation frequencies other than the first first modulation frequency among the N different first modulation frequencies.

5. The face recognition method according to claim 4, wherein, the step of if the face to be measured is the three-dimensional face, obtaining the measurement depths of the face to be measured at the remaining N-1 first modulation frequencies includes: if the face to be measured is the three-dimensional face, sending a frequency switching instruction to the iToF camera module, where the frequency switching instruction is used to instruct the iToF camera module to capture the face to be measured at the remaining N-1 first modulation frequencies; obtaining the measurement depths of the face to be measured at the remaining N-1 first modulation frequencies.

6. The face recognition method according to claim 4, wherein, the step of judging whether the face to be measured is a three-dimensional face according to the measurement depth of the face to be measured at the first first modulation frequency includes: judging whether the face to be measured is a three-dimensional face according to the measurement depths of at least two preset key points in the face to be measured at the first first modulation frequency.

7. The face recognition method according to any one of claims 1 to 3, wherein, if the face to be measured is a real face, determining that face recognition is successful includes: if the face to be measured is a real face, judging whether the face to be measured is a three-dimensional face; If the face to be detected is the three-dimensional face, it is determined that the face recognition is successful.

8. A face recognition device, characterized in that it includes: A depth acquisition module, configured to acquire the measured depths of the face to be detected at N different first modulation frequencies when the face to be detected is the face of a target user. The measured depths of the face to be detected at the N different first modulation frequencies are obtained by the iToF camera module taking pictures of the face to be detected at the N different first modulation frequencies respectively, and N is an integer greater than 1; A face judgment module, configured to judge whether the face to be detected is a real face according to the measured depths of the face to be detected at the N different first modulation frequencies; A face recognition module, configured to determine that the face recognition is successful if the face to be detected is a real face; The N different first modulation frequencies include a reference frequency and N-1 measurement frequencies; specifically, the face judgment module is configured to: Calculate the depth errors between the measured depths of the face to be detected at the N-1 measurement frequencies and the measured depth of the face to be detected at the reference frequency respectively, to obtain N-1 first depth errors; Match the N-1 first depth errors with the corresponding target errors respectively. The target error is the depth error between the measured depth of the real face at the corresponding measurement frequency and the target depth. The target depth is the distance between the real face and the iToF camera module, and the target depth is equal to the measured depth of the face to be detected at the reference frequency; If the N-1 first depth errors all match successfully, it is determined that the face to be detected is the real face; If there is a depth error that fails to match among the N-1 first depth errors, it is determined that the face to be detected is not the real face.

9. An electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that it further includes an iToF camera module, and when the processor executes the computer program, it implements the steps of the face recognition method according to any one of claims 1 to 7.

10. A chip, including a processor, characterized in that the processor is configured to read and execute the computer program stored in the memory to execute the steps of the face recognition method according to any one of claims 1 to 7.

11. A computer-readable storage medium, the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, it implements the steps of the face recognition method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Electronic device, control method thereof, control device, and computer-readable storage medium

    CN109271916A

  • Filtering ToF depth measurement method and device

    CN111538024A