Identity authentication method, electronic equipment and computer readable medium
By using two light sources in an electronic device to emit polarized light with different polarization angles and collecting and analyzing image differences, the problems of high imaging environment and equipment requirements in the existing technology are solved, and high-accuracy and low-cost identity authentication is achieved.
Patent Information
- Application Number
- CN202411975607.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-09-19
AI Technical Summary
Existing identity authentication technologies have high requirements for imaging environments and electronic equipment, resulting in decreased imaging accuracy and reduced identity authentication accuracy when the conditions are not met.
Two light sources are used to emit polarized light with different polarization angles respectively. The first image and the second image are collected by the camera module. The different characteristics of the depolarization ability of polarized light are used to analyze the image differences and distinguish between living objects and attacking materials.
It improves the accuracy of identity authentication, reduces the requirements for imaging environment and equipment, and reduces equipment costs.
Smart Images

Figure CN120673012A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and specifically to an identity authentication method, an electronic device, and a computer-readable medium. Background Art
[0002] With the development of computer technology, user identity authentication is required in more and more scenarios. When authenticating a user, it is necessary not only to identify the characteristics of the object to be tested to confirm its identity, but also to detect whether the object is alive or an attacking object.
[0003] Existing technologies typically use binocular vision, Time of Flight (TOF) cameras, structured light, and other methods to image the object being tested and analyze the resulting images to achieve identity authentication. However, these methods place high demands on the imaging environment or electronic equipment. If these conditions are not met, imaging accuracy will be significantly reduced, resulting in reduced authentication accuracy. Summary of the Invention
[0004] The embodiments of the present application provide an identity authentication method, an electronic device, and a computer-readable medium to improve the accuracy of identity authentication and reduce equipment costs.
[0005] In a first aspect, an embodiment of the present application provides an identity authentication method, which is applied to an electronic device, wherein the electronic device is provided with a first light source, a second light source and a camera module facing an object to be measured, and the first light source and the second light source are used to emit polarized light with different polarization angles; the method includes: determining target imaging parameters based on an imaging environment; based on the target imaging parameters, performing image capture on the object to be measured through the camera module to obtain a first image and a second image, the first image being captured when the first light source is turned on and the second light source is turned off, and the second image being captured when the first light source is turned off and the second light source is turned on; performing identity authentication on the object to be measured based on the first image and the second image to obtain an identity authentication result.
[0006] In a second aspect, an embodiment of the present application provides an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect.
[0007] In a third aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0008] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0009] The identity authentication method, electronic device, and computer-readable medium provided in the embodiments of the present application first determine target imaging parameters based on the imaging environment. Then, based on the target imaging parameters, the camera module captures images of the object to be detected, obtaining a first image and a second image. The first image is captured when the first light source is on and the second light source is off, and the second image is captured when the first light source is off and the second light source is on. Finally, the identity of the object to be detected is authenticated based on the first and second images, obtaining an authentication result. On the one hand, because the target imaging parameters can be automatically adjusted according to the imaging environment during the imaging process, the method can adapt to various imaging environments, reducing the requirements for the imaging environment. Even in harsh imaging environments, high-quality images can still be obtained, and identity authentication based on these high-quality images can improve the accuracy of identity authentication. On the other hand, by simply adding two light sources for emitting polarized light with different polarization directions to a conventional imaging device, the method analyzes the differences between the first and second images by exploiting the different depolarization capabilities of different morphologies and materials for polarized light, thereby distinguishing between living objects and attacking materials, thereby achieving identity authentication. This approach reduces the requirements for the electronic equipment and reduces the cost of the equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0011] Figure 1 is a flow chart of an embodiment of an identity authentication method according to the present application;
[0012] Figure 2 is a flow chart of a target imaging parameter determination process in an identity authentication method according to the present application;
[0013] Figure 3 is a structural diagram of an embodiment of an identity authentication device according to the present application;
[0014] Figure 4 It is a structural diagram of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION
[0015] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0016] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0017] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0018] Currently, binocular vision, TOF (Time of Flight) cameras, structured light, and other methods are commonly used to image the object to be tested, and identity authentication is achieved by analyzing the imaging results. However, the above methods have high requirements for the imaging environment or electronic equipment. When the imaging environment or electronic equipment does not meet the requirements, the imaging accuracy will be greatly reduced, resulting in reduced accuracy of identity authentication. The present application provides an identity authentication method that can reduce the requirements for the imaging environment and electronic equipment, thereby improving the accuracy of identity authentication and reducing equipment costs.
[0019] Please refer to Figure 1 , which shows a process 100 of an embodiment of an identity authentication method according to the present application. The identity authentication method can be applied to electronic devices. The electronic device is a device capable of imaging, which has an image acquisition function. The electronic device may include but is not limited to a smartphone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, an in-car computer, a PDA, a desktop computer, a set-top box, a smart TV, a wearable device, a smart lock, etc.
[0020] In this embodiment, the electronic device may be provided with a first light source, a second light source, and a camera module directed toward the object to be measured. The first and second light sources are configured to emit polarized light having different polarization angles, typically linearly polarized light. The camera module is configured to receive polarized light reflected from the object to be measured after being illuminated by polarized light having any of the aforementioned different polarization angles. In other words, the camera module receives polarized light having a single polarization direction, the same angle as the polarization angle of the polarized light emitted by the first or second light source.
[0021] Optionally, the polarized light emitted by the first light source and the second light source may be at a vertical angle. For example, the vertical direction or the horizontal direction may be taken as 0 degrees, the first light source may emit polarized light of 0 degrees, and the second light source may emit polarized light of 90 degrees. Alternatively, the first light source may emit polarized light of 90 degrees, and the second light source may emit polarized light of 0 degrees. The camera module can receive polarized light of 0 degrees or 90 degrees. In this way, the difference between the two images captured under different light sources can be maximized. When the object to be measured is a three-dimensional object such as a real human face, the greater the difference between the two images, the more significant the three-dimensional biometric features in the difference image of the two images, thereby enabling more accurate distinction between living objects and attacking materials.
[0022] The identity authentication method includes the following steps:
[0023] Step 101: Determine target imaging parameters based on the imaging environment.
[0024] In this embodiment, the imaging environment may include but is not limited to the lighting environment, the distance between the object to be measured and the camera module, the distance between the object to be measured and the light source, etc. The target imaging parameters may include but are not limited to at least one of the following: target exposure time, target gain, and target light source power consumption.
[0025] The target exposure time is the exposure time to be set. Exposure time is the interval between the opening and closing of the camera shutter, during which light is projected onto the photosensitive surface of the photosensitive material. Exposure time refers to the length of time light enters the camera sensor. The longer the exposure time, the more light enters. In poor lighting conditions, a longer exposure time is usually required to increase image brightness. Conversely, in brighter lighting conditions, a shorter exposure time is usually required to avoid overexposure, which can affect image quality.
[0026] The target gain is the gain to be set. Gain refers to the degree of signal amplification and is typically used to increase image brightness in weak signal conditions. Gain is a number greater than or equal to 1. In poor lighting conditions, the received optical signal is weak, and the digital signal after analog-to-digital conversion is weak, resulting in low image brightness. In these cases, a higher gain is required to increase image brightness. A higher gain increases image noise. In good lighting conditions, setting the gain is generally unnecessary or a lower value is used to avoid increased image noise. A gain of 1 maintains the original signal level without amplification, resulting in the output image being the original image. A gain of 2, while maintaining other imaging parameters, amplifies the signal by a factor of 2. The pixel value of each pixel in the output image is then double the value of the pixel at the same location in the original image.
[0027] The target light source power consumption is the light source power consumption to be set. Light source power consumption may include, but is not limited to, light source brightness. In poor lighting conditions, a higher light source power consumption is typically required to improve image brightness. Conversely, in good lighting conditions, a lower light source power consumption is typically required to conserve device power.
[0028] In this embodiment, the execution entity of the identity authentication method may determine target imaging parameters based on the imaging environment using preset rules. The preset rules may include: the darker the ambient light, the longer at least one of the target exposure time, target gain, and target light source power consumption; and the brighter the ambient light, the shorter at least one of the target exposure time, target gain, and target light source power consumption.
[0029] Step 102: Based on the target imaging parameters, the camera module is used to capture images of the object to be measured to obtain a first image and a second image. The first image is captured when the first light source is turned on and the second light source is turned off, and the second image is captured when the first light source is turned off and the second light source is turned on.
[0030] In this embodiment, the execution entity may set the power consumption of the first and second light sources to the target power consumption of the target light sources, set the exposure time of the camera module to the target exposure time, and set the gain of the electrical signal after the photoelectric conversion by the camera module to the target gain. On this basis, the camera module may be used to capture images of the object to be measured, thereby obtaining a first image and a second image. The first image is captured when the first light source is turned on and the second light source is turned off, and the second image is captured when the first light source is turned off and the second light source is turned on. The object to be measured may be an object to be authenticated. For example, it may include, but is not limited to, a face, a finger, a palm, an eye, and the like.
[0031] In practice, two frames of images can be captured continuously and used as the first image and the second image, respectively. First, the first light source is turned on and the second light source is turned off, and image capture is performed to obtain the first image. Then, the first light source is turned off and the second light source is turned on, and image capture is performed again to obtain the second image.
[0032] Step 103: Perform identity authentication on the object to be measured based on the first image and the second image to obtain an identity authentication result.
[0033] In this embodiment, the first image and the second image may include biometric features to be identified. Specifically, if the object to be detected is a face, both the first image and the second image may contain facial features. If the object to be detected is a finger, both the first image and the second image may contain fingerprint features. If the object to be detected is a palm, both the first image and the second image may contain palm print features. If the object to be detected is an eye, both the first image and the second image may contain iris features. Based on the biometric features in the first image or the second image, the similarity is calculated with the biometric features of the template image in the base database, and biometric identification can be performed to obtain a biometric identification result to determine the user's identity.
[0034] Furthermore, because the first and second light sources emit polarized light at different angles, and the camera module receives light at one of these different angles, there are differences between the first and second images. When the object to be detected is a three-dimensional object such as a real human face, the greater the difference between the two images, the more likely it is that the difference between the first and second images can be used to distinguish between a living object and an attacking object.
[0035] When the identity of the subject to be detected is determined to be the target identity based on the first image or the second image, and the subject to be detected is determined to be live based on the difference between the first image and the second image, an identity authentication result indicating that the identity authentication is successful can be obtained. Conversely, when the identity of the subject to be detected is determined not to be the target identity based on the first image or the second image, or when the subject to be detected is determined to be non-live based on the difference between the first image and the second image, an identity authentication result indicating that the identity authentication is unsuccessful can be obtained.
[0036] It should be noted that the embodiments of the present application can be applied to various scenarios requiring user identity authentication, including but not limited to terminal device unlocking, smart lock unlocking, application login, payment, work clocking in, and other scenarios.
[0037] In some optional implementations of this embodiment, step 103 may be further performed by the following steps:
[0038] In the first step, based on the first image or the second image, biometric identification is performed on the object to be measured to obtain a biometric identification result.
[0039] In the second step, based on the difference image between the first image and the second image, a liveness detection is performed on the object to be tested to obtain a liveness detection result. The above-mentioned difference image can be used to characterize the difference between the first image and the second image. The above-mentioned difference image can be obtained by subtracting the pixel value matrix corresponding to the first image from the pixel value matrix corresponding to the second image. When the object to be tested is a living body, since different parts of the living body are at different distances from the imaging device, for example, the nose of the face is closer to the imaging device, while other parts of the face are farther away from the imaging device, the difference image can have obvious three-dimensional features. In contrast, when the object to be tested is an attacking material such as a face image, since such an attacking material is a two-dimensional plane, the difference image does not have obvious three-dimensional features. In view of this, based on the difference image, it can be determined whether the object to be tested is a living body.
[0040] The third step is to determine the identity authentication result based on the biometric recognition results and the liveness detection results. Specifically, when the identity of the subject to be tested is determined to be the target identity based on the first image or the second image, and the subject to be tested is determined to be live based on the difference image between the first and second images, an identity authentication result indicating that the identity authentication is successful can be obtained. Conversely, when the identity of the subject to be tested is determined not to be the target identity based on the first image or the second image, or when the subject to be tested is determined to be non-live based on the difference image between the first and second images, an identity authentication result indicating that the identity authentication is unsuccessful can be obtained.
[0041] Therefore, conventional imaging devices only need to be equipped with two light sources emitting polarized light with different polarization directions. By analyzing the difference between the first and second images, the difference between the first and second images can be used to distinguish between living objects and attacking materials, thereby achieving identity authentication. This method reduces the requirements for electronic equipment and reduces equipment costs.
[0042] In some optional implementations of this embodiment, the first step described above can be further performed as follows: the first image or the second image is input into a biometric recognition model to obtain a biometric recognition result. Here, the corresponding biometric recognition model can be selected based on the type of object to be tested. Biometric recognition models may include, but are not limited to, facial recognition models, fingerprint recognition models, palm print recognition models, iris recognition models, and the like. The biometric recognition model can be obtained by pre-training a convolutional neural network based on a machine learning algorithm and deployed in the electronic device described above. Using the biometric recognition model, biometric recognition can be performed quickly and accurately, resulting in accurate biometric recognition results.
[0043] In some optional implementations of this embodiment, in the second step, if the biometric recognition result indicates that the biometric recognition has passed, the following operation may be performed: a difference image between the first and second images is input into a liveness detection model to obtain a liveness detection result. The liveness detection model can be used for liveness recognition to distinguish whether the object under test is a living person or an attacking material such as a two-dimensional image. The liveness detection model can be pre-trained using a convolutional neural network based on a machine learning algorithm and deployed in the electronic device described above. Using the liveness detection model, liveness detection can be performed quickly and accurately, resulting in accurate liveness detection results.
[0044] The method provided by the above-mentioned embodiment of the present application first determines target imaging parameters based on the imaging environment. Then, based on the target imaging parameters, the camera module captures images of the object to be tested, obtaining a first image and a second image. The first image is captured when the first light source is on and the second light source is off, and the second image is captured when the first light source is off and the second light source is on. Finally, based on the first and second images, the method performs a detection and verification. On the one hand, because the target imaging parameters can be automatically adjusted according to the imaging environment during the imaging process, it can adapt to various imaging environments, reducing the requirements for the imaging environment. Even in harsh imaging environments, high-quality images can still be obtained, and identity authentication based on these high-quality images can improve the accuracy of identity authentication. On the other hand, it only requires adding two light sources for emitting polarized light with different polarization directions to the conventional imaging device. By utilizing the different depolarization capabilities of different morphologies and materials for polarized light, the difference between the first and second images can be analyzed to distinguish between living objects and attacking materials, thereby achieving identity authentication. This method reduces the requirements for electronic equipment and reduces the cost of the equipment.
[0045] Further references Figure 2 , which shows a process 200 of another embodiment of an identity authentication method. The process 200 of the identity authentication method includes the following steps:
[0046] In step 201 , based on the initial imaging parameters, a camera module is used to capture images of the object to be measured to obtain a third image and a fourth image. The third image is captured when the first light source and the second light source are turned off, and the fourth image is captured when the first light source is turned on and the second light source is turned off.
[0047] In this embodiment, the initial imaging parameters may include, but are not limited to, initial exposure time, initial gain, and initial light source power consumption. The above-mentioned initial exposure time, initial gain, and initial light source power consumption may be set manually based on experience or according to the performance of the image sensor. The initial exposure time may be recorded as t0; the initial gain may be set to 1, recorded as gain1; and the light source power consumption may be recorded as P0. The above-mentioned execution entity may set the power consumption of the first and second light sources to the above-mentioned initial light source power consumption, set the exposure time of the camera module to the above-mentioned initial exposure time, and set the gain of the electrical signal after the camera module performs photoelectric conversion to the above-mentioned initial gain. On this basis, the camera module may be used to capture images of the object to be measured to obtain a third image and a fourth image. The third image is captured when the first and second light sources are turned off, that is, captured under natural light conditions. The fourth image is captured when the first light source is turned on and the second light source is turned off. The third image may be recorded as Pic0, and the fourth image may be recorded as Pic1.
[0048] In practice, two frames of images can be captured consecutively and used as the third and fourth images, respectively. First, under the initial imaging parameters, the first and second light sources are turned off, and image capture is performed to obtain the third image. Then, the first light source is turned on, while the second light source remains off, and image capture is performed again to obtain the fourth image.
[0049] Step 202: Determine a first pixel mean value of a target area in a fourth image.
[0050] In this embodiment, the target area is the valid area to be detected in the image, specifically a rectangular area. In practice, the target area can be determined using a detection algorithm. When the object to be detected is a face, the target area is the face area; when the object to be detected is a finger, the target area is the fingerprint area; when the object to be detected is a palm, the target area is the palm print area; and when the object to be detected is an eye, the target area is the iris area.
[0051] The first pixel mean value of the target area in the fourth image is the average pixel value of each pixel in the target area in the fourth image, which can be recorded as V Pic1 .
[0052] Step 203 : determining target imaging parameters based on the initial imaging parameters, the exposure time upper limit, the gain upper limit, and the first pixel mean value.
[0053] In this embodiment, the upper limit of the exposure time can be determined based on the frame rate of the electronic device and the number of pixels in the target area of the fourth image. The frame rate is the frequency of continuous image acquisition, measured in frames per second (fps). The reciprocal of the frame rate, 1 / frame rate, is the interval between two consecutive frame acquisitions, measured in seconds (s). If measured in milliseconds (ms), the interval between two consecutive frame acquisitions is 1000 / frame rate. The upper limit of the exposure time can be the difference between the interval between two consecutive frame acquisitions and the image transmission time. The image transmission time can be the time it takes to read out the pixels of the target area in the image. The image transmission time is related to the size of the target area, that is, the number of pixels in the target area. The larger the number of pixels in the target area, the longer the image transmission time; the smaller the number of pixels in the target area, the shorter the image transmission time. Here, only the pixel values of the target area in the fourth image are transmitted, and the pixel values of the area outside the target area in the fourth image are set to 0. This reduces the image transmission time, resulting in a higher upper limit of the exposure time and a wider setting range for the target exposure time.
[0054] It is understandable that because the time interval between two adjacent image frames is relatively short, typically 30 to 60 fps, the number of pixels in the target area in the third image and the number of pixels in the target area in the fourth image can be considered the same. Therefore, the upper limit of the exposure time can also be determined based on the frame rate of the electronic device and the number of pixels in the target area in the third image.
[0055] In this embodiment, the target imaging parameters may include, but are not limited to, target exposure time, target gain, and target light source power consumption. The target pixel mean and upper gain limit for the target area can be set empirically. For example, if the pixel value range is 0 to 255, the target pixel mean can be set to 100 or 150, etc., to ensure moderate brightness in the target area. The upper gain limit can be set to 10 to ensure that image brightness is improved while avoiding excessive image noise.
[0056] In this embodiment, the target exposure time can be set to a value greater than or equal to the initial exposure time and less than the upper limit of the exposure time. The target gain can be set to a value greater than or equal to the initial gain and less than the upper limit of the gain. The target light source power consumption can be set to a value greater than or equal to the initial light source power consumption.
[0057] In some optional implementations of this embodiment, the following parameter adjustment steps may be performed to obtain target imaging parameters:
[0058] Step S11: Based on the initial exposure time t0 and the first pixel mean value V Pic1 , the target pixel mean value of the target area in the fourth image (which can be recorded as V target ) and the pixel mean of the target area in the dark image (which can be recorded as Vdark ) to determine the exposure time to be measured (which can be recorded as t1). The dark state image is acquired by the camera module in a dark environment. This acquisition operation can be completed in advance, and the pixel mean of the target area in the dark state image can be stored and directly extracted here. The exposure time to be measured t1 can be referred to the following formula:
[0059] t1=(V target -V dark ) / (V Pic1 -V dark )×t0
[0060] Step S12: Determine whether the exposure time to be measured is less than or equal to the upper limit of exposure time (which can be recorded as ). That is, determine whether t1≤tmax is satisfied.
[0061] In step S13 , if the exposure time to be measured is less than or equal to the upper limit of the exposure time (ie t1 ≤ tmax), the exposure time to be measured t1 is determined as the target exposure time, the initial light source power consumption P0 is determined as the target light source power consumption, and the initial gain gain1 is determined as the target gain.
[0062] The above process is the process of adjusting the exposure time. Specifically, (V target -V dark ) / (V Pic1 -V dark ) is a coefficient, and the initial exposure time t0 is adjusted to obtain the exposure time to be measured t1. The first pixel mean V Pic1 The smaller it is, the darker the image is and the longer the exposure time is required; the first pixel mean V Pic1 The larger it is, the brighter the image is and the shorter the exposure time is. The first pixel mean V Pic1 and the target pixel mean V target The greater the difference, the greater the coefficient, and the greater the adjustment range of the exposure time. By adjusting the exposure time, the first pixel mean value V can be changed Pic1 If the adjusted exposure time (i.e., the exposure time to be measured, t1) is less than the exposure time threshold, it means that the image brightness can be improved by adjusting the exposure time alone. Therefore, it is not necessary to adjust the light source power consumption and gain, thereby saving device power consumption and avoiding the increase of image noise.
[0063] In some optional implementations of this embodiment, after executing step S12, the following steps may also be executed:
[0064] In step S14, if the exposure time to be measured is greater than the upper limit of the exposure time (i.e., t1>tmax), the gain to be measured (which can be recorded as gain2) is determined based on the preset step size (which can be recorded as s) and the initial gain gain1. For example, gain2 = gain1 + s × n. Where n is the number of times the parameter adjustment step is performed. If gain1 = 1, s = 1, and n = 1, then gain2 = 1 + 1 × 1 = 2.
[0065] Step S15: Determine whether the gain to be measured is less than or equal to the upper limit of gain (which may be recorded as gain max). That is, determine whether gain2≤gain max is satisfied.
[0066] Step S16: If the gain to be measured is less than or equal to the upper limit of the gain (ie, gain2≤gain max), then based on the gain to be measured, update the first pixel mean value V Pic1 That is, V Pic1 =V Pic1 ×gain2.
[0067] In step S17, the measured gain is used as the updated initial gain, and the parameter adjustment step is continued based on the updated first pixel mean value. That is, the process continues to step S11.
[0068] By increasing the gain when the measured exposure time exceeds the upper limit, the image brightness can be further adjusted to ensure image quality. At the same time, when the measured gain is less than the upper limit, the initial light source power consumption is maintained unchanged, which can maximize device power consumption.
[0069] In some optional implementations of this embodiment, after executing step S15, the following steps may also be executed:
[0070] Step S18: If the gain to be measured is greater than the upper gain limit (i.e., gain2>gain max), the upper exposure time limit tmax is determined as the target exposure time, the upper gain limit gain max is determined as the target gain, and the second pixel mean value (which can be recorded as V ) of the target area in the difference image between the third image and the fourth image is determined based on the target gain. Pic1-Pic0 ), and based on the initial exposure time t0, the target pixel mean V target , the first pixel mean V Pic1 , the second pixel mean V Pic1-Pic0 And the initial light source power consumption P0, determine the target light source power consumption (which can be recorded as P1). Refer to the following formula:
[0071] P1=t0 / tmax×[(V target -V Pic1 ) / V Pic1-Pic0 ]×P0
[0072] The second pixel mean of the target area in the difference image between the third and fourth images is the average pixel value of each pixel in the target area in the difference image between the third and fourth images at the target gain. Pic1-Pic0 represent the difference image between the third and fourth images. Furthermore, due to the short time interval between the capture of two adjacent image frames, the location and number of pixels of the target area in the fourth image and the difference image between the third and fourth images can be assumed to be identical.
[0073] By increasing the light source power consumption when the exposure time to be measured is greater than the exposure time upper limit and the gain reaches the gain upper limit, the image brightness can be further adjusted to ensure imaging quality.
[0074] In step 204 , based on the target imaging parameters, the camera module is used to capture images of the object to be measured to obtain a first image and a second image. The first image is captured when the first light source is turned on and the second light source is turned off, and the second image is captured when the first light source is turned off and the second light source is turned on.
[0075] Step 204 of this embodiment can be found in Figure 1 Step 102 of the corresponding embodiment will not be described again here.
[0076] Step 205 : performing identity authentication on the object to be measured based on the first image and the second image to obtain an identity authentication result.
[0077] Step 205 of this embodiment can be found in Figure 1 Step 103 of the corresponding embodiment will not be described again here.
[0078] In some optional implementations of this embodiment, the biometric feature recognition of the object to be tested can be first performed based on the first image or the second image to obtain a biometric feature recognition result; then, based on the difference image between the first image and the second image, a liveness detection can be performed on the object to be tested to obtain a liveness detection result; finally, based on the biometric feature recognition result and the liveness detection result, the identity authentication result can be determined.
[0079] from Figure 2 It can be seen that Figure 1Compared with the corresponding embodiment, the process 200 of the identity authentication method in this embodiment provides a specific implementation method for determining the target imaging parameters based on the imaging environment, which saves device power consumption by preferentially adjusting the exposure time while avoiding the increase of image noise. When the exposure time to be measured is greater than the upper limit of the exposure time, the gain is increased, and the image brightness can be further adjusted to ensure the imaging quality. At the same time, when the gain to be measured is less than the upper limit of the gain, the initial light source power consumption is kept unchanged, which can save the power consumption of the device to the greatest extent. By increasing the light source power consumption when the exposure time to be measured is greater than the upper limit of the exposure time and the gain reaches the upper limit of the gain, the image brightness can be further adjusted to ensure the imaging quality.
[0080] Further references Figure 3 As an implementation of the methods shown in the above figures, the present application provides an embodiment of an identity authentication device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to an electronic device. The electronic device is provided with a first light source, a second light source and a camera module facing the object to be measured, wherein the first light source and the second light source are used to emit polarized light with different polarization angles.
[0081] like Figure 3 As shown, the identity authentication device 300 of this embodiment includes: a determination unit 301, used to determine the target imaging parameters based on the imaging environment; an acquisition unit 302, used to acquire images of the object to be measured through the camera module based on the target imaging parameters, to obtain a first image and a second image, the first image being acquired when the first light source is turned on and the second light source is turned off, and the second image being acquired when the first light source is turned off and the second light source is turned on; an authentication unit 303, used to perform identity authentication on the object to be measured based on the first image and the second image, to obtain an identity authentication result.
[0082] In some optional implementations of this embodiment, the determination unit 301 is further used to: based on the initial imaging parameters, acquire an image of the object to be measured through the camera module to obtain a third image and a fourth image, the third image being acquired when the first light source and the second light source are turned off, and the fourth image being acquired when the first light source is turned on and the second light source is turned off; determine a first pixel mean of the target area in the fourth image; and determine the target imaging parameters based on the initial imaging parameters, the exposure time upper limit, the gain upper limit and the first pixel mean.
[0083] In some optional implementations of this embodiment, the initial imaging parameters include initial exposure time, initial gain and initial light source power consumption; the target imaging parameters include target exposure time, target gain and target light source power consumption; the determination unit 301 is further used to: perform the following parameter adjustment steps: determine the exposure time to be measured based on the initial exposure time, the first pixel mean, the target pixel mean of the target area in the fourth image and the pixel mean of the target area in the dark state image, wherein the dark state image is acquired by the camera module on the object to be measured in a lightless environment; determine whether the exposure time to be measured is less than or equal to the exposure time upper limit; if the exposure time to be measured is less than or equal to the exposure time upper limit, determine the exposure time to be measured as the target exposure time, determine the initial light source power consumption as the target light source power consumption, and determine the initial gain as the target gain.
[0084] In some optional implementations of this embodiment, the determination unit 301 is further used to: if the exposure time to be measured is greater than the exposure time upper limit, determine the gain to be measured based on the preset step size and the initial gain; determine whether the gain to be measured is less than or equal to the gain upper limit; if the gain to be measured is less than or equal to the gain upper limit, update the first pixel mean based on the gain to be measured; use the gain to be measured as the updated initial gain, and continue to perform the parameter adjustment step based on the updated first pixel mean.
[0085] In some optional implementations of this embodiment, the determination unit 301 is further used to: if the gain to be measured is greater than the gain upper limit, determine the exposure time upper limit as the target exposure time, determine the gain upper limit as the target gain, determine the second pixel mean of the target area in the difference image between the third image and the fourth image based on the target gain, and determine the target light source power consumption based on the initial exposure time, the target pixel mean, the first pixel mean, the second pixel mean and the initial light source power consumption.
[0086] In some optional implementations of this embodiment, the authentication unit 303 is further used to: perform biometric identification on the object to be tested based on the first image or the second image to obtain a biometric identification result; perform liveness detection on the object to be tested based on a difference image between the first image and the second image to obtain a liveness detection result; and determine an identity authentication result based on the biometric identification result and the liveness detection result.
[0087] In some optional implementations of this embodiment, the object to be measured includes a human face.
[0088] The device provided by the above-described embodiments of the present application first determines target imaging parameters based on the imaging environment. Then, based on the target imaging parameters, the camera module captures images of the object to be detected, obtaining a first image and a second image. The first image is captured when the first light source is on and the second light source is off, and the second image is captured when the first light source is off and the second light source is on. Finally, based on the first image or the second image, as well as the difference image between the first and second images, the object to be detected is authenticated, obtaining an authentication result. On the one hand, because the target imaging parameters can be automatically adjusted according to the imaging environment during the imaging process, the device can adapt to various imaging environments, reducing the requirements for the imaging environment. Even in harsh imaging environments, high-quality images can still be obtained, and identity authentication based on these high-quality images can improve the accuracy of identity authentication. On the other hand, by simply adding two light sources emitting polarized light with different polarization directions to a conventional imaging device, the difference between the first and second images can be analyzed by exploiting the different depolarization capabilities of different morphologies and materials to distinguish between living objects and attacking materials, thereby achieving identity authentication. This approach reduces the requirements for electronic equipment and reduces the cost of the equipment.
[0089] An embodiment of the present application also provides an electronic device, including one or more processors and a storage device on which one or more programs are stored. When the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned identity authentication method.
[0090] Reference below Figure 4 , which shows a structural schematic diagram of an electronic device for implementing some embodiments of the present application. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0091] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. Various programs and data required for the operation of the electronic device 400 are also stored in the RAM 403. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0092] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic disk, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as needed.
[0093] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned identity authentication method when executed by a processor.
[0094] In particular, according to some embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from a network via the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of some embodiments of the present application are performed.
[0095] An embodiment of the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned identity authentication method is implemented.
[0096] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present application, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or device. In some embodiments of the present application, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0097] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0098] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs. When executed by the electronic device, the electronic device: determines target imaging parameters based on the imaging environment; based on the target imaging parameters, captures an image of the object to be measured using a camera module to obtain a first image and a second image, wherein the first image is captured when the first light source is on and the second light source is off, and the second image is captured when the first light source is off and the second light source is on; and authenticates the object to be measured based on the first image and the second image to obtain an authentication result.
[0099] Computer program code for performing the operations of some embodiments of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++; and also conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, or can be connected to an external computer (for example, through the Internet using an Internet service provider). The above network includes a local area network (LAN) or a wide area network (WAN).
[0100] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0101] The units described in some embodiments of this application may be implemented in software or hardware. The units described may also be provided in a processor. For example, a processor may be described as comprising a first determination unit, a second determination unit, a selection unit, and a third determination unit. The names of these units do not, in some cases, limit the units themselves.
[0102] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0103] The above description is only an illustration of some preferred embodiments of the present application and the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features and the technical features with similar functions disclosed in the embodiments of the present application (but not limited to) are replaced with each other to form a technical solution.
Claims
1. An identity authentication method, characterized in that: Applied to an electronic device, the electronic device is provided with a first light source, a second light source, and a camera module facing an object to be measured, the first light source and the second light source are used to emit polarized light with different polarization angles; the method includes: Determine target imaging parameters based on the imaging environment; Based on the target imaging parameters, the camera module performs image acquisition on the object to be measured to obtain a first image and a second image, wherein the first image is acquired when the first light source is turned on and the second light source is turned off, and the second image is acquired when the first light source is turned off and the second light source is turned on; Based on the first image and the second image, identity authentication is performed on the object to be detected to obtain an identity authentication result.
2. The method according to claim 1, characterized in that The determining of target imaging parameters based on the imaging environment includes: Based on the initial imaging parameters, capturing an image of the object to be measured using the camera module to obtain a third image and a fourth image, wherein the third image is captured when the first light source and the second light source are turned off, and the fourth image is captured when the first light source is turned on and the second light source is turned off; determining a first pixel mean value of the target area in the fourth image; Target imaging parameters are determined based on the initial imaging parameters, the exposure time upper limit, the gain upper limit, and the first pixel mean value.
3. The method according to claim 2, characterized in that The initial imaging parameters include an initial exposure time, an initial gain, and an initial light source power consumption; the target imaging parameters include a target exposure time, a target gain, and a target light source power consumption; and determining the target imaging parameters based on the initial imaging parameters, the exposure time upper limit, the gain upper limit, and the first pixel mean value includes: Perform the following parameter adjustment steps: determining a test exposure time based on the initial exposure time, the first pixel mean, the target pixel mean of the target area in the fourth image, and the pixel mean of the target area in a dark-state image acquired by the camera module from the object to be measured in a dark environment; Determining whether the exposure time to be measured is less than or equal to the exposure time upper limit; If the exposure time to be measured is less than or equal to the exposure time upper limit, the exposure time to be measured is determined as the target exposure time, the initial light source power consumption is determined as the target light source power consumption, and the initial gain is determined as the target gain.
4. The method according to claim 3, characterized in that After determining whether the exposure time to be measured is less than or equal to the exposure time upper limit, determining target imaging parameters based on the initial imaging parameters, the exposure time upper limit, the gain upper limit, and the first pixel mean value, further includes: If the exposure time to be measured is greater than the exposure time upper limit, determining the gain to be measured based on the preset step size and the initial gain; Determining whether the gain to be measured is less than or equal to the gain upper limit; If the gain to be measured is less than or equal to the gain upper limit, updating the first pixel mean based on the gain to be measured; The gain to be measured is used as the updated initial gain, and the parameter adjustment step is continued based on the updated first pixel mean.
5. The method according to claim 4, characterized in that After determining whether the gain to be measured is less than or equal to the gain upper limit, determining target imaging parameters based on the initial imaging parameters, the exposure time upper limit, the gain upper limit, and the first pixel mean value further includes: If the gain to be measured is greater than the gain upper limit, the exposure time upper limit is determined as the target exposure time, and the gain upper limit is determined as the target gain. Based on the target gain, the second pixel mean of the target area in the difference image between the third image and the fourth image is determined, and based on the initial exposure time, the target pixel mean, the first pixel mean, the second pixel mean and the initial light source power consumption, the target light source power consumption is determined.
6. The method according to claim 1, characterized in that The performing identity authentication on the object to be detected based on the first image and the second image to obtain an identity authentication result includes: performing biometric identification on the object to be tested based on the first image or the second image to obtain a biometric identification result; performing liveness detection on the object to be detected based on a difference image between the first image and the second image to obtain a liveness detection result; An identity authentication result is determined based on the biometric recognition result and the liveness detection result.
7. The method according to any one of claims 1 to 6, characterized in that The object to be measured includes a human face.
8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 7 when executed by the processor.
9. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.