CN114387674A - Liveness detection method, system, device, storage medium and program product - Google Patents
Liveness detection method, system, device, storage medium and program product Download PDFInfo
- Publication number
- CN114387674A CN114387674A CN202111679763.XA CN202111679763A CN114387674A CN 114387674 A CN114387674 A CN 114387674A CN 202111679763 A CN202111679763 A CN 202111679763A CN 114387674 A CN114387674 A CN 114387674A
- Authority
- CN
- China
- Prior art keywords
- white balance
- video
- target
- balance sequence
- sequence information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 155
- 238000003860 storage Methods 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 claims abstract description 104
- 230000008569 process Effects 0.000 claims abstract description 53
- 230000008859 change Effects 0.000 claims description 36
- 238000004590 computer program Methods 0.000 claims description 19
- 230000004044 response Effects 0.000 claims description 13
- 238000001727 in vivo Methods 0.000 claims description 2
- 238000012795 verification Methods 0.000 description 15
- 238000004891 communication Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 9
- 238000002834 transmittance Methods 0.000 description 9
- 238000012545 processing Methods 0.000 description 8
- 230000009471 action Effects 0.000 description 7
- 230000000694 effects Effects 0.000 description 7
- 239000008186 active pharmaceutical agent Substances 0.000 description 6
- 238000007726 management method Methods 0.000 description 6
- 238000013473 artificial intelligence Methods 0.000 description 5
- 239000000284 extract Substances 0.000 description 4
- 230000001681 protective effect Effects 0.000 description 4
- 230000003796 beauty Effects 0.000 description 3
- 238000003384 imaging method Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 239000000243 solution Substances 0.000 description 3
- 238000013135 deep learning Methods 0.000 description 2
- 230000001815 facial effect Effects 0.000 description 2
- 238000002347 injection Methods 0.000 description 2
- 239000007924 injection Substances 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 241001465754 Metazoa Species 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000009529 body temperature measurement Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007123 defense Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Landscapes
- Color Television Image Signal Generators (AREA)
Abstract
Description
技术领域technical field
本申请涉及数据处理技术领域,特别是涉及一种活体检测方法、系统、设备、存储介质及程序产品。The present application relates to the technical field of data processing, and in particular, to a method, system, device, storage medium and program product for detecting a living body.
背景技术Background technique
活体检测技术是一种用来检测人脸是否是真人的防御手段,防止他人使用屏幕翻拍、打印纸翻拍或面具等伪造人像,在消费金融、娱乐游戏等领域有着重要的应用。近年来,黑产的欺骗手段愈发高明,可以通过劫持摄像头等手段直接上传提前拍摄好的视频或图片,从而骗过活体检测模型。这种攻击手段是单纯采用活体检测模型无法防御的。目前,动作活体、唇语活体以及炫彩活体都可以很好的防御这种攻击,但是动作活体、唇语活体和炫彩活体仍存在很多问题,例如动作活体、唇语活体需要花费较长时间与用户交互,检测效率低。而炫彩活体对环境的光线亮度、手机屏幕膜、手机屏幕亮度等要求较高,应用范围较窄。Liveness detection technology is a defense method used to detect whether a face is a real person, preventing others from using screen remakes, printing paper remakes or masks to fake portraits, and has important applications in consumer finance, entertainment games and other fields. In recent years, the deception methods of black products have become more and more sophisticated. By hijacking cameras and other means, they can directly upload videos or pictures that have been taken in advance, so as to deceive the living body detection model. This attack method cannot be defended by simply adopting the live detection model. At present, the live action, lip language and colorful live body can be well defended against this attack, but there are still many problems with the action live body, the lip language live body and the colorful live body. For example, the action live body and the lip language live body take a long time. Interacting with the user, the detection efficiency is low. The colorful living body has higher requirements on the brightness of the environment, the screen film of the mobile phone, the brightness of the mobile phone screen, etc., and the application scope is narrow.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种活体检测方法、系统、设备、存储介质及程序产品,可实现对目标对象的活体检测。具体技术方案如下:The present application provides a living body detection method, system, device, storage medium and program product, which can realize the living body detection of a target object. The specific technical solutions are as follows:
在本申请实施例的第一方面,首先提供了一种活体检测方法,所述方法包括:In a first aspect of the embodiments of the present application, a method for detecting a living body is first provided, and the method includes:
获取目标对象的视频;Get the video of the target object;
对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息;Analyze the video to obtain the recording white balance sequence information actually used in the recording process of the video;
将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,所述目标白平衡序列信息用于指示在所述视频的录制过程中对摄像装置的白平衡参数进行调整;Matching the recording white balance sequence information with the target white balance sequence information, the target white balance sequence information is used to instruct to adjust the white balance parameters of the camera during the recording process of the video;
根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。According to the matching result between the recorded white balance sequence information and the target white balance sequence information, it is verified whether the target object is a living body.
在本申请实施例的第二方面,提供了一种活体检测方法,应用于终端设备,所述方法包括:In a second aspect of the embodiments of the present application, a method for detecting a living body is provided, which is applied to a terminal device, and the method includes:
响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整;Acquire target white balance sequence information from the server in response to a living body detection request for performing living body detection on the target object; wherein the target white balance parameter sequence information is used to instruct to adjust the white balance parameters of the camera during the video recording process ;
控制所述摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制;Controlling the camera device to perform video recording on the target object according to the instruction of the target white balance sequence information;
将录制的所述目标对象的视频发送给所述服务器,由所述服务器对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,并将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据匹配结果确定所述目标对象是否是活体。Send the recorded video of the target object to the server, and the server parses the video to obtain the recording white balance sequence information actually used in the recording process of the video, and records the video. The white balance sequence information is matched with the target white balance sequence information, and whether the target object is a living body is determined according to the matching result.
在本申请实施例的第三方面,还提供了一种活体检测系统,所述系统包括终端设备和服务器;In a third aspect of the embodiments of the present application, a live detection system is also provided, and the system includes a terminal device and a server;
所述终端设备,用于响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息,并控制摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制,将录制的所述目标对象的视频发送给所述服务器;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整;The terminal device is configured to obtain target white balance sequence information from a server in response to a living body detection request for performing living body detection on the target object, and control the camera device to perform video recording on the target object according to the instructions of the target white balance sequence information, sending the recorded video of the target object to the server; wherein, the target white balance parameter sequence information is used to instruct the white balance parameters of the camera to be adjusted during the video recording process;
所述服务器,用于接收所述目标对象的视频,对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。The server is configured to receive the video of the target object, parse the video, obtain the recording white balance sequence information actually used in the recording process of the video, and associate the recording white balance sequence information with the target object. The white balance sequence information is matched, and whether the target object is a living body is verified according to the matching result of the recorded white balance sequence information and the target white balance sequence information.
在本申请实施例的第四方面,还提供了一种活体检测装置,所述装置包括:In a fourth aspect of the embodiments of the present application, a device for detecting a living body is also provided, and the device includes:
第一获取模块,用于获取目标对象的视频;a first acquisition module, used for acquiring the video of the target object;
解析模块,用于对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息;a parsing module for parsing the video to obtain the recording white balance sequence information actually used in the recording process of the video;
匹配模块,用于将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,所述目标白平衡序列信息用于指示在所述视频的录制过程中对摄像装置的白平衡参数进行调整;a matching module, configured to match the recording white balance sequence information with target white balance sequence information, where the target white balance sequence information is used to instruct the white balance parameters of the camera to be adjusted during the video recording process;
校验模块,用于根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。A verification module, configured to verify whether the target object is a living body according to the matching result of the recorded white balance sequence information and the target white balance sequence information.
在本申请实施例的第五方面,还提供了另一种活体检测装置,应用于终端设备,所述装置包括:In a fifth aspect of the embodiments of the present application, another apparatus for detecting a living body is provided, which is applied to a terminal device, and the apparatus includes:
第三获取模块,用于响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整;The third obtaining module is configured to obtain target white balance sequence information from the server in response to a living body detection request for performing living body detection on the target object; wherein, the target white balance parameter sequence information is used to indicate that the camera is to be recorded during the video recording process. Adjust the white balance parameters of the device;
第一控制模块,用于控制所述摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制;a first control module, configured to control the camera device to perform video recording on the target object according to the instruction of the target white balance sequence information;
第二发送模块,用于将录制的所述目标对象的视频发送给所述服务器,由所述服务器对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,并将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据匹配结果确定所述目标对象是否是活体。The second sending module is configured to send the recorded video of the target object to the server, and the server parses the video to obtain the recording white balance sequence actually used in the video recording process information, and match the recorded white balance sequence information with the target white balance sequence information, and determine whether the target object is a living body according to the matching result.
在本申请实施例的第六方面,还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a sixth aspect of the embodiments of the present application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
存储器,用于存放计算机程序;memory for storing computer programs;
处理器,用于执行存储器上所存放的程序时,实现本申请实施例的第一方面或第二方面所述的活体检测方法中的步骤。The processor is configured to implement the steps in the living body detection method described in the first aspect or the second aspect of the embodiments of the present application when executing the program stored in the memory.
在本申请实施例的第七方面,还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行本申请实施例的第一方面或第二方面所述的活体检测方法中的步骤。In a seventh aspect of the embodiments of the present application, a computer-readable storage medium is also provided, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer is made to execute the first embodiment of the present application. The steps in the biological detection method of one aspect or the second aspect.
在本申请实施例的第八方面,还提供了一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现本申请实施例的第一方面或第二方面所述的活体检测方法中的步骤。In an eighth aspect of the embodiments of the present application, a computer program product is also provided, including a computer program/instruction, and when the computer program/instructions are executed by a processor, the first aspect or the second aspect of the embodiments of the present application is implemented. The steps in the live detection method.
采用本申请的活体检测方法,首先获取目标对象的视频,然后对视频进行解析,得到在视频的录制过程中实际所使用的录制白平衡序列信息。接着,将录制白平衡序列信息与目标白平衡序列信息进行匹配,目标白平衡序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整。最后,根据录制白平衡序列信息与目标白平衡序列信息的匹配结果,校验目标对象是否为活体。本申请的活体检测方法具备如下多个效果:Using the living body detection method of the present application, the video of the target object is obtained first, and then the video is analyzed to obtain the recording white balance sequence information actually used in the video recording process. Next, the recording white balance sequence information is matched with the target white balance sequence information, and the target white balance sequence information is used to instruct to adjust the white balance parameters of the camera during the video recording process. Finally, according to the matching result of the recorded white balance sequence information and the target white balance sequence information, it is verified whether the target object is a living body. The living body detection method of the present application has the following multiple effects:
一、可检测出目标对象的视频是否是摄像装置被劫持后拍摄的攻击视频。1. It can detect whether the video of the target object is an attack video shot after the camera device was hijacked.
二、本申请的活体检测方法的应用范围更广,一方面,不再对光线的强度有要求(白平衡与光线强度无关),在光线较强的环境中仍能生效,可覆盖用户的各种使用场景;另一方面,不再对设备的保护膜(例如手机膜)的透光性有要求(白平衡与膜的透光性无关),可覆盖用户的各种设备;另一方面,不再需要调亮设备的屏幕(白平衡与屏幕亮度无关),可避免对用户造成晃眼,优化用户的体验。2. The live detection method of the present application has a wider application range. On the one hand, it no longer requires the intensity of light (white balance has nothing to do with the intensity of light), it can still take effect in an environment with strong light, and can cover the user's various On the other hand, there is no longer any requirement for the light transmittance of the protective film of the device (such as mobile phone film) (white balance has nothing to do with the light transmittance of the film), which can cover various devices of the user; on the other hand, It is no longer necessary to brighten the screen of the device (white balance has nothing to do with screen brightness), which can avoid dazzling users and optimize the user experience.
三、本申请的活体检测方法具有较高的检测效率,无需用户花费较长的时间进行交互,同时降低了用户的使用难度,避免个别用户因难度太大而无法完成检测,提高了整体检测率。3. The living body detection method of the present application has high detection efficiency, does not require users to spend a long time to interact, and at the same time reduces the difficulty for users to use, avoids individual users from being unable to complete the detection due to too much difficulty, and improves the overall detection rate .
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings that are required to be used in the description of the embodiments or the prior art.
图1是本申请一实施例示出的一种实施环境示意图;FIG. 1 is a schematic diagram of an implementation environment shown in an embodiment of the present application;
图2是本申请一实施例示出的一种活体检测方法的流程图;2 is a flowchart of a method for detecting a living body according to an embodiment of the present application;
图3是本申请一实施例示出的另一种活体检测方法的流程图;3 is a flowchart of another method for detecting a living body according to an embodiment of the present application;
图4是本申请一实施例示出的一种活体检测方法的完整流程示意图;FIG. 4 is a complete schematic flowchart of a method for detecting a living body according to an embodiment of the present application;
图5是本申请一实施例示出的一种活体检测装置的结构框图;FIG. 5 is a structural block diagram of a living body detection device shown in an embodiment of the present application;
图6是本申请一实施例示出的另一种活体检测装置的结构框图;6 is a structural block diagram of another living body detection apparatus shown in an embodiment of the present application;
图7是本申请一实施例示出的一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
近年来,基于人工智能的计算机视觉、深度学习、机器学习、图像处理、图像识别等技术研究取得了重要进展。人工智能(Artificial Intelligence,AI)是研究、开发用于模拟、延伸人的智能的理论、方法、技术及应用系统的新兴科学技术。人工智能学科是一门综合性学科,涉及芯片、大数据、云计算、物联网、分布式存储、深度学习、机器学习、神经网络等诸多技术种类。计算机视觉作为人工智能的一个重要分支,具体是让机器识别世界,计算机视觉技术通常包括人脸识别、活体检测、指纹识别与防伪验证、生物特征识别、人脸检测、行人检测、目标检测、行人识别、图像处理、图像识别、图像语义理解、图像检索、文字识别、视频处理、视频内容识别、行为识别、三维重建、虚拟现实、增强现实、同步定位与地图构建(SLAM)、计算摄影、机器人导航与定位等技术。随着人工智能技术的研究和进步,该项技术在众多领域展开了应用,例如安防、城市管理、交通管理、楼宇管理、园区管理、人脸通行、人脸考勤、物流管理、仓储管理、机器人、智能营销、计算摄影、手机影像、云服务、智能家居、穿戴设备、无人驾驶、自动驾驶、智能医疗、人脸支付、人脸解锁、指纹解锁、人证核验、智慧屏、智能电视、摄像机、移动互联网、网络直播、美颜、美妆、医疗美容、智能测温等领域。In recent years, important progress has been made in the research of artificial intelligence-based computer vision, deep learning, machine learning, image processing, image recognition and other technologies. Artificial Intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies and application systems for simulating and extending human intelligence. Artificial intelligence is a comprehensive discipline, involving chips, big data, cloud computing, Internet of Things, distributed storage, deep learning, machine learning, neural networks and many other types of technologies. As an important branch of artificial intelligence, computer vision is to let machines recognize the world. Computer vision technology usually includes face recognition, living detection, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, target detection, pedestrian detection Recognition, Image Processing, Image Recognition, Image Semantic Understanding, Image Retrieval, Text Recognition, Video Processing, Video Content Recognition, Behavior Recognition, 3D Reconstruction, Virtual Reality, Augmented Reality, Simultaneous Localization and Mapping (SLAM), Computational Photography, Robotics Navigation and positioning technology. With the research and progress of artificial intelligence technology, this technology has been applied in many fields, such as security, city management, traffic management, building management, park management, face access, face attendance, logistics management, warehouse management, robotics , smart marketing, computational photography, mobile imaging, cloud services, smart home, wearable devices, driverless, autonomous driving, smart medical care, face payment, face unlock, fingerprint unlock, witness verification, smart screen, smart TV, Cameras, mobile Internet, webcasting, beauty, beauty, medical beauty, intelligent temperature measurement and other fields.
在相关技术中,动作活体检测和唇语活体检测需要用户按照提示做出某种动作,或说出屏幕上的随机数字,这往往是照片无法实现的。然而,这类检测交互时间过长,对于有些用户而言完成难度太大,造成整体检出率偏低。In the related art, the motion detection and the lip language detection require the user to perform a certain action according to the prompt, or to speak a random number on the screen, which is often impossible to achieve with photos. However, the interaction time of this type of detection is too long, and it is too difficult for some users to complete, resulting in a low overall detection rate.
在炫彩活体检测中,用户终端的屏幕会按照服务端下发的随机序列发出各种颜色的光,服务端在验证活体时会对比录制的视频中的光序与服务器下发的光序是否一致,从而判断视频是否是真实拍摄、而非劫持注入的。但炫彩活体检测具有很多缺陷,例如:(1)屏幕打光对环境要求非常高,必须在较暗的环境中才有效果;(2)对手机屏幕膜要求较高,对于透光性不好的手机膜效果不好;(3)为了尽可能的打上光,需要调亮手机屏幕,拉近脸部和手机屏幕的距离,造成晃眼。In the dazzling live detection, the screen of the user terminal will emit light of various colors according to the random sequence sent by the server, and the server will compare the light sequence in the recorded video and the light sequence sent by the server when verifying the live body. Consistent, so as to determine whether the video is real shot, not hijacked injection. However, the colorful live detection has many defects, such as: (1) The screen lighting has very high requirements on the environment, and it must be effective in a dark environment; (2) The requirements for mobile phone screen film are high, and the light transmittance is not good. A good mobile phone film does not work well; (3) In order to make it as bright as possible, it is necessary to brighten the mobile phone screen and shorten the distance between the face and the mobile phone screen, causing dazzling.
为解决上述问题,本申请提供了一种白平衡活体检测方法,下面将对本申请的白平衡活体检测方法进行详细说明。In order to solve the above problems, the present application provides a white balance living body detection method, and the white balance living body detection method of the present application will be described in detail below.
图1是本申请一实施例示出的一种实施环境示意图。在图1中,终端设备内部安装有SDK(Software Development Kit,软件开发工具包),终端设备可以通过SDK与服务器通信交互。其中,终端设备可以是智能手机、平板、电脑及其它便携式智能设备,服务器可以是一台服务器,也可以是多台服务器的集群,本实施例对终端设备和服务器的类型不作具体限制。FIG. 1 is a schematic diagram of an implementation environment according to an embodiment of the present application. In FIG. 1 , an SDK (Software Development Kit, software development kit) is installed inside the terminal device, and the terminal device can communicate and interact with the server through the SDK. The terminal device may be a smart phone, tablet, computer or other portable smart devices, and the server may be a server or a cluster of multiple servers. This embodiment does not specifically limit the types of terminal devices and servers.
本申请首先提供了一种活体检测方法,可以应用于图1中的服务器,也可以应用于图1中的终端设备。图2是本申请一实施例示出的一种活体检测方法的流程图。参照图2,本申请的活体检测方法具体可以包括如下步骤:The present application first provides a liveness detection method, which can be applied to the server in FIG. 1 or the terminal device in FIG. 1 . FIG. 2 is a flowchart of a method for detecting a living body according to an embodiment of the present application. Referring to FIG. 2 , the method for detecting a living body of the present application may specifically include the following steps:
步骤S21:获取目标对象的视频。Step S21: Obtain the video of the target object.
在本实施例中,目标对象可以是人物对象,也可以是非人物对象的其它活体对象(例如动物对象)。In this embodiment, the target object may be a human object, or may be other living objects (eg, animal objects) that are not human objects.
视频可以是包含目标对象的指定区域(用于进行活体检测的区域)的视频。以目标对象是人物对象为例,视频可以是包含面部区域的视频,可以是包含上半身区域的视频,也可以是包含手部区域的视频,本实施例对区域不作具体限制。The video may be a video containing a specified area of the target object (area for living body detection). Taking the target object being a human object as an example, the video may be a video including a face area, a video including an upper body area, or a video including a hand area, which is not specifically limited in this embodiment.
在活体检测方法应用于服务器时,服务器可以通过与自身连接的其它外部摄像装置采集目标对象的视频,也可以是接收终端设备采集的目标对象的视频。在活体检测方法应用于终端设备时,终端设备可以通过自身内置的摄像装置采集目标对象的视频,也可以通过与自身连接的其它外部摄像装置采集目标对象的视频。When the living body detection method is applied to the server, the server can collect the video of the target object through other external camera devices connected to itself, and can also receive the video of the target object collected by the terminal device. When the living body detection method is applied to the terminal device, the terminal device can collect the video of the target object through its own built-in camera, and can also collect the video of the target object through other external camera connected to itself.
步骤S22:对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息。Step S22: Analyze the video to obtain recording white balance sequence information actually used in the video recording process.
在本实施例中,摄像装置在录制一段视频时,一般使用一个白平衡序列。一个白平衡序列中包含多个白平衡参数,每一个白平衡参数都可用于设置摄像装置的白平衡。In this embodiment, the camera generally uses a white balance sequence when recording a video. A white balance sequence contains multiple white balance parameters, each of which can be used to set the white balance of the camera device.
在步骤S22中对视频进行解析,可以得到视频在录制过程中实际所使用的白平衡序列的序列信息。By analyzing the video in step S22, the sequence information of the white balance sequence actually used in the video recording process can be obtained.
步骤S23:将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,所述目标白平衡序列信息用于指示在所述视频的录制过程中对摄像装置的白平衡参数进行调整。Step S23: Match the recording white balance sequence information with target white balance sequence information, where the target white balance sequence information is used to instruct to adjust the white balance parameters of the camera during the video recording process.
在本实施例中,目标白平衡序列信息是预先指定的用于防伪认证的白平衡序列的序列信息。目标白平衡序列的作用是:在摄像装置录制视频时,指示摄像装置对白平衡参数进行调整。In this embodiment, the target white balance sequence information is sequence information of a pre-designated white balance sequence used for anti-counterfeiting authentication. The purpose of the target white balance sequence is to instruct the camera device to adjust the white balance parameters when the camera device records video.
在得到视频录制过程中实际使用的白平衡序列的序列信息后,将实际使用的白平衡序列的序列信息(录制白平衡序列信息),与预先指定的用于防伪认证的白平衡序列的序列信息(目标白平衡序列信息)进行匹配,得到匹配结果。After obtaining the sequence information of the white balance sequence actually used in the video recording process, compare the sequence information of the actually used white balance sequence (recording white balance sequence information) with the sequence information of the pre-specified white balance sequence used for anti-counterfeiting authentication (target white balance sequence information) for matching to obtain a matching result.
步骤S4:根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。Step S4: Check whether the target object is a living body according to the matching result between the recorded white balance sequence information and the target white balance sequence information.
在本实施例中,根据匹配结果,如果录制白平衡序列信息与目标白平衡序列信息的匹配度大于预设阈值,可以确定目标对象为活体,或者,确定目标对象为活体且视频是合法的,不是摄像装置被非法劫持后拍摄的。如果录制白平衡序列信息与目标白平衡序列信息的匹配度不大于预设阈值,可以确定目标对象活体检测失败,此时可以提示用户重新拍摄视频。In this embodiment, according to the matching result, if the matching degree between the recorded white balance sequence information and the target white balance sequence information is greater than a preset threshold, it can be determined that the target object is a living body, or it is determined that the target object is a living body and the video is legal, It was not filmed after the camera device was illegally hijacked. If the matching degree between the recorded white balance sequence information and the target white balance sequence information is not greater than the preset threshold, it can be determined that the target object living body detection has failed, and the user can be prompted to re-shoot the video.
在一种实施方式中,执行活体检测方法的执行设备本身可以安装用于防伪验证的应用软件(以下简称应用A),该应用软件可以为多个需要进行安全防护的应用软件(以下简称应用B)的活体视频进行合法校验。当用户需要登录应用B时,应用B从应用A处获得目标白平衡序列信息,按照目标白平衡序列信息对摄像装置进行白平衡设置,然后采集用户的视频,再将采集的视频发送至应用A,应用A对视频进行解析,得到在视频的录制过程中实际所使用的录制白平衡序列信息,将录制白平衡序列信息与预先发送给应用B的目标白平衡序列信息进行匹配,如果录制白平衡序列信息与目标白平衡序列信息的匹配度大于预设阈值,可以确定视频包含活体且视频是合法的。如果摄像装置被非法劫持,那么实际录制视频时使用的不是应用A预先发送的目标白平衡序列,最终得到的录制白平衡序列信息与目标白平衡序列信息的匹配度是不大于预设阈值的。In one embodiment, the execution device that executes the liveness detection method may install application software for anti-counterfeiting verification (hereinafter referred to as application A), and the application software may be a plurality of application software requiring security protection (hereinafter referred to as application B). ) for legal verification. When the user needs to log in to application B, application B obtains the target white balance sequence information from application A, sets the white balance of the camera device according to the target white balance sequence information, then captures the user's video, and sends the captured video to application A , Application A parses the video to obtain the recording white balance sequence information actually used in the video recording process, and matches the recording white balance sequence information with the target white balance sequence information sent to Application B in advance. If the matching degree between the sequence information and the target white balance sequence information is greater than the preset threshold, it can be determined that the video contains a living body and the video is legal. If the camera device is illegally hijacked, the target white balance sequence pre-sent by application A is not used when actually recording the video, and the match between the final recorded white balance sequence information and the target white balance sequence information is not greater than the preset threshold.
在一种实施方式中,目标白平衡序列可以是用户预先指定的唯一一个用于防伪认证的白平衡序列。当用户在使用某个应用软件时,如果该应用软件需要对用户进行活体验证,该应用软件可以随机产生一个白平衡序列,然后将该白平衡序列发送至摄像装置,摄像装置按照接收到的白平衡序列信息进行白平衡设置。摄像装置将采集的视频发送至该应用软件,该应用软件对视频进行解析,得到在视频的录制过程中实际所使用的录制白平衡序列信息,如果实际所使用的录制白平衡序列信息不同于预先指定的唯一一个用于防伪认证的白平衡序列,那么可以确定视频是非法的。换言之,即使实际所使用的录制白平衡序列信息与摄像装置接收到的白平衡序列信息一致,只要满足录制白平衡序列信息与目标白平衡序列信息不一致,就可以确定是非法的。例如,家长在使用某些应用软件时,可以预先指定一个用于防伪认证的白平衡序列,如此,儿童并不知道该用于防伪认证的白平衡序列,即使摄像装置没有被非法劫持,也无法通过正常操作使用这些应用软件,例如儿童无法登陆这些应用软件或者进行支付等。In one embodiment, the target white balance sequence may be the only white balance sequence pre-specified by the user for anti-counterfeiting authentication. When a user is using an application software, if the application software needs to verify the user's body, the application software can randomly generate a white balance sequence, and then send the white balance sequence to the camera device. Balance sequence information for white balance settings. The camera device sends the collected video to the application software, and the application software analyzes the video to obtain the recording white balance sequence information actually used in the video recording process. Specify the only white balance sequence for anti-counterfeiting authentication, then it can be determined that the video is illegal. In other words, even if the actually used recording white balance sequence information is consistent with the white balance sequence information received by the imaging device, as long as the recording white balance sequence information is inconsistent with the target white balance sequence information, it can be determined to be illegal. For example, when parents use some application software, they can pre-designate a white balance sequence for anti-counterfeiting authentication. In this way, children do not know the white balance sequence for anti-counterfeiting authentication. Even if the camera device is not illegally hijacked, they cannot Use these applications through normal operations, for example, children cannot log in to these applications or make payments.
通过本申请的活体检测方法,首先获取目标对象的视频,然后对视频进行解析,得到在视频的录制过程中实际所使用的录制白平衡序列信息。接着,将录制白平衡序列信息与目标白平衡序列信息进行匹配,目标白平衡序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整。最后,根据录制白平衡序列信息与目标白平衡序列信息的匹配结果,校验目标对象是否为活体。本申请的活体检测方法具备如下多个效果:With the living body detection method of the present application, the video of the target object is obtained first, and then the video is analyzed to obtain the recording white balance sequence information actually used in the video recording process. Next, the recording white balance sequence information is matched with the target white balance sequence information, and the target white balance sequence information is used to instruct to adjust the white balance parameters of the camera during the video recording process. Finally, according to the matching result of the recorded white balance sequence information and the target white balance sequence information, it is verified whether the target object is a living body. The living body detection method of the present application has the following multiple effects:
一、可检测出目标对象的视频是否是摄像装置被劫持后拍摄的攻击视频。1. It can detect whether the video of the target object is an attack video shot after the camera device was hijacked.
二、本申请的活体检测方法的应用范围更广,一方面,不再对光线的强度有要求(白平衡与光线强度无关),在光线较强的环境中仍能生效,可覆盖用户的各种使用场景;另一方面,不再对设备的保护膜(例如手机膜)的透光性有要求(白平衡与膜的透光性无关),可覆盖用户的各种设备;另一方面,不再需要调亮设备的屏幕(白平衡与屏幕亮度无关),可避免对用户造成晃眼,优化用户的体验。2. The live detection method of the present application has a wider application range. On the one hand, it no longer requires the intensity of light (white balance has nothing to do with the intensity of light), it can still take effect in an environment with strong light, and can cover the user's various On the other hand, there is no longer any requirement for the light transmittance of the protective film of the device (such as mobile phone film) (white balance has nothing to do with the light transmittance of the film), which can cover various devices of the user; on the other hand, It is no longer necessary to brighten the screen of the device (white balance has nothing to do with screen brightness), which can avoid dazzling users and optimize the user experience.
三、本申请的活体检测方法具有较高的检测效率,无需用户花费较长的时间进行交互,同时降低了用户的使用难度,避免个别用户因难度太大而无法完成检测,提高了整体检测率。3. The living body detection method of the present application has high detection efficiency, does not require users to spend a long time to interact, and at the same time reduces the difficulty for users to use, avoids individual users from being unable to complete the detection due to too much difficulty, and improves the overall detection rate .
结合以上实施例,在一种实施方式中,本申请的活体检测方法还可以包括如下步骤:In combination with the above embodiments, in one embodiment, the method for detecting a living body of the present application may further include the following steps:
获取摄像装置所支持的白平衡参数信息;其中,所述白平衡参数信息包括所述白平衡参数所对应的色温信息;根据所述摄像装置所支持的白平衡参数的色温信息,为所述摄像装置生成至少一个待选用白平衡序列;其中,所述待选用白平衡序列供所述摄像装置录制所述目标对象的视频时进行白平衡参数的调整。Obtain white balance parameter information supported by the camera; wherein the white balance parameter information includes color temperature information corresponding to the white balance parameter; according to the color temperature information of the white balance parameter supported by the camera, The device generates at least one to-be-selected white balance sequence; wherein, the to-be-selected white balance sequence is used by the camera device to adjust white balance parameters when recording the video of the target object.
在本实施例中,执行设备可以获取摄像装置所属的设备的系统(任意类型的系统)版本,并根据系统版本获取摄像装置所支持的白平衡参数信息。In this embodiment, the executing device may acquire the system (any type of system) version of the device to which the camera device belongs, and acquire white balance parameter information supported by the camera device according to the system version.
示例地,以摄像装置所属的设备的系统是安卓系统为例,如果系统版本小于5.0(不支持用户主动指定白平衡参数的具体数值),那么摄像装置所支持的白平衡参数信息为:摄像装置支持的白平衡列表(包含多个白平衡参数)、白平衡列表中各个白平衡参数对应的色温信息。如果系统版本不小于5.0(支持用户主动指定白平衡参数的具体数值),那么摄像装置所支持的白平衡参数信息为:摄像装置支持的白平衡参数范围、白平衡参数范围对应的色温范围。其中,每一个白平衡参数与唯一一个色温值对应。For example, taking the system of the device to which the camera device belongs is the Android system as an example, if the system version is less than 5.0 (the specific value of the white balance parameter that the user actively specifies) is not supported, then the white balance parameter information supported by the camera device is: Supported white balance list (including multiple white balance parameters), color temperature information corresponding to each white balance parameter in the white balance list. If the system version is not less than 5.0 (the user can actively specify the specific value of the white balance parameter), then the white balance parameter information supported by the camera device is: the white balance parameter range supported by the camera device and the color temperature range corresponding to the white balance parameter range. Among them, each white balance parameter corresponds to a unique color temperature value.
当然,在实际实施时,还可以通过其它方式获得摄像装置所支持的白平衡参数信息,本实施例对此不作具体限制。Of course, in actual implementation, the white balance parameter information supported by the camera device may also be obtained in other ways, which is not specifically limited in this embodiment.
执行设备在获得摄像装置支持的白平衡参数信息后,为摄像装置生成至少一个待选用白平衡序列。待选用白平衡序列的作用是:在摄像装置录制目标对象的视频时,指示摄像装置对白平衡参数进行调整。After obtaining the white balance parameter information supported by the camera device, the executing device generates at least one white balance sequence to be selected for the camera device. The role of the white balance sequence to be selected is to instruct the camera device to adjust the white balance parameters when the camera device records the video of the target object.
在生成待选用白平衡序列时,对于每一个待选用白平衡序列,相邻两个白平衡参数对应的色温之间的差值可以大于目标阈值,以避免因色温差较小时无法识别视频是否使用了白平衡参数,可提高识别结果的准确度。When generating a white balance sequence to be selected, for each white balance sequence to be selected, the difference between the color temperatures corresponding to two adjacent white balance parameters can be greater than the target threshold, so as to avoid being unable to identify whether the video is used when the color temperature difference is small The white balance parameter is set to improve the accuracy of the recognition result.
本实施例中,可以通过摄像装置所属设备的系统版本获得摄像装置所支持的白平衡参数信息,进而获得用于指导摄像装置在录制视频时进行白平衡参数调整的待选用白平衡序列,为活体检测方法的顺利实施提供了保证。In this embodiment, the white balance parameter information supported by the camera device can be obtained through the system version of the device to which the camera device belongs, and then the white balance sequence to be selected for instructing the camera device to adjust the white balance parameters when recording video can be obtained, which is a living body The smooth implementation of the detection method provides a guarantee.
结合以上实施例,在一种实施方式中,在本申请的活体检测方法应用于服务器时,在获取目标对象的视频之前,该方法还可以包括:In combination with the above embodiments, in an implementation manner, when the liveness detection method of the present application is applied to a server, before acquiring the video of the target object, the method may further include:
将所述至少一个待选用白平衡序列发送给终端设备,由所述终端设备的摄像装置在录制所述视频时根据所述至少一个待选用白平衡序列进行白平衡参数的调整。The at least one to-be-selected white balance sequence is sent to the terminal device, and the camera device of the terminal device adjusts the white balance parameters according to the at least one to-be-selected white balance sequence when recording the video.
相应地,获取目标对象的视频,包括:Accordingly, obtain the video of the target object, including:
接收所述终端设备发送的所述目标对象的视频。The video of the target object sent by the terminal device is received.
在本实施例中,服务器在生成至少一个待选用白平衡序列后,可以将至少一个待选用白平衡序列发送至终端设备。终端设备再从接收的至少一个待选用白平衡序列中确定出一个待选用白平衡序列,并在终端设备的摄像装置录制目标对象的视频的过程中,利用该确定出的待选用白平衡序列对摄像装置进行白平衡参数进行调整。In this embodiment, after generating at least one to-be-selected white balance sequence, the server may send the at least one to-be-selected white balance sequence to the terminal device. The terminal device then determines a white balance sequence to be selected from the received at least one white balance sequence to be selected, and uses the determined white balance sequence to be selected during the process of recording the video of the target object by the camera of the terminal device. The camera device adjusts the white balance parameters.
在本实施例中,服务器在解析终端设备发送的目标对象的视频后,如果发现视频没有使用任何白平衡序列,表示终端设备没有按照服务器预先的要求,使用服务器所给定的白平衡序列来采集目标对象的视频。此时不再继续进行后续流程,服务器可直接向终端设备发送通知消息,以提醒终端设备使用服务器所给定的白平衡序列重新采集目标对象的视频。In this embodiment, after parsing the video of the target object sent by the terminal device, if the server finds that the video does not use any white balance sequence, it means that the terminal device does not use the white balance sequence given by the server to capture the video according to the server's pre-requirements. Video of the target object. At this time, the subsequent process is not continued, and the server may directly send a notification message to the terminal device to remind the terminal device to use the white balance sequence given by the server to re-capture the video of the target object.
在实际实施时,即使终端设备在录制视频时使用到白平衡序列,不一定表示终端设备在录制视频时使用到的是服务器预先给定的白平衡序列,因此录制的视频也可能是不合法的。因此,服务器在接收到终端设备发送的目标对象的视频后,需要检测终端设备实际使用到的录制白平衡序列,是否是预先向其发送的至少一个待选用白平衡序列中的白平衡序列,只有当实际使用到的录制白平衡序列,是预先向其发送的至少一个待选用白平衡序列中的白平衡序列,才能确定录制的视频是合法的,或者确定目标对象为活体。In actual implementation, even if the terminal device uses the white balance sequence when recording video, it does not necessarily mean that the terminal device uses the white balance sequence pre-given by the server when recording video, so the recorded video may also be illegal. . Therefore, after receiving the video of the target object sent by the terminal device, the server needs to detect whether the recorded white balance sequence actually used by the terminal device is a white balance sequence in at least one white balance sequence to be selected sent to it in advance. Only when the actually used recorded white balance sequence is the white balance sequence in at least one to-be-selected white balance sequence sent to it in advance can it be determined that the recorded video is legal, or that the target object is a living body.
在本实施例中,服务器和终端设备之间可以通过预先协商的密钥进行交互,从而保证通信安全。In this embodiment, a pre-negotiated key may be used for interaction between the server and the terminal device, thereby ensuring communication security.
在本实施例中,如果服务器将一个待选用白平衡序列发送给终端设备,那么终端设备将该待选用白平衡序列确定为需要使用的白平衡序列,然后在摄像装置录制目标对象的视频的过程中,利用该待选用白平衡序列中的各个白平衡参数对摄像装置进行白平衡调整。服务器在后续对比时,将接收的视频中实际使用的录制白平衡序列的信息,与预先发送的那个待选用白平衡序列(目标白平衡序列)的信息进行匹配。In this embodiment, if the server sends a to-be-selected white balance sequence to the terminal device, the terminal device determines the to-be-selected white balance sequence as the white balance sequence to be used, and then records the video of the target object on the camera device. , using each white balance parameter in the to-be-selected white balance sequence to adjust the white balance of the imaging device. During subsequent comparison, the server matches the information of the recorded white balance sequence actually used in the received video with the information of the pre-sent white balance sequence to be selected (target white balance sequence).
在本实施例中,如果服务器将多个待选用白平衡序列发送给终端设备,那么终端设备将多个待选用白平衡序列中的任意一个待选用白平衡序列确定为需要使用的白平衡序列,然后在摄像装置录制目标对象的视频的过程中,利用该确定出的需要使用的白平衡序列对摄像装置进行白平衡调整。服务器在后续对比时,将接收的视频中实际使用的录制白平衡序列的信息,与预先发送的多个待选用白平衡序列的信息依次进行匹配,如果有一个匹配成功,表示视频包含活体且合法。In this embodiment, if the server sends multiple to-be-selected white balance sequences to the terminal device, the terminal device determines any one of the multiple to-be-selected white balance sequences as the white balance sequence that needs to be used, Then, in the process of recording the video of the target object by the camera device, the white balance sequence to be used is used to adjust the white balance of the camera device. In the subsequent comparison, the server matches the information of the recorded white balance sequence actually used in the received video with the information of multiple pre-sent white balance sequences to be selected in turn. If one match is successful, it means that the video contains a living body and is legal .
示例地,用户A在通过网络从银行卡转账时,银行的后台服务器提示用户进行人脸视频认证。用户终端获得后台服务器发送的多个待选用白平衡序列,在多个待选用白平衡序列中确定出一个需要使用的白平衡序列,并在利用摄像装置采集用户A的人脸视频时,按照确定出的需要使用的白平衡序列中的各个白平衡参数对摄像装置进行白平衡调整,得到录制的人脸视频。接着,用户终端将人脸视频发送至服务器。服务器接收到人脸视频后,对人脸视频进行解析,获得人脸视频实际使用的录制白平衡序列的信息,将录制白平衡序列的信息,与预先发送的多个待选用白平衡序列的信息依次进行匹配,如果有一个匹配成功,表示视频是合法的,不是攻击视频,允许用户继续进行后续操作。For example, when user A transfers money from a bank card through the network, the backend server of the bank prompts the user to perform face video authentication. The user terminal obtains a plurality of white balance sequences to be used sent by the background server, determines a white balance sequence to be used among the plurality of white balance sequences to be used, and uses the camera to collect the face video of user A, according to the determination Each white balance parameter in the white balance sequence to be used is obtained to adjust the white balance of the camera device to obtain a recorded face video. Next, the user terminal sends the face video to the server. After receiving the face video, the server parses the face video to obtain the information of the recorded white balance sequence actually used in the face video, and compares the information of the recorded white balance sequence with the information of the multiple pre-sent white balance sequences to be selected. Matches are performed in sequence. If one match is successful, it means that the video is legal, not an attack video, allowing the user to continue with subsequent operations.
在本实施例中,如果终端设备的系统是安卓系统,在系统版本小于5.0(不支持用户主动指定白平衡参数的具体数值)时,终端设备将系统API camera1的信息、当前设备支持的白平衡列表(包含多个白平衡参数)以及白平衡列表中各个白平衡参数对应的色温值作为摄像装置所支持的白平衡参数信息发送到服务器。In this embodiment, if the system of the terminal device is the Android system, when the system version is less than 5.0 (the specific value of the white balance parameter cannot be actively specified by the user), the terminal device will use the information of the system API camera1 and the white balance supported by the current device. The list (including multiple white balance parameters) and the color temperature values corresponding to each white balance parameter in the white balance list are sent to the server as white balance parameter information supported by the camera device.
在系统版本不小于5.0(支持用户主动指定白平衡参数的具体数值)时,终端设备将系统API camera2的信息、当前设备支持的白平衡参数范围以及白平衡参数范围对应的色温范围作为摄像装置所支持的白平衡参数信息发送到服务器。When the system version is not less than 5.0 (which supports the user to actively specify the specific value of the white balance parameter), the terminal device uses the system API camera2 information, the white balance parameter range supported by the current device, and the color temperature range corresponding to the white balance parameter range as the camera device. The supported white balance parameter information is sent to the server.
服务器在接收到摄像装置所支持的白平衡参数信息后,根据这些信息生成至少一个待选用白平衡序列,具体可参照前文所述。在本实施例中,可以由终端设备向服务器发起活体检测请求,由服务器处理活体检测请求,使得本申请的活体检测方法可以适用于任意服务器与终端设备交互的场景,扩展了活体检测方法的应用范围。After receiving the white balance parameter information supported by the camera device, the server generates at least one white balance sequence to be selected according to the information. For details, refer to the foregoing description. In this embodiment, a terminal device can initiate a liveness detection request to the server, and the server processes the liveness detection request, so that the liveness detection method of the present application can be applied to any scene of interaction between a server and a terminal device, and the application of the liveness detection method is expanded. scope.
结合以上实施例,在一种实施方式中,如果服务器向终端设备发送的待选用白平衡序列的数量是多个,在将所述录制白平衡序列信息与目标白平衡序列信息进行匹配之前,本申请的活体检测方法还可以包括:In combination with the above embodiments, in an implementation manner, if the number of white balance sequences to be selected sent by the server to the terminal device is multiple, before matching the recorded white balance sequence information with the target white balance sequence information, this The applied biometric method may also include:
接收所述终端设备发送的其录制所述目标对象的视频时所使用的待选用白平衡序列,并将其作为所述目标白平衡序列。The to-be-selected white balance sequence sent by the terminal device when recording the video of the target object is received, and used as the target white balance sequence.
在本实施例中,服务器将多个待选用白平衡序列发送给终端设备,终端设备会在多个待选用白平衡序列中选择任意一个待选用白平衡序列作为实际需要使用的白平衡序列。服务器在后续对比时,如果将接收的视频中实际使用的录制白平衡序列的信息,与预先发送的多个待选用白平衡序列的信息依次进行匹配,那么将会花费大量时间,导致活体检测效率低。In this embodiment, the server sends multiple to-be-selected white balance sequences to the terminal device, and the terminal device selects any one of the multiple to-be-selected white balance sequences as the actual white balance sequence to be used. In the subsequent comparison, if the server matches the information of the recorded white balance sequence actually used in the received video with the information of multiple pre-sent white balance sequences to be selected in turn, it will take a lot of time, resulting in the efficiency of living body detection. Low.
实际上,终端设备确定出的实际需要使用的白平衡序列就是目标白平衡序列。因此,如果终端设备在录制完成视频后,将该确定出的实际需要使用的白平衡序列发送给服务器,那么服务器可直接将该接收到的白平衡序列作为目标白平衡序列,再将该目标白平衡序列的信息与视频中使用的录制白平衡序列的信息进行匹配,将会大大降低匹配时间,提升活体检测效率。In fact, the actual white balance sequence that needs to be used determined by the terminal device is the target white balance sequence. Therefore, if the terminal device sends the determined white balance sequence that actually needs to be used to the server after recording the video, the server can directly use the received white balance sequence as the target white balance sequence, and then use the target white balance sequence as the target white balance sequence. Matching the information of the balance sequence with the information of the recorded white balance sequence used in the video will greatly reduce the matching time and improve the efficiency of live detection.
在本实施例中,服务器可直接将终端设备发送的其录制目标对象的视频时所使用的待选用白平衡序列作为目标白平衡序列,可显著提升活体检测效率。In this embodiment, the server can directly use the white balance sequence to be used when recording the video of the target object sent by the terminal device as the target white balance sequence, which can significantly improve the living body detection efficiency.
结合以上实施例,在一种实施方式中,对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,具体可以包括:In combination with the above embodiments, in an implementation manner, the video is parsed to obtain the recording white balance sequence information actually used in the recording process of the video, which may specifically include:
从所述视频中抽取多个视频帧;extracting a plurality of video frames from the video;
根据每个所述视频帧上的目标像素点的颜色值,得到录制白平衡序列对应的色温变化信息;其中,所述目标像素点为所述视频帧的全部像素点或者所述目标像素点为所述视频帧的目标区域内的像素点;所述目标区域为用于进行活体检测的区域。According to the color value of the target pixel on each of the video frames, the color temperature change information corresponding to the recording white balance sequence is obtained; wherein, the target pixel is all the pixels of the video frame or the target pixel is The pixel points in the target area of the video frame; the target area is an area used for living body detection.
在本实施例中,执行设备首先将视频解成单帧。针对每一个视频帧,提取其中的目标像素的颜色值(例如RGB值),再根据颜色值计算出一个对应的色温值。如此,多个视频帧可以计算得到多个色温值,按照顺序可以将多个色温值绘制成视频的色温变化曲线(即录制白平衡序列对应的色温变化信息)。In this embodiment, the execution device first decomposes the video into single frames. For each video frame, the color value (eg, RGB value) of the target pixel is extracted, and then a corresponding color temperature value is calculated according to the color value. In this way, a plurality of video frames can be calculated to obtain a plurality of color temperature values, and the plurality of color temperature values can be drawn into a video color temperature change curve in sequence (that is, the color temperature change information corresponding to the recording white balance sequence).
在此基础上,将所述录制白平衡序列对应的色温变化信息,与所述目标白平衡序列对应的色温变化信息进行匹配,可以包括:On this basis, matching the color temperature change information corresponding to the recorded white balance sequence with the color temperature change information corresponding to the target white balance sequence may include:
将所述录制白平衡序列对应的色温变化信息,与目标白平衡序列对应的色温变化信息进行匹配。在本实施例中,一个白平衡参数唯一对应一个色温值,因此,根据目标白平衡序列中的每一个白平衡参数,可以绘制得到目标白平衡序列对应的色温变化曲线。Match the color temperature change information corresponding to the recording white balance sequence with the color temperature change information corresponding to the target white balance sequence. In this embodiment, one white balance parameter uniquely corresponds to one color temperature value. Therefore, according to each white balance parameter in the target white balance sequence, a color temperature change curve corresponding to the target white balance sequence can be drawn.
接着,将录制白平衡序列对应的色温变化曲线,与目标白平衡序列对应的色温变化曲线做相似度对比,如果相似度大于预设阈值,表示录制白平衡序列与目标白平衡序列匹配,进而表示录制白平衡序列信息与目标白平衡序列信息匹配。Next, compare the color temperature change curve corresponding to the recorded white balance sequence with the color temperature change curve corresponding to the target white balance sequence. If the similarity is greater than the preset threshold, it means that the recorded white balance sequence matches the target white balance sequence, and then indicates that The recording white balance sequence information matches the target white balance sequence information.
其中,目标像素点可以是视频帧的全部像素点,也可以是视频帧的目标区域内的像素点。目标区域是指用于进行活体检测的区域。在实际实施时,可以根据实际需求定义目标像素点,本实施例对此不作具体限制。在本实施例中,根据录制白平衡序列对应的色温变化信息,与目标白平衡序列对应的色温变化信息之间的相似度来检测终端设备录制的视频是否合法,可快速且准确地检测出视频是否是真实拍摄、而非劫持注入的。结合以上实施例,在一种实施方式中,目标区域可以是目标对象的脸部区域或者掌部区域。在此基础上,根据每个所述视频帧上的目标像素点的颜色值,得到录制白平衡序列对应的色温变化信息,具体可以包括:The target pixels may be all pixels of the video frame, or may be pixels in the target area of the video frame. The target area refers to an area for performing liveness detection. In actual implementation, the target pixel point may be defined according to actual requirements, which is not specifically limited in this embodiment. In this embodiment, whether the video recorded by the terminal device is legal is detected according to the similarity between the color temperature change information corresponding to the recorded white balance sequence and the color temperature change information corresponding to the target white balance sequence, and the video can be quickly and accurately detected. Whether it is real filming, not hijacked injection. In combination with the above embodiments, in an implementation manner, the target area may be the face area or the palm area of the target object. On this basis, according to the color value of the target pixel on each of the video frames, the color temperature change information corresponding to the recording white balance sequence is obtained, which may specifically include:
根据每个所述视频帧上目标对象的脸部区域内的像素点的颜色值,得到录制白平衡序列对应的色温变化信息;或者Obtain the color temperature change information corresponding to the recorded white balance sequence according to the color value of the pixel in the face area of the target object on each of the video frames; or
根据每个所述视频帧上目标对象的掌部区域内的像素点的颜色值,得到录制白平衡序列对应的色温变化信息。According to the color values of the pixels in the palm area of the target object on each of the video frames, the color temperature change information corresponding to the recorded white balance sequence is obtained.
在一些应用场景中,用户在登录某些账号时,需要对用户进行活体检测时,且必须是对用户本人(该账号所属的用户)进行活体检测,而不能是对其他人进行活体检测。例如进行支付时,进行活体检测的用户必须是支付账户所属的用户,不能是其它任意用户。在这种场景下,除了需要检测录制白平衡序列信息是否与目标白平衡序列信息匹配,还需要检测视频中的人物对象是否是用户本人。这就要求目标对象的视频中必须包含目标对象的标识性特征,例如脸部特征、眼部特征、掌纹特征等。In some application scenarios, when a user logs in to certain accounts, when the user needs to perform liveness detection on the user, the liveness detection must be performed on the user himself (the user to which the account belongs), but not on other people. For example, when making a payment, the user who performs the live detection must be the user to which the payment account belongs, and cannot be any other user. In this scenario, in addition to detecting whether the recorded white balance sequence information matches the target white balance sequence information, it is also necessary to detect whether the human object in the video is the user himself. This requires that the video of the target object must contain the identifying features of the target object, such as facial features, eye features, palm print features, etc.
因此,为实现该场景下的活体检测,可以将目标区域设置为脸部区域或者掌部区域。如此,在根据每个视频帧上的目标像素点的颜色值得到录制白平衡序列对应的色温变化信息时,既可以根据每个视频帧上目标对象的脸部区域内的像素点的颜色值得到录制白平衡序列对应的色温变化信息,也可以根据每个视频帧上目标对象的掌部区域内的像素点的颜色值得到录制白平衡序列对应的色温变化信息。Therefore, in order to realize the living body detection in this scene, the target area can be set as the face area or the palm area. In this way, when obtaining the color temperature change information corresponding to the recording white balance sequence according to the color value of the target pixel on each video frame, it can be obtained according to the color value of the pixel in the face area of the target object on each video frame. The color temperature change information corresponding to the recorded white balance sequence can also be obtained according to the color values of the pixels in the palm area of the target object on each video frame to obtain the color temperature change information corresponding to the recorded white balance sequence.
通过本实施例,可在对用户的身份要求较严格的活体检测场景中实现对用户的活体检测,扩大了本申请的活体检测方法的适用范围。With this embodiment, the user's living body detection can be implemented in a living body detection scenario that has stricter requirements on the user's identity, thereby expanding the scope of application of the living body detection method of the present application.
结合以上实施例,在一种实施方式中,在目标像素点为视频帧的目标区域内的像素点时,可以通过以下方式获得每个视频帧上的目标像素点的颜色值:In combination with the above embodiments, in one embodiment, when the target pixel is a pixel in the target area of the video frame, the color value of the target pixel on each video frame can be obtained in the following manner:
对所述多个视频帧中的每个视频帧进行关键点检测;performing keypoint detection on each of the plurality of video frames;
根据关键点检测结果,从所述多个视频帧中的每个视频帧上框选目标区域;According to the key point detection result, frame-select the target area from each video frame in the plurality of video frames;
提取所述多个视频帧中每个视频帧上框选的目标区域内的各个像素的颜色值。Extracting the color value of each pixel in the frame-selected target area on each of the plurality of video frames.
在本实施例中,关键点可以是人脸的五官点,目标区域可以是人脸区域。In this embodiment, the key points may be facial features of a human face, and the target area may be a human face area.
在具体实施时,可以只提取视频帧中人脸区域的各个像素的颜色值,并计算人脸区域对应的色温值,从而避免背景变化时造成的影响(例如背景中色温的变化不是由于白平衡设置导致的,或者背景中无法识别出色温的变化,最终会影响检测精准度)。In specific implementation, only the color value of each pixel of the face area in the video frame can be extracted, and the color temperature value corresponding to the face area can be calculated, so as to avoid the influence caused by the change of the background (for example, the change of the color temperature in the background is not due to the white balance caused by the setting, or the change of color temperature cannot be recognized in the background, which will eventually affect the detection accuracy).
在具体实施时,可以采用任意的关键点检测手段及目标区域识别手段,本实施例对此不作具体限制。During specific implementation, any key point detection means and target area identification means may be adopted, which are not specifically limited in this embodiment.
本实施例中,在提取每个视频帧上的多个像素的颜色值时,可以只提取目标区域(例如人脸区域)内的多个像素点的颜色值,从而避免背景变化时造成的影响,提升检测结果的精准度。In this embodiment, when extracting the color values of multiple pixels on each video frame, only the color values of multiple pixels in the target area (for example, the face area) can be extracted, so as to avoid the influence caused by the background change , to improve the accuracy of detection results.
结合以上实施例,在一种实施方式中,在获取目标对象的视频之前,本申请的活体检测方法还可以包括:With reference to the above embodiments, in an implementation manner, before acquiring the video of the target object, the method for detecting a living body of the present application may further include:
每当接收到活体检测请求时,从所述至少一个待选用白平衡序列中确定出一个待选用白平衡序列;determining a white balance sequence to be selected from the at least one white balance sequence to be selected whenever a living body detection request is received;
将确定的待选用白平衡序列作为摄像装置录制所述视频所使用的目标白平衡序列,其中,相邻两次确定出的两个待选用白平衡序列不同。The determined to-be-selected white balance sequence is used as the target white balance sequence used by the camera device to record the video, wherein the two to-be-selected white balance sequences determined in two adjacent times are different.
在本实施例中,服务器可以预先生成至少一个待选用白平衡序列,并在每次接收到活体检测请求时,从至少一个待选用白平衡序列中确定出一个待选用白平衡序列,该确定的一个待选用白平衡序列为响应于当次活体检测请求而即将使用的白平衡序列。In this embodiment, the server may generate at least one to-be-selected white balance sequence in advance, and each time a living body detection request is received, determine a to-be-selected white balance sequence from the at least one to-be-selected white balance sequence, and the determined A candidate white balance sequence is the white balance sequence to be used in response to the current liveness detection request.
在实际实施时,在从至少一个待选用白平衡序列中确定出一个待选用白平衡序列并不是任意确定的,需要满足相邻两次确定出的两个待选用白平衡序列不同,从而防止非法分子伪造白平衡序列。In actual implementation, it is not arbitrary to determine a white balance sequence to be selected from at least one white balance sequence to be selected. Molecular fake white balance sequence.
执行设备在至少一个待选用白平衡序列中确定出的那个待选用白平衡序列,即目标白平衡序列。The to-be-selected white balance sequence determined by the execution device in the at least one to-be-selected white balance sequence, that is, the target white balance sequence.
以服务器处理终端设备发送的活体检测请求为例,服务器在接收到终端设备发送的活体检测请求时,可以向终端设备发送第一待选用白平衡序列,使得终端设备在利用摄像装置录制视频时,使用第一待选用白平衡序列中的白平衡参数对摄像装置进行白平衡设置摄像装置。服务器在接收到终端设备发送的新的活体检测请求时,可以向终端设备发送摄像装置第二待选用白平衡序列,使得终端设备在利用摄像装置录制视频时,使用第二待选用白平衡序列中的白平衡参数对摄像装置进行白平衡设置。其中,第一待选用白平衡序列和第二待选用白平衡序列均是服务器预先生成的待选用白平衡序列。且第一待选用白平衡序列不同于第二待选用白平衡序列。Taking the server processing the liveness detection request sent by the terminal device as an example, when the server receives the liveness detection request sent by the terminal device, it can send the first white balance sequence to be selected to the terminal device, so that when the terminal device uses the camera to record the video, Using the white balance parameters in the first to-be-selected white balance sequence, perform a white balance setting on the camera device for the camera device. When receiving a new living body detection request sent by the terminal device, the server may send the second to-be-selected white balance sequence of the camera to the terminal device, so that the terminal device uses the second to-be-selected white balance sequence when recording video with the camera device. Set the white balance of the camera device with the white balance parameter. The first to-be-selected white balance sequence and the second to-be-selected white balance sequence are both the to-be-selected white balance sequences pre-generated by the server. And the first white balance sequence to be selected is different from the second white balance sequence to be selected.
在本实施例中,摄像装置在录制一次活体视频时只能使用一个白平衡序列,如果某次录制活体视频失败,那么丢弃该次录制的视频和使用的白平衡序列(第一待选用白平衡序列),再次使用一个新的白平衡序列(第二待选用白平衡序列),防止攻击者劫持摄像装置并使用历史发送的白平衡序列进行视频录制。通过该种方式,服务器在每一次接收到终端设备发送的活体检测请求时都向其发送一个新的待选用白平衡序列,而历史发送的待选用白平衡序列都将做失效处理,可防止攻击者劫持摄像装置并使用历史发送过的待选用白平衡序列进行视频录制。In this embodiment, the camera device can only use one white balance sequence when recording a live video. If a live video recording fails, the video recorded this time and the white balance sequence used (the first white balance to be selected) are discarded. sequence), again using a new white balance sequence (the second candidate white balance sequence) to prevent an attacker from hijacking the camera and using the historically sent white balance sequence for video recording. In this way, the server sends a new white balance sequence to be selected each time it receives a live detection request sent by the terminal device, and the previously sent white balance sequences to be selected will be invalidated, which can prevent attacks The attacker hijacks the camera and uses the historically sent white balance sequence to record video.
在终端设备向服务器发送活体检测请求时,服务器将确定出的目标白平衡序列发送至终端设备,使得终端设备在录制目标对象的视频的过程中,使用目标白平衡序列中的各个白平衡参数对摄像装置进行白平衡参数设置。而后续服务器在对终端设备发送的视频进行分析时,可直接将视频中实际使用的录制白平衡序列的信息,与目标白平衡序列的信息进行匹配。通过该方式,服务器既不用将视频中实际使用的录制白平衡序列的信息与预先生成的每一个待选用白平衡序列的信息进行对比,提高了活体检测效率,也不用根据终端设备发送的白平衡序列来确定目标白平衡序列,可防止终端设备发送伪造的目标白平衡序列,保障了活体检测的顺利实施。在本实施例中,执行设备在每次接收到活体检测请求时,从预先生成的至少一个待选用白平衡序列确定出一个待选用白平衡序列,且该待选用白平衡序列不同于上一次响应活体检测请求而确定出的待选用白平衡序列,可防止攻击者劫持摄像装置并使用历史发送过的待选用白平衡序列进行视频录制,进而保障活体检测方法的有效实施。When the terminal device sends a living body detection request to the server, the server sends the determined target white balance sequence to the terminal device, so that the terminal device uses each white balance parameter in the target white balance sequence to match the target white balance sequence in the process of recording the video of the target object. The camera device performs white balance parameter setting. When the subsequent server analyzes the video sent by the terminal device, it can directly match the information of the recorded white balance sequence actually used in the video with the information of the target white balance sequence. In this way, the server does not need to compare the information of the recorded white balance sequence actually used in the video with the information of each pre-generated white balance sequence to be selected, which improves the living body detection efficiency, and does not need to use the white balance sequence sent by the terminal device. The target white balance sequence is determined by the sequence, which can prevent the terminal device from sending a fake target white balance sequence and ensure the smooth implementation of the living body detection. In this embodiment, each time the execution device receives a living body detection request, it determines a to-be-selected white balance sequence from at least one pre-generated to-be-selected white balance sequence, and the to-be-selected white balance sequence is different from the last response The to-be-selected white balance sequence determined by the living body detection request can prevent attackers from hijacking the camera device and use the historically sent to-be-selected white balance sequence for video recording, thereby ensuring the effective implementation of the living body detection method.
针对服务器处理终端设备发起的活体检测请求的场景,本申请还提供了一种活体检测方法,应用于图1中的终端设备,具体应用于终端设备中的SDK。图3是本申请一实施例示出的另一种活体检测方法的流程图。参照图3,本申请的活体检测方法可以包括如下步骤:For the scenario where the server processes a liveness detection request initiated by a terminal device, the present application further provides a liveness detection method, which is applied to the terminal device in FIG. 1 , and is specifically applied to the SDK in the terminal device. FIG. 3 is a flowchart of another method for detecting a living body according to an embodiment of the present application. Referring to FIG. 3 , the method for detecting a living body of the present application may include the following steps:
步骤S31:响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整。Step S31: In response to a request for in vivo detection of the target object, obtain target white balance sequence information from the server; wherein the target white balance parameter sequence information is used to indicate the white balance of the camera during the video recording process parameters are adjusted.
步骤S32:控制所述摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制。Step S32: Control the camera to record video on the target object according to the instruction of the target white balance sequence information.
步骤S33:将录制的所述目标对象的视频发送给所述服务器,由所述服务器对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,并将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据匹配结果确定所述目标对象是否是活体。Step S33: Send the recorded video of the target object to the server, and the server parses the video to obtain the recording white balance sequence information actually used in the recording process of the video, and converts the recorded white balance sequence information to the server. The recorded white balance sequence information is matched with the target white balance sequence information, and whether the target object is a living body is determined according to the matching result.
在本实施例中,活体检测请求既可以是用户通过终端设备触发的,也可以是服务器向终端设备发送的。In this embodiment, the living body detection request may be triggered by the user through the terminal device, or may be sent by the server to the terminal device.
在触发活体检测请求后,服务器会向终端设备发送目标白平衡序列信息,使得终端设备在录制目标对象的视频的过程中,根据目标白平衡序列中的各个白平衡参数对摄像装置进行白平衡设置。After triggering the living body detection request, the server will send the target white balance sequence information to the terminal device, so that the terminal device can set the white balance of the camera according to each white balance parameter in the target white balance sequence during the process of recording the video of the target object. .
摄像装置示例地,用户在登录某个应用程序时需要进行人脸验证,该应用的后台服务器主动向用户所在的终端设备发送活体检测指令,同时将目标白平衡序列发送给终端设备。终端设备在录制用户的人脸视频的过程中,利用目标白平衡序列中的各个白平衡参数对摄像装置进行白平衡设置。For example, in a camera device, a user needs to perform face verification when logging into an application, and the background server of the application actively sends a living body detection instruction to the terminal device where the user is located, and simultaneously sends the target white balance sequence to the terminal device. During the process of recording the user's face video, the terminal device uses each white balance parameter in the target white balance sequence to set the white balance of the camera device.
终端设备在完成人脸视频的录制后,将录制的人脸视频发送给服务器,使服务器验证视频是否合法。服务器验证视频的过程具体可参见前文所述。After completing the recording of the face video, the terminal device sends the recorded face video to the server, so that the server can verify whether the video is legal. For details about the process of the server verifying the video, please refer to the previous section.
通过本申请的活体检测方法,终端设备响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息;其中,目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整。接着,终端设备控制摄像装置按照目标白平衡序列信息的指示对目标对象进行视频录制;然后将录制的目标对象的视频发送给服务器。服务器对视频进行解析,得到在视频的录制过程中实际所使用的录制白平衡序列信息,并将录制白平衡序列信息与目标白平衡序列信息进行匹配,根据匹配结果确定目标对象是否是活体。With the living body detection method of the present application, the terminal device obtains target white balance sequence information from a server in response to a living body detection request for performing living body detection on a target object; wherein, the target white balance parameter sequence information is used to indicate the Adjust the white balance parameters of the camera. Next, the terminal device controls the camera to record the video of the target object according to the instruction of the target white balance sequence information; and then sends the recorded video of the target object to the server. The server analyzes the video, obtains the recording white balance sequence information actually used in the video recording process, matches the recording white balance sequence information with the target white balance sequence information, and determines whether the target object is a living body according to the matching result.
一、可检测出目标对象的视频是否是摄像装置被劫持后拍摄的攻击视频。1. It can detect whether the video of the target object is an attack video shot after the camera device was hijacked.
二、本申请的活体检测方法的应用范围更广,一方面,不再对光线的强度有要求(白平衡与光线强度无关),在光线较强的环境中仍能生效,可覆盖用户的各种使用场景;另一方面,不再对设备的保护膜(例如手机膜)的透光性有要求(白平衡与膜的透光性无关),可覆盖用户的各种设备;另一方面,不再需要调亮设备的屏幕(白平衡与屏幕亮度无关),可避免对用户造成晃眼,优化用户的体验。2. The live detection method of the present application has a wider application range. On the one hand, it no longer requires the intensity of light (white balance has nothing to do with the intensity of light), it can still take effect in an environment with strong light, and can cover the user's various On the other hand, there is no longer any requirement for the light transmittance of the protective film of the device (such as mobile phone film) (white balance has nothing to do with the light transmittance of the film), which can cover various devices of the user; on the other hand, It is no longer necessary to brighten the screen of the device (white balance has nothing to do with screen brightness), which can avoid dazzling users and optimize the user experience.
三、本申请的活体检测方法具有较高的检测效率,无需用户花费较长的时间进行交互,同时降低了用户的使用难度,避免个别用户因难度太大而无法完成检测,提高了整体检测率。3. The living body detection method of the present application has high detection efficiency, does not require users to spend a long time to interact, and at the same time reduces the difficulty for users to use, avoids individual users from being unable to complete the detection due to too much difficulty, and improves the overall detection rate .
结合以上实施例,在一种实施方式中,所述控制所述摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制,可以包括:With reference to the above embodiments, in an implementation manner, the controlling the camera device to perform video recording of the target object according to the instruction of the target white balance sequence information may include:
响应于所述活体检测请求,每隔目标时长从目标白平衡序列中顺次提取一个白平衡参数;控制所述摄像装置按照所提取的一个白平衡参数进行单帧视频或连续多帧视频的录制。In response to the living body detection request, a white balance parameter is sequentially extracted from the target white balance sequence every target duration; the camera device is controlled to record a single-frame video or a continuous multi-frame video according to the extracted white balance parameter .
在本实施例中,一个白平衡序列中包含多个白平衡参数,由于摄像装置在同一时刻只支持设置一个白平衡参数,因此,本实施例中每隔目标时长,从目标白平衡序列中顺次提取下一个未使用的白平衡参数,并据此对摄像装置的白平衡进行设置,然后在目标时长内按照新设置的白平衡参数,进行连续多帧视频的录制。In this embodiment, a white balance sequence includes multiple white balance parameters. Since the camera device only supports setting one white balance parameter at the same time, in this embodiment, every target time period is selected from the target white balance sequence in order. Extract the next unused white balance parameter, and set the white balance of the camera device accordingly, and then perform continuous multi-frame video recording within the target duration according to the newly set white balance parameter.
示例地,服务器预先发送的目标白平衡序列为:S1、S2、S3、……、Sn,目标时长为2秒,那么用户终端首先在t0时刻按照S1设置摄像装置的白平衡,然后在t0-(t0+2S)之间采集录制视频,接着,终端设备在(t0+2S)时刻按照S2设置摄像装置的白平衡,然后在(t0+2S)-(t0+4S)之间采集录制视频,以此类推,直到采集完预设时长的视频。在本实施例中,还可以每隔目标时长,从目标白平衡序列中顺次提取下一个未使用的白平衡参数,并据此对摄像装置的白平衡进行设置,然后按照新设置的白平衡参数进行单个帧视频的录制。For example, the target white balance sequence sent by the server in advance is: S1, S2, S3, ..., Sn, and the target duration is 2 seconds, then the user terminal first sets the white balance of the camera according to S1 at time t0, and then at t0- Capture and record video between (t0+2S), then, the terminal device sets the white balance of the camera according to S2 at (t0+2S) time, and then captures and records video between (t0+2S)-(t0+4S), And so on, until the video of the preset duration is captured. In this embodiment, it is also possible to sequentially extract the next unused white balance parameter from the target white balance sequence every target duration, and set the white balance of the camera device accordingly, and then set the white balance according to the newly set white balance. parameters to record a single frame of video.
示例地,服务器预先发送的目标白平衡序列为:S1、S2、S3、……、Sn,目标时长为2秒,那么用户终端首先在t0时刻按照S1设置摄像装置的白平衡,然后在t0时刻采集一个视频帧,采集完该视频帧后恢复摄像装置的白平衡至设置前的状态。接着,用户终端在(t0+2S)时刻按照S2设置摄像装置的白平衡,然后在(t0+2S)时刻采集一个视频帧,采集完该视频帧后恢复摄像装置的白平衡至设置前的状态。以此类推,直到采集完预设时长的视频。For example, the target white balance sequence sent by the server in advance is: S1, S2, S3, ..., Sn, and the target duration is 2 seconds, then the user terminal first sets the white balance of the camera according to S1 at time t0, and then at time t0 Collect a video frame, and restore the white balance of the camera device to the state before setting after the video frame is collected. Next, the user terminal sets the white balance of the camera device according to S2 at time (t0+2S), then collects a video frame at time (t0+2S), and restores the white balance of the camera device to the state before setting after collecting the video frame. . And so on, until the video of the preset duration is captured.
在本实施例中,还可以每隔N个视频帧,从目标白平衡序列中顺次提取下一个未使用的白平衡参数,并据此对摄像装置进行设置,然后按照新设置的白平衡参数进行连续多帧视频的录制。In this embodiment, it is also possible to sequentially extract the next unused white balance parameter from the target white balance sequence every N video frames, and set the camera device accordingly, and then set the white balance parameter according to the newly set white balance parameter. Record continuous multi-frame video.
示例地,服务器预先发送的目标白平衡序列为:S1、S2、S3、……、Sn,终端设备首先按照S1设置摄像装置的白平衡,然后采集第1个-第5个视频帧,接着,在采集完第5帧视频后,终端设备按照S2设置摄像装置的白平衡,然后采集第6个-第10个视频帧,以此类推,直到采集完预设时长的视频。For example, the target white balance sequence sent by the server in advance is: S1, S2, S3, ..., Sn. The terminal device first sets the white balance of the camera according to S1, and then collects the first to fifth video frames, and then, After the 5th frame of video is collected, the terminal device sets the white balance of the camera according to S2, and then collects the 6th to 10th video frames, and so on, until the video of the preset duration is collected.
在本实施例中,在每次使用一个白平衡序列时,不一定用完该白平衡序列中的所有的白平衡参数,只要录制到预设时长的视频即可。如果在录制到预设时长的视频之前该白平衡序列中的所有的白平衡参数已经用完,那么既可以使用另一个新的白平衡序列中的白平衡参数,也可以不再使用白平衡参数,或者再次重头使用该白平衡序列中的白平衡参数。In this embodiment, each time a white balance sequence is used, it is not necessary to use up all the white balance parameters in the white balance sequence, as long as a video of a preset duration is recorded. If all the white balance parameters in the white balance sequence have been used up before recording the video of the preset length, you can either use the white balance parameters in another new white balance sequence, or you can no longer use the white balance parameters , or start over again with the white balance parameters in the white balance sequence.
在本实施例中,每隔目标时长从目标白平衡序列中顺次提取一个白平衡参数,并控制摄像装置按照所提取的一个白平衡参数进行单帧视频或连续多帧视频的录制,可以使服务器更好地识别到录制的视频中所使用到的白平衡参数(例如一个白平衡参数仅在很短的时间内使用时可能无法被服务器精准识别出),从而提升服务器的活体检测的准确度。In this embodiment, a white balance parameter is sequentially extracted from the target white balance sequence every target duration, and the camera is controlled to record a single-frame video or continuous multi-frame video according to the extracted white balance parameter, so that the The server can better identify the white balance parameters used in the recorded video (for example, a white balance parameter may not be accurately identified by the server when it is only used for a short period of time), thereby improving the accuracy of the server's liveness detection .
结合以上实施例,在一种实施方式中,在控制摄像装置按照目标白平衡序列信息的指示对所述目标对象进行视频录制期间,本申请的活体检测方法还可以包括如下步骤:In combination with the above embodiments, in an implementation manner, during the control of the camera device to perform video recording of the target object according to the instruction of the target white balance sequence information, the living body detection method of the present application may further include the following steps:
检测所述摄像装置录制的每一视频帧的质量参数是否符合目标质量参数;在检测到所述摄像装置录制的一个视频帧的质量参数不符合所述目标质量参数时,控制所述摄像装置停止视频录制,丢弃已录制视频;以及,从所述服务器获取新的目标白平衡序列信息。Detecting whether the quality parameter of each video frame recorded by the camera device meets the target quality parameter; when detecting that the quality parameter of a video frame recorded by the camera device does not meet the target quality parameter, controlling the camera device to stop video recording, discarding the recorded video; and acquiring new target white balance sequence information from the server.
在此基础上,控制所述摄像装置按照所提取的一个白平衡参数进行单帧视频或连续多帧视频的录制,包括:On this basis, controlling the camera device to record a single-frame video or continuous multi-frame video according to an extracted white balance parameter, including:
控制所述摄像装置按照新的目标白平衡序列信息的指示重新录制所述目标对象的视频。The camera is controlled to re-record the video of the target object according to the instruction of the new target white balance sequence information.
在本实施例中,终端设备会实时检测摄像装置录制的每一帧视频的质量参数是否符合目标质量参数,如果符合,才会保留该帧视频数据,只要检测到摄像装置录制的一个视频帧的质量参数不符合目标质量参数,终端设备会停止录制视频,丢弃已录制的视频,并按照服务器发送的另一个目标白平衡序列重新进行视频录制。In this embodiment, the terminal device will detect in real time whether the quality parameters of each frame of video recorded by the camera device meet the target quality parameters, and if so, will retain the frame of video data, as long as it detects the quality of a video frame recorded by the camera device. If the quality parameter does not meet the target quality parameter, the terminal device will stop recording video, discard the recorded video, and re-record the video according to another target white balance sequence sent by the server.
其中,质量参数可以使用多个因素来衡量,例如清晰度、人脸与人脸框的对齐度、亮度等等,本实施例对质量参数的选取和评判不作具体限制。The quality parameters may be measured by using multiple factors, such as clarity, alignment of the face and the face frame, brightness, etc. The selection and evaluation of the quality parameters are not specifically limited in this embodiment.
在本实施例中,如果某次录制活体视频失败(例如视频帧的质量参数不合格),那么丢弃该次录制的视频和当次使用的目标白平衡序列,再次使用一个新的目标白平衡序列对摄像装置进行白平衡设置,可有效防止攻击者劫持摄像装置并使用历史发送的白平衡序列进行视频录制视频。In this embodiment, if a certain recording of the live video fails (for example, the quality parameter of the video frame is unqualified), the video recorded this time and the target white balance sequence used at the time are discarded, and a new target white balance sequence is used again. Setting the white balance of the camera device can effectively prevent attackers from hijacking the camera device and recording video using the white balance sequence sent in the history.
结合以上实施例,在一种实施方式中,当从所述服务器获取的所述目标白平衡序列信息为多个时,本申请的活体检测方法还可以包括:In combination with the above embodiments, in an implementation manner, when the target white balance sequence information obtained from the server is multiple, the living body detection method of the present application may further include:
将所选取的所述目标白平衡序列发送给所述服务器。Sending the selected target white balance sequence to the server.
在本实施例中,如果服务器向终端设备发送的目标白平衡序列是多个,那么服务器将录制白平衡序列的信息与预先发送的每一个白平衡序列的信息分别进行比较需要耗费较长的时间,降低检测效率。为提升检测效率,终端设备在使用服务器发送的多个白平衡序列中选取某一个白平衡序列录制视频后,可以将使用的白平衡序列发送到服务器。如此,服务器在接收到终端设备发送的视频,和所选取的一个白平衡序列之后,可以将视频中使用的录制白平衡序列的信息,与终端设备发送的一个白平衡序列(所选取的所述目标白平衡序列)的信息进行比较,如果匹配,则确定视频是合法的。In this embodiment, if there are multiple target white balance sequences sent by the server to the terminal device, it will take a long time for the server to compare the information of the recorded white balance sequence with the information of each white balance sequence sent in advance. , reducing the detection efficiency. In order to improve the detection efficiency, after the terminal device selects a white balance sequence from the multiple white balance sequences sent by the server to record the video, it can send the used white balance sequence to the server. In this way, after receiving the video sent by the terminal device and a selected white balance sequence, the server can compare the information of the recorded white balance sequence used in the video with a white balance sequence sent by the terminal device (the selected white balance sequence) target white balance sequence), and if there is a match, the video is determined to be legitimate.
下面将结合图1和图4,以一个完整实施例对本申请的活体检测方法进行详细说明。在该实施例中,由服务器处理终端设备的活体检测请求。图4是本申请一实施例示出的一种活体检测方法的完整流程示意图。The method for detecting a living body of the present application will be described in detail below with reference to FIG. 1 and FIG. 4 with a complete embodiment. In this embodiment, the liveness detection request of the terminal device is processed by the server. FIG. 4 is a schematic diagram of a complete flow of a method for detecting a living body according to an embodiment of the present application.
步骤1:终端设备的SDK在检测到用户触发的进行人脸验证的操作后,获取终端设备的摄像装置所支持的多个白平衡参数或白平衡参数范围。然后向服务器发送携带这些白平衡参数或白平衡参数范围的人脸验证请求。Step 1: After detecting the operation of face verification triggered by the user, the SDK of the terminal device acquires multiple white balance parameters or white balance parameter ranges supported by the camera device of the terminal device. Then, a face verification request carrying these white balance parameters or white balance parameter ranges is sent to the server.
如果终端设备的系统是安卓系统,且版本小于5.0,那么SDK选择API camera1,并且获取摄像装置支持的多个白平衡参数,然后向服务器发送携带API camera1的信息、多个白平衡参数以及各个白平衡参数对应的色温值的人脸验证请求(也可以不携带各个白平衡参数对应的色温值而由服务器自己确定)。If the system of the terminal device is Android and the version is less than 5.0, the SDK selects API camera1, obtains multiple white balance parameters supported by the camera device, and then sends the information carrying API camera1, multiple white balance parameters and each white balance to the server. A face verification request for the color temperature value corresponding to the balance parameter (the color temperature value corresponding to each white balance parameter may not be carried, but determined by the server itself).
如果终端设备的系统是安卓系统,且版本不小于5.0,那么SDK选择API camera2,并且获取摄像装置支持的白平衡参数范围,然后向服务器发送携带API camera2的信息、白平衡参数范围以及白平衡参数范围对应的色温范围的人脸验证请求(也可以不携带白平衡参数范围对应的色温范围而由服务器自己确定)。If the system of the terminal device is Android, and the version is not less than 5.0, the SDK selects API camera2, obtains the white balance parameter range supported by the camera device, and then sends the information carrying API camera2, white balance parameter range and white balance parameter to the server. The face verification request for the color temperature range corresponding to the range (the color temperature range corresponding to the white balance parameter range may also not be carried and determined by the server itself).
其中,SDK在发送人脸验证请求时可以通过加密处理后再发送,密钥可以是SDK预先与服务器协商确定的。Among them, when the SDK sends the face verification request, it can be encrypted before sending, and the key can be determined by the SDK and the server through negotiation in advance.
步骤2:服务器接收到人脸验证请求后,解密得到终端设备的当前的白平衡信息,不同的白平衡参数对应不同的色温值,服务器进一步根据色温差异,选择色温值相差较大的白平衡参数生成至少一个白平衡序列。其中,在每一个白平衡序列中,相邻的两个白平衡参数各自对应的色温值之间的差值大于目标阈值。Step 2: After the server receives the face verification request, it decrypts and obtains the current white balance information of the terminal device. Different white balance parameters correspond to different color temperature values. The server further selects the white balance parameter with a large color temperature difference according to the color temperature difference. Generate at least one white balance sequence. Wherein, in each white balance sequence, the difference between the color temperature values corresponding to two adjacent white balance parameters is greater than the target threshold.
接着,服务器将至少一个白平衡序列进行加密,然后下发到SDK。Next, the server encrypts at least one white balance sequence and sends it to the SDK.
步骤3:SDK接收到至少一个白平衡序列后进行解密,然后开启人脸检测页面,并调用终端设备的前置摄像装置进行人脸质量检测(人脸不需要做动作),如果检测不通过,提醒用户进行人脸调整,例如调整方向,或者将人脸放置到人脸框内。Step 3: After the SDK receives at least one white balance sequence, it decrypts it, then opens the face detection page, and calls the front camera of the terminal device to perform face quality detection (the face does not need to be moved). If the detection fails, Remind the user to make face adjustments, such as adjusting the orientation, or placing the face in the face frame.
步骤4:在人脸质量符合标准后,SDK在解密得到的至少一个白平衡序列中选择一个即将使用的白平衡序列,按照该选择的白平衡序列中各个白平衡参数的顺序,每隔N帧,使用一个白平衡参数对摄像装置进行白平衡设置。例如第1帧-第5帧是摄像装置在白平衡参数1的情况下采集的,例如第6帧-第10帧是摄像装置在白平衡参数2的情况下采集的。Step 4: After the quality of the face meets the standard, the SDK selects a white balance sequence to be used in the at least one white balance sequence obtained by decryption. According to the sequence of each white balance parameter in the selected white balance sequence, every N frames , use a white balance parameter to set the white balance of the camera. For example, frames 1 to 5 are collected by the camera under the condition of white balance parameter 1, and for example, frames 6 to 10 are collected under the condition of white balance parameter 2 by the camera.
步骤5:在步骤4中,SDK持续对摄像装置采集的各个视频帧进行人脸质量检测,在检测通过后将该视频帧压入视频中。如果检测到某一个视频帧的人脸质量不符合标准,则丢弃当前采集的视频,重新在解密得到的至少一个白平衡序列中选择一个未使用过的白平衡序列,再重复执行步骤3-步骤4完成视频录制。Step 5: In Step 4, the SDK continues to perform face quality detection on each video frame collected by the camera device, and pushes the video frame into the video after the detection is passed. If it is detected that the face quality of a certain video frame does not meet the standard, discard the currently captured video, select an unused white balance sequence from the at least one white balance sequence obtained by decryption, and repeat step 3-step 4Complete the video recording.
步骤6:在完成白平衡视频录制后,SDK将录制的视频,和所选取的一个白平衡序列进行加密打包,然后上传至服务器。Step 6: After completing the white balance video recording, the SDK encrypts the recorded video and a selected white balance sequence, and then uploads it to the server.
步骤7:服务器收到数据包后进行解密,得到录制的视频和录制视频时所选取的一个白平衡序列。接着,服务器将视频解成单帧,提取每一帧图像中人脸区域的RGB值(在进行人脸质量检测时会在屏幕上展示一个人脸框以保证提取到人脸区域的图像。在提取人脸区域的RGB值时,根据人脸框的坐标只提取人脸框内的区域的RGB值),根据RGB值计算得到对应的色温值,如此,多帧视频图像可以得到多个色温值。接着,将所有的色温值按照采集顺序绘制成色温变化曲线。最后将视频对应的色温变化曲线,和终端设备发送的那个白平衡序列(目标白平衡序列)对应的色温变化曲线进行相似度对比,如果相似度大于阈值,表示验证成功,即视频是合法的,不是攻击视频。Step 7: The server decrypts the data packet after receiving it, and obtains the recorded video and a white balance sequence selected when recording the video. Then, the server decomposes the video into a single frame, and extracts the RGB value of the face area in each frame of the image (a face frame will be displayed on the screen during the face quality detection to ensure that the image of the face area is extracted. In When extracting the RGB value of the face area, only the RGB value of the area within the face frame is extracted according to the coordinates of the face frame), and the corresponding color temperature value is calculated according to the RGB value. In this way, multiple frames of video images can obtain multiple color temperature values. . Next, draw all the color temperature values into a color temperature change curve according to the collection order. Finally, compare the color temperature change curve corresponding to the video with the color temperature change curve corresponding to the white balance sequence (target white balance sequence) sent by the terminal device. If the similarity is greater than the threshold, the verification is successful, that is, the video is legal. Not an attack video.
步骤8:服务器将验证结果发送给终端设备。Step 8: The server sends the verification result to the terminal device.
本申请的活体检测方法具备如下多个效果:The living body detection method of the present application has the following multiple effects:
一、可检测出目标对象的视频是否是摄像装置被劫持后拍摄的攻击视频。1. It can detect whether the video of the target object is an attack video shot after the camera device was hijacked.
二、本申请的活体检测方法的应用范围更广,一方面,不再对光线的强度有要求(白平衡与光线强度无关),在光线较强的环境中仍能生效,可覆盖用户的各种使用场景;另一方面,不再对设备的保护膜(例如手机膜)的透光性有要求(白平衡与膜的透光性无关),可覆盖用户的各种设备;另一方面,不再需要调亮设备的屏幕(白平衡与屏幕亮度无关),可避免对用户造成晃眼,优化用户的体验。2. The live detection method of the present application has a wider application range. On the one hand, it no longer requires the intensity of light (white balance has nothing to do with the intensity of light), it can still take effect in an environment with strong light, and can cover the user's various On the other hand, there is no longer any requirement for the light transmittance of the protective film of the device (such as mobile phone film) (white balance has nothing to do with the light transmittance of the film), which can cover various devices of the user; on the other hand, It is no longer necessary to brighten the screen of the device (white balance has nothing to do with screen brightness), which can avoid dazzling users and optimize the user experience.
三、本申请的活体检测方法具有较高的检测效率,无需用户花费较长的时间进行交互,同时降低了用户的使用难度,避免个别用户因难度太大而无法完成检测,提高了整体检测率。需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请实施例所必须的。3. The living body detection method of the present application has high detection efficiency, does not require users to spend a long time to interact, and at the same time reduces the difficulty for users to use, avoids individual users from being unable to complete the detection due to too much difficulty, and improves the overall detection rate . It should be noted that, for the sake of simple description, the method embodiments are expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because According to the embodiments of the present application, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
基于同一发明构思,本申请一实施例提供了一种活体检测系统,所述系统包括终端设备和服务器;Based on the same inventive concept, an embodiment of the present application provides a living body detection system, the system includes a terminal device and a server;
所述终端设备,用于响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息,并控制摄像装置按照所述目标白平衡序列的指示对目标对象进行视频录制,将录制的所述目标对象的视频发送给所述服务器;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整;The terminal device is configured to obtain target white balance sequence information from a server in response to a living body detection request for performing living body detection on the target object, and control the camera device to perform video recording on the target object according to the instructions of the target white balance sequence, and record the target object. The recorded video of the target object is sent to the server; wherein the target white balance parameter sequence information is used to instruct to adjust the white balance parameters of the camera during the video recording process;
所述服务器,用于接收所述目标对象的视频,对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。The server is configured to receive the video of the target object, parse the video, obtain the recording white balance sequence information actually used in the recording process of the video, and associate the recording white balance sequence information with the target object. The white balance sequence information is matched, and whether the target object is a living body is verified according to the matching result of the recorded white balance sequence information and the target white balance sequence information.
基于同一发明构思,本申请一实施例提供了一种活体检测装置500。参考图5,图5是本申请一实施例示出的一种活体检测装置的结构框图。如图5所示,该活体检测装置500可以包括:Based on the same inventive concept, an embodiment of the present application provides a living
第一获取模块501,用于获取目标对象的视频;The
解析模块502,用于对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息;A
匹配模块503,用于将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,所述目标白平衡序列信息用于指示在所述视频的录制过程中对摄像装置的白平衡参数进行调整;A
校验模块504,用于根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。The
可选地,所述装置500还包括:Optionally, the
第二获取模块,用于获取摄像装置所支持的白平衡参数信息;其中,所述白平衡参数信息包括所述白平衡参数所对应的色温信息;a second obtaining module, configured to obtain white balance parameter information supported by the camera device; wherein the white balance parameter information includes color temperature information corresponding to the white balance parameter;
生成模块,用于根据所述摄像装置所支持的白平衡参数的色温信息,为所述摄像装置生成至少一个待选用白平衡序列;其中,所述待选用白平衡序列供所述摄像装置录制所述目标对象的视频时进行白平衡参数的调整。The generation module is configured to generate at least one white balance sequence to be selected for the camera device according to the color temperature information of the white balance parameter supported by the camera device; wherein, the white balance sequence to be selected is for the camera device to record the data. Adjust the white balance parameters when describing the video of the target object.
可选地,所述装置应用于服务器;所述装置500还包括:Optionally, the apparatus is applied to a server; the
第一发送模块,用于将所述至少一个待选用白平衡序列发送给终端设备,由所述终端设备的摄像装置在录制所述视频时根据所述至少一个待选用白平衡序列进行白平衡参数的调整;The first sending module is configured to send the at least one white balance sequence to be selected to the terminal device, and the camera device of the terminal device performs white balance parameters according to the at least one white balance sequence to be selected when recording the video. adjustment;
所述第一获取模块501包括:The first obtaining
接收子模块,用于接收所述终端设备发送的所述目标对象的视频。The receiving sub-module is configured to receive the video of the target object sent by the terminal device.
可选地,所述服务器向所述终端设备发送的待选用白平衡序列的数量为多个;所述装置500还包括:Optionally, the number of to-be-selected white balance sequences sent by the server to the terminal device is multiple; the
接收模块,用于接收所述终端设备发送的其录制所述目标对象的视频时所使用的待选用白平衡序列,并将其作为所述目标白平衡序列。A receiving module, configured to receive the white balance sequence to be used when recording the video of the target object sent by the terminal device, and use it as the target white balance sequence.
可选地,所述装置500还包括:Optionally, the
第一确定模块,用于每当接收到活体检测请求时,从所述至少一个待选用白平衡序列中确定出一个待选用白平衡序列;a first determining module, configured to determine a to-be-selected white balance sequence from the at least one to-be-selected white balance sequence whenever a living body detection request is received;
第二确定模块,用于将确定的待选用白平衡序列作为摄像装置录制所述视频所使用的目标白平衡序列,其中,相邻两次确定出的两个待选用白平衡序列不同。The second determination module is configured to use the determined to-be-selected white balance sequence as the target white balance sequence used by the camera device to record the video, wherein the two to-be-selected white balance sequences determined in two adjacent times are different.
可选地,所述解析模块502包括:Optionally, the
抽取子模块,用于从所述视频中抽取多个视频帧;Extracting submodules for extracting multiple video frames from the video;
第一获得子模块,用于根据每个所述视频帧上的目标像素点的颜色值,得到录制白平衡序列对应的色温变化信息;其中,所述目标像素点为所述视频帧的全部像素点或者所述目标像素点为所述视频帧的目标区域内的像素点;所述目标区域为用于进行活体检测的区域;The first obtaining sub-module is used to obtain the color temperature change information corresponding to the recording white balance sequence according to the color value of the target pixel point on each of the video frames; wherein, the target pixel point is all the pixels of the video frame The point or the target pixel point is the pixel point in the target area of the video frame; the target area is the area used for living body detection;
所述匹配模块503包括:The
匹配子模块,用于将所述录制白平衡序列对应的色温变化信息,与目标白平衡序列对应的色温变化信息进行匹配。The matching submodule is configured to match the color temperature change information corresponding to the recording white balance sequence with the color temperature change information corresponding to the target white balance sequence.
可选地,所述第一获得子模块包括:Optionally, the first obtaining submodule includes:
第二获得子模块,用于根据每个所述视频帧上目标对象的脸部区域内的像素点的颜色值,得到录制白平衡序列对应的色温变化信息;或者The second obtaining sub-module is used to obtain the color temperature change information corresponding to the recorded white balance sequence according to the color value of the pixel in the face area of the target object on each of the video frames; or
第三获得子模块,用于根据每个所述视频帧上目标对象的掌部区域内的像素点的颜色值,得到录制白平衡序列对应的色温变化信息。The third obtaining sub-module is configured to obtain the color temperature change information corresponding to the recording white balance sequence according to the color values of the pixels in the palm area of the target object on each of the video frames.
基于同一发明构思,本申请一实施例提供了另一种活体检测装置600,应用于终端设备。参考图6,图6是本申请一实施例示出的另一种活体检测装置的结构框图。如图6所示,该活体检测装置600可以包括:Based on the same inventive concept, an embodiment of the present application provides another living body detection apparatus 600, which is applied to a terminal device. Referring to FIG. 6 , FIG. 6 is a structural block diagram of another living body detection apparatus shown in an embodiment of the present application. As shown in FIG. 6 , the living body detection device 600 may include:
第三获取模块601,用于响应于对目标对象进行活体检测的活体检测请求,从服务器获取目标白平衡序列信息;其中,所述目标白平衡参数序列信息用于指示在视频的录制过程中对摄像装置的白平衡参数进行调整;The third obtaining
第一控制模块602,用于控制所述摄像装置按照所述目标白平衡序列信息的指示对目标对象进行视频录制;a
第二发送模块603,用于将录制的所述目标对象的视频发送给所述服务器,由所述服务器对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息,并将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,根据匹配结果确定所述目标对象是否是活体。The
可选地,所述第一控制模块602包括:Optionally, the
提取子模块,用于响应于所述活体检测请求,每隔目标时长从目标白平衡序列中顺次提取一个白平衡参数;An extraction submodule, used for sequentially extracting a white balance parameter from the target white balance sequence every target duration in response to the living body detection request;
第一控制子模块,用于控制所述摄像装置按照所提取的一个白平衡参数进行单帧视频或连续多帧视频的录制。The first control submodule is configured to control the camera device to record a single-frame video or a continuous multi-frame video according to an extracted white balance parameter.
可选地,所述装置600还包括:Optionally, the apparatus 600 further includes:
检测模块,用于检测所述摄像装置录制的每一视频帧的质量参数是否符合目标质量参数;a detection module, configured to detect whether the quality parameter of each video frame recorded by the camera device conforms to the target quality parameter;
第二控制模块,用于在检测到所述摄像装置录制的一个视频帧的质量参数不符合所述目标质量参数时,控制所述摄像装置停止视频录制,丢弃已录制视频;以及,从所述服务器获取新的目标白平衡序列信息;a second control module, configured to control the camera to stop video recording and discard the recorded video when it is detected that the quality parameter of a video frame recorded by the camera does not meet the target quality parameter; and, from the camera The server obtains the new target white balance sequence information;
所述第一控制子模块包括:The first control submodule includes:
第二控制子模块,用于控制所述摄像装置按照新的目标白平衡序列信息的指示重新录制所述目标对象的视频。The second control submodule is configured to control the camera to re-record the video of the target object according to the instruction of the new target white balance sequence information.
可选地,当从所述服务器获取的所述目标白平衡序列信息为多个时,所述装置600还包括:Optionally, when the target white balance sequence information obtained from the server is multiple, the apparatus 600 further includes:
第三发送模块,用于将所选取的所述目标白平衡序列发送给所述服务器。The third sending module is configured to send the selected target white balance sequence to the server.
本申请实施例还提供了一种电子设备,如图7所示。图7是本申请一实施例示出的一种电子设备的结构示意图。参照图7,电子设备包括处理器71、通信接口72、存储器73和通信总线74,其中,处理器71,通信接口72,存储器73通过通信总线74完成相互间的通信;The embodiment of the present application further provides an electronic device, as shown in FIG. 7 . FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. 7, the electronic device includes a
存储器73,用于存放计算机程序;
处理器71,用于执行存储器73上所存放的程序时,实现如下步骤:When the
获取目标对象的视频;Get the video of the target object;
对所述视频进行解析,得到在所述视频的录制过程中实际所使用的录制白平衡序列信息;Analyze the video to obtain the recording white balance sequence information actually used in the recording process of the video;
将所述录制白平衡序列信息与目标白平衡序列信息进行匹配,所述目标白平衡序列信息用于指示在所述视频的录制过程中对摄像装置的白平衡参数进行调整;Matching the recording white balance sequence information with the target white balance sequence information, the target white balance sequence information is used to instruct to adjust the white balance parameters of the camera during the recording process of the video;
根据所述录制白平衡序列信息与所述目标白平衡序列信息的匹配结果,校验所述目标对象是否为活体。According to the matching result between the recorded white balance sequence information and the target white balance sequence information, it is verified whether the target object is a living body.
或者处理器71在执行存储器73上所存放的程序时,实现上述其他方法实施例中的全部步骤。Or, when the
上述终端提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,简称PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,简称EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned by the above terminal may be a Peripheral Component Interconnect (PCI for short) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA for short) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述终端与其他设备之间的通信。The communication interface is used for communication between the above-mentioned terminal and other devices.
存储器可以包括随机存取存储器(Random Access Memory,简称RAM),也可以包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM for short), and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processing,简称DSP)、专用集成电路(Application SpecificIntegrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; may also be a digital signal processor (Digital Signal Processing, referred to as DSP) , Application Specific Integrated Circuit (ASIC for short), Field-Programmable Gate Array (FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
在本申请提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述实施例中任一所述的活体检测方法。In yet another embodiment provided by the present application, a computer-readable storage medium is also provided, where instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer is made to execute any one of the foregoing embodiments. The described living body detection method.
在本申请提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任一所述的活体检测方法。In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions, which, when executed on a computer, cause the computer to execute the method for detecting a living body in any of the foregoing embodiments.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, Solid State Disk (SSD)), among others.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to the partial descriptions of the method embodiments.
以上所述仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application are included in the protection scope of this application.
Claims (15)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111679763.XA CN114387674A (en) | 2021-12-31 | 2021-12-31 | Liveness detection method, system, device, storage medium and program product |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111679763.XA CN114387674A (en) | 2021-12-31 | 2021-12-31 | Liveness detection method, system, device, storage medium and program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN114387674A true CN114387674A (en) | 2022-04-22 |
Family
ID=81199918
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111679763.XA Pending CN114387674A (en) | 2021-12-31 | 2021-12-31 | Liveness detection method, system, device, storage medium and program product |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114387674A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115174138A (en) * | 2022-05-25 | 2022-10-11 | 北京旷视科技有限公司 | Camera attack detection method, system, device, storage medium and program product |
| CN116912745A (en) * | 2023-07-20 | 2023-10-20 | 北京百度网讯科技有限公司 | Method, device, equipment and medium for detecting falsification risk of video stream |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107613550A (en) * | 2017-09-27 | 2018-01-19 | 广东欧珀移动通信有限公司 | Unlock control method and related products |
| US20190034746A1 (en) * | 2017-07-28 | 2019-01-31 | Alibaba Group Holding Limited | System and method for identifying re-photographed images |
| CN113591526A (en) * | 2020-04-30 | 2021-11-02 | 华为技术有限公司 | Face living body detection method, device, equipment and computer readable storage medium |
| CN113850214A (en) * | 2021-09-29 | 2021-12-28 | 支付宝(杭州)信息技术有限公司 | Injection attack identification method and device for live detection |
-
2021
- 2021-12-31 CN CN202111679763.XA patent/CN114387674A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190034746A1 (en) * | 2017-07-28 | 2019-01-31 | Alibaba Group Holding Limited | System and method for identifying re-photographed images |
| CN107613550A (en) * | 2017-09-27 | 2018-01-19 | 广东欧珀移动通信有限公司 | Unlock control method and related products |
| CN113591526A (en) * | 2020-04-30 | 2021-11-02 | 华为技术有限公司 | Face living body detection method, device, equipment and computer readable storage medium |
| CN113850214A (en) * | 2021-09-29 | 2021-12-28 | 支付宝(杭州)信息技术有限公司 | Injection attack identification method and device for live detection |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115174138A (en) * | 2022-05-25 | 2022-10-11 | 北京旷视科技有限公司 | Camera attack detection method, system, device, storage medium and program product |
| CN115174138B (en) * | 2022-05-25 | 2024-06-07 | 北京旷视科技有限公司 | Camera attack detection method, system, device, storage medium and program product |
| CN116912745A (en) * | 2023-07-20 | 2023-10-20 | 北京百度网讯科技有限公司 | Method, device, equipment and medium for detecting falsification risk of video stream |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11210541B2 (en) | Liveness detection method, apparatus and computer-readable storage medium | |
| CN109086645B (en) | Face recognition method and device, and false user recognition method and device | |
| CN108804884B (en) | Identity authentication method, identity authentication device and computer storage medium | |
| Tang et al. | Face flashing: a secure liveness detection protocol based on light reflections | |
| US10135818B2 (en) | User biological feature authentication method and system | |
| KR20190038594A (en) | Face recognition-based authentication | |
| CN105005779A (en) | Face verification anti-counterfeit recognition method and system thereof based on interactive action | |
| CN114387548B (en) | Video and living body detection method, system, device, storage medium and program product | |
| CN108280418A (en) | The deception recognition methods of face image and device | |
| WO2020259128A1 (en) | Liveness detection method and apparatus, electronic device, and computer readable storage medium | |
| TW201512880A (en) | Electronic device, authenticating system and method | |
| KR101724971B1 (en) | System for recognizing face using wide angle camera and method for recognizing face thereof | |
| CN110612530A (en) | Method for selecting a frame for use in face processing | |
| CN113850214A (en) | Injection attack identification method and device for live detection | |
| CN113850211A (en) | Method and device for detecting injected video attack | |
| CN114387674A (en) | Liveness detection method, system, device, storage medium and program product | |
| CN111079687A (en) | Certificate camouflage identification method, device, equipment and storage medium | |
| CN114612986A (en) | Detection method, device, electronic device and storage medium | |
| CN112989299A (en) | Interactive identity recognition method, system, device and medium | |
| CN112861104A (en) | Identity verification method and related device | |
| CN113033243A (en) | Face recognition method, device and equipment | |
| KR102850051B1 (en) | Method and apparatus for determining liveness | |
| CN114648801B (en) | Human face liveness detection method and device, processor and electronic device | |
| Ma et al. | Multi-perspective dynamic features for cross-database face presentation attack detection | |
| US20250037509A1 (en) | System and method for determining liveness using face rotation |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |