WO2023056811A1 - Distance detection method and apparatus, control method and apparatus, and storage medium and electronic device - Google Patents

Distance detection method and apparatus, control method and apparatus, and storage medium and electronic device Download PDF

Info

Publication number
WO2023056811A1
WO2023056811A1 PCT/CN2022/117067 CN2022117067W WO2023056811A1 WO 2023056811 A1 WO2023056811 A1 WO 2023056811A1 CN 2022117067 W CN2022117067 W CN 2022117067W WO 2023056811 A1 WO2023056811 A1 WO 2023056811A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
imaging
image
preset
distance
Prior art date
Application number
PCT/CN2022/117067
Other languages
French (fr)
Chinese (zh)
Inventor
邱榆清
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023056811A1 publication Critical patent/WO2023056811A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Studio Devices (AREA)
  • Collating Specific Patterns (AREA)

Abstract

A distance detection method, a control method, a distance detection apparatus, a control apparatus, a computer-readable storage medium and an electronic device. The distance detection method comprises: acquiring a facial image of a target user that is collected by an image collection device; determining, from the facial image, imaging sizes of at least two preset facial parts; and determining the distance between the target user and the image collection device according to the imaging sizes of the at least two preset facial parts. The accuracy of distance detection is improved, and the hardware cost is relatively low.

Description

距离检测方法、控制方法、装置、存储介质与电子设备Distance detection method, control method, device, storage medium and electronic equipment
本申请要求申请日为2021年10月08日,申请号为202111172688.8,名称为“距离检测方法、控制方法、装置、存储介质与电子设备”的中国专利申请的优先权,该中国专利申请的全部内容通过引用结合在本文中。This application claims the priority of the Chinese patent application with the application date of October 8, 2021, the application number 202111172688.8, and the name "distance detection method, control method, device, storage medium and electronic equipment". The contents are incorporated herein by reference.
技术领域technical field
本公开涉及计算机视觉技术领域,尤其涉及距离检测方法、控制方法、距离检测装置、控制装置、计算机可读存储介质与电子设备。The present disclosure relates to the technical field of computer vision, and in particular to a distance detection method, a control method, a distance detection device, a control device, a computer-readable storage medium and electronic equipment.
背景技术Background technique
随着人们对于电子设备智能化的需求越来越高,一些智能化的功能需要通过检测人与设备之间的距离来实现。例如,手机在息屏状态下检测到用户与手机的距离较近时,自动唤起屏幕;门禁系统检测到有人接近时,自动触发执行身份验证或开门的流程,等等。As people's demand for intelligent electronic equipment is getting higher and higher, some intelligent functions need to be realized by detecting the distance between people and equipment. For example, when the mobile phone detects that the user is close to the mobile phone in the off-screen state, it will automatically wake up the screen; when the access control system detects that someone is approaching, it will automatically trigger the process of performing identity verification or opening the door, and so on.
然而,相关技术在检测人与设备之间的距离时,准确性有限,从而限制了上述功能的应用。However, related technologies have limited accuracy when detecting the distance between a person and a device, thereby limiting the application of the above functions.
发明内容Contents of the invention
本公开提供距离检测方法、控制方法、距离检测装置、控制装置、计算机可读存储介质与电子设备。The disclosure provides a distance detection method, a control method, a distance detection device, a control device, a computer-readable storage medium and electronic equipment.
根据本公开的第一方面,提供一种距离检测方法,包括:获取由图像采集设备所采集的目标用户的人脸图像;在所述人脸图像中确定至少两种人脸预设部位的成像尺寸;根据所述至少两种人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。According to the first aspect of the present disclosure, there is provided a distance detection method, comprising: acquiring a face image of a target user collected by an image acquisition device; determining at least two images of preset parts of the face in the face image Size: determining the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face.
根据本公开的第二方面,提供一种距离检测方法,包括:获取由图像采集设备所采集的目标用户的人脸图像;在所述人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;根据所述人脸图像中所述第一人脸预设部位的成像尺寸,在所述人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;根据所述人脸图像中所述第二人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。According to a second aspect of the present disclosure, a distance detection method is provided, including: acquiring a face image of a target user captured by an image acquisition device; determining at least one of The first preset part of the face; according to the imaging size of the first preset part of the face in the face image, at least one second face is determined in the preset part of the face in the face image Preset part: determining the distance between the target user and the image acquisition device according to the imaging size of the second preset part of the face in the face image.
根据本公开的第三方面,提供一种控制方法,包括:获取目标用户与图像采集设备之间的距离,所述距离是根据上述第一或第二方面的距离检测方法所检测得到的;根据所述距离生成对应的控制指令。According to the third aspect of the present disclosure, there is provided a control method, including: obtaining the distance between the target user and the image acquisition device, the distance is detected according to the distance detection method of the first or second aspect above; according to The distance generates a corresponding control command.
根据本公开的第四方面,提供一种距离检测装置,包括:图像获取模块,被配置为获取由图像采集设备所采集的目标用户的人脸图像;成像尺寸确定模块,被配置为在所述人脸图像中确定至少两种人脸预设部位的成像尺寸;距离确定模块,被配置为根据所述至少两种人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。According to a fourth aspect of the present disclosure, there is provided a distance detection device, including: an image acquisition module configured to acquire a face image of a target user captured by an image acquisition device; an imaging size determination module configured to Determine the imaging sizes of at least two preset parts of the face in the face image; the distance determination module is configured to determine the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face the distance between.
根据本公开的第五方面,提供一种距离检测装置,包括:图像获取模块,被配置为获取由图像采集设备所采集的目标用户的人脸图像;第一人脸预设部位确定模块,被配置为在所述人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;第二人脸预设部位确定模块,被配置为根据所述人脸图像中所述第一人脸预设部位的成像尺寸,在所述人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;距离确定模块,被配置为根据所述人脸图像中所述第二人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。According to a fifth aspect of the present disclosure, a distance detection device is provided, including: an image acquisition module configured to acquire a face image of a target user captured by an image acquisition device; a first preset face part determination module configured to It is configured to determine at least one first preset human face part in the preset human face parts in the human face image; the second preset human face part determination module is configured to The imaging size of the first preset part of the face, at least one second preset part of the face is determined in the preset parts of the face in the face image; the distance determination module is configured to be based on the face image The imaging size of the preset part of the second human face is used to determine the distance between the target user and the image acquisition device.
根据本公开的第六方面,提供一种控制装置,包括:距离获取模块,被配置为获取目标用户与图像采集设备之间的距离,所述距离是根据上述第一或第二方面的距离检测方法所检测得到的;控制指令生成模块,被配置为根据所述距离生成对应的控制指令。According to a sixth aspect of the present disclosure, there is provided a control device, including: a distance acquisition module configured to acquire the distance between the target user and the image acquisition device, the distance is detected according to the distance of the first or second aspect above The method is detected; the control command generation module is configured to generate a corresponding control command according to the distance.
根据本公开的第七方面,提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述第一或第二方面的距离检测方法及其可能的实现方式,或者实现上述第三方面的控制方法及其可能的实现方式。According to a seventh aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the distance detection method of the above-mentioned first or second aspect and its possible implementations are implemented way, or realize the control method of the above third aspect and its possible realization ways.
根据本公开的第八方面,提供一种电子设备,包括:处理器;以及存储器,用于存储所述处理器的可执行指令;其中,所述处理器配置为经由执行所述可执行指令来执行上述第一或第二方面的距离检测方法及其可能的实现方式,或者执行上述第三方面的控制方法及其可能的实现方式。According to an eighth aspect of the present disclosure, there is provided an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to Executing the distance detection method in the first or second aspect and possible implementations thereof, or executing the control method in the third aspect and possible implementations thereof.
附图说明Description of drawings
图1示出本示例性实施方式中一种系统架构的示意图;FIG. 1 shows a schematic diagram of a system architecture in this exemplary embodiment;
图2示出本示例性实施方式中一种电子设备的结构示意图;FIG. 2 shows a schematic structural diagram of an electronic device in this exemplary embodiment;
图3示出本示例性实施方式中一种距离检测方法的流程图;Fig. 3 shows a flow chart of a distance detection method in this exemplary embodiment;
图4示出本示例性实施方式中人脸图像以及人脸预设部位的成像尺寸的示意图;Fig. 4 shows a schematic diagram of the imaging size of the face image and the preset parts of the face in this exemplary embodiment;
图5示出本示例性实施方式中确定人脸预设部位的成像尺寸的流程图;FIG. 5 shows a flow chart of determining the imaging size of a preset part of a face in this exemplary embodiment;
图6示出本示例性实施方式中通过虹膜检测模型检测虹膜的示意图;Fig. 6 shows the schematic diagram that detects iris by iris detection model in this exemplary embodiment;
图7示出本示例性实施方式中通过脸部的成像宽度确定候选距离的示意图;FIG. 7 shows a schematic diagram of determining candidate distances through the imaging width of a face in this exemplary embodiment;
图8示出本示例性实施方式中另一种距离检测方法的流程图;FIG. 8 shows a flowchart of another distance detection method in this exemplary embodiment;
图9示出本示例性实施方式中再一种距离检测方法的流程图;FIG. 9 shows a flowchart of another distance detection method in this exemplary embodiment;
图10示出本示例性实施方式中一种控制方法的流程图;FIG. 10 shows a flowchart of a control method in this exemplary embodiment;
图11示出本示例性实施方式中一种距离检测装置的结构示意图;Fig. 11 shows a schematic structural diagram of a distance detection device in this exemplary embodiment;
图12示出本示例性实施方式中另一种距离检测装置的结构示意图;Fig. 12 shows a schematic structural diagram of another distance detection device in this exemplary embodiment;
图13示出本示例性实施方式中另一种距离检测装置的结构示意图;Fig. 13 shows a schematic structural diagram of another distance detection device in this exemplary embodiment;
图14示出本示例性实施方式中另一种距离检测装置的结构示意图;Fig. 14 shows a schematic structural diagram of another distance detection device in this exemplary embodiment;
图15示出本示例性实施方式中一种控制装置的结构示意图;Fig. 15 shows a schematic structural diagram of a control device in this exemplary embodiment;
图16示出本示例性实施方式中另一种控制装置的结构示意图。Fig. 16 shows a schematic structural diagram of another control device in this exemplary embodiment.
具体实施方式Detailed ways
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本公开的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而省略所述特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本公开的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided in order to give a thorough understanding of embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details being omitted, or other methods, components, devices, steps, etc. may be adopted. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and/or processor means and/or microcontroller means.
相关技术中,为电子设备配置距离传感器,其通过发射红外等信号来实现距离感测,但是这样增加了硬件成本,且距离传感器容易受到环境的影响,导致准确性降低。In related technologies, electronic devices are equipped with distance sensors, which implement distance sensing by emitting infrared signals, but this increases hardware costs, and the distance sensors are easily affected by the environment, resulting in reduced accuracy.
鉴于上述问题,本公开的示例性实施方式首先提供一种距离检测方法。下面结合图1对本示例性实施方式运行环境的系统架构与应用场景进行示例性说明。In view of the above problems, exemplary embodiments of the present disclosure firstly provide a distance detection method. The system architecture and application scenarios of the operating environment in this exemplary embodiment will be exemplarily described below in conjunction with FIG. 1 .
图1示出了系统架构的示意图,该系统架构100可以包括图像采集设备110与处理设备120。其中,图像采集设备110可以是相机,用于采集目标用户的人脸图像;处理设备120可以是手机、平板电脑、台式电脑、笔记本电脑等,用于执行本示例性实施方式中的距离检测方法,通过对该人脸图像进行处理,以确定目标用户与图像采集设备110之间的距离。FIG. 1 shows a schematic diagram of a system architecture, and the system architecture 100 may include an image acquisition device 110 and a processing device 120 . Wherein, the image acquisition device 110 may be a camera, which is used to collect the face image of the target user; the processing device 120 may be a mobile phone, a tablet computer, a desktop computer, a notebook computer, etc., and is used to perform the distance detection method in this exemplary embodiment , by processing the face image to determine the distance between the target user and the image acquisition device 110 .
图1中示出了图像采集设备110与处理设备120为独立设置的两台设备,其可以通过有线或无线的通信链路形成连接,以进行数据交互。FIG. 1 shows that the image acquisition device 110 and the processing device 120 are two independent devices, which can be connected through a wired or wireless communication link for data interaction.
在一种实施方式中,图像采集设备110与处理设备120也可以集成在一台设备中。示例性的,手机内置有摄像模块,如摄像模块可以包括前置摄像头,该摄像模块相当于图像采集设备110;手机可以采集目标用户的人脸图像并执行距离检测方法,以确定目标用户与手机之间的距离;进而,当该距离较近时,手机可以发出提示用户注意手机距离以及保护眼睛的相关信息。或者,门禁系统包括监控摄像头与微控制单元,监控摄像头相当于图像采集设备110,微控制单元相当于处理设备120;该门禁系统通过监控摄像头采集目标用户的人脸图像,并通过微控制单元执行距离检测方法,以确定目标用户与门禁系统之间的距离;进而,当该距离较近时,门禁系统可以触发执行身份验证或开门的流程。In an implementation manner, the image acquisition device 110 and the processing device 120 may also be integrated into one device. Exemplarily, the mobile phone has a built-in camera module, such as the camera module can include a front camera, which is equivalent to the image acquisition device 110; the mobile phone can collect the face image of the target user and perform a distance detection method to determine the distance between the target user and the mobile phone Furthermore, when the distance is relatively short, the mobile phone can send relevant information reminding the user to pay attention to the distance of the mobile phone and protect the eyes. Alternatively, the access control system includes a monitoring camera and a micro-control unit, the monitoring camera is equivalent to the image acquisition device 110, and the micro-control unit is equivalent to the processing device 120; the access control system collects the face image of the target user through the monitoring camera, and executes A distance detection method to determine the distance between the target user and the access control system; furthermore, when the distance is relatively short, the access control system can trigger the process of performing identity verification or opening the door.
本公开的示例性实施方式还提供一种用于执行上述距离检测方法的电子设备,该电子设备可以是上述处理设备120。一般的,该电子设备可以包括处理器与存储器,存储器用于存储处理器的可执行指令,处理器配置为经由执行该可执行指令,来执行上述距离检测方法。Exemplary embodiments of the present disclosure also provide an electronic device for performing the above-mentioned distance detection method, and the electronic device may be the above-mentioned processing device 120 . Generally, the electronic device may include a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the above-mentioned distance detection method by executing the executable instructions.
下面以图2中的移动终端200为例,对该电子设备的构造进行示例性说明。本领域技术人员应当理解,除了特别用于移动目的的部件之外,图2中的构造也能够应用于固定类型的设备。The structure of the electronic device will be described below by taking the mobile terminal 200 in FIG. 2 as an example. Those skilled in the art will appreciate that, in addition to components specifically intended for mobile purposes, the configuration in Fig. 2 can also be applied to equipment of a stationary type.
如图2所示,移动终端200具体可以包括:处理器201、存储器202、总线203、移动通信模块204、天线1、无线通信模块205、天线2、显示屏206、传感器模块207、音频模块208、电源模块209与摄像模块210。As shown in Figure 2, the mobile terminal 200 may specifically include: a processor 201, a memory 202, a bus 203, a mobile communication module 204, an antenna 1, a wireless communication module 205, an antenna 2, a display screen 206, a sensor module 207, and an audio module 208 , a power supply module 209 and a camera module 210 .
处理器201可以包括一个或多个处理单元,例如:处理器210可以包括AP(Application Processor,应用处理器)、调制解调处理器、GPU(Graphics Processing Unit,图形处理器)、ISP(Image Signal Processor, 图像信号处理器)、控制器、编码器、解码器、DSP(Digital Signal Processor,数字信号处理器)、基带处理器和/或NPU(Neural-Network Processing Unit,神经网络处理器)等。本示例性实施方式中,距离检测方法可以由AP、GPU或DSP等来执行,当方法涉及到神经网络相关的处理时,可以由NPU来执行,例如NPU可以加载神经网络参数并执行神经网络相关的算法指令。 Processor 201 may include one or more processing units, for example: processor 210 may include AP (Application Processor, application processor), modem processor, GPU (Graphics Processing Unit, graphics processing unit), ISP (Image Signal Processor, image signal processor), controller, encoder, decoder, DSP (Digital Signal Processor, digital signal processor), baseband processor and/or NPU (Neural-Network Processing Unit, neural network processor), etc. In this exemplary embodiment, the distance detection method can be performed by an AP, GPU or DSP, etc. When the method involves neural network-related processing, it can be performed by an NPU. For example, the NPU can load neural network parameters and perform neural network related processing. algorithmic instructions.
编码器可以对图像或视频进行编码(即压缩),以减小数据大小,便于存储或发送。解码器可以对图像或视频的编码数据进行解码(即解压缩),以还原出图像或视频数据。移动终端200可以支持一种或多种编码器和解码器。这样,移动终端200可以处理多种编码格式的图像或视频,例如:JPEG(Joint Photographic Experts Group,联合图像专家组)、PNG(Portable Network Graphics,便携式网络图形)、BMP(Bitmap,位图)等图像格式,MPEG(Moving Picture Experts Group,动态图像专家组)1、MPEG2、H.263、H.264、HEVC(High Efficiency Video Coding,高效率视频编码)等视频格式。An encoder encodes (i.e. compresses) an image or video to reduce the data size for storage or transmission. The decoder can decode (ie decompress) the coded data of the image or video to restore the image or video data. The mobile terminal 200 may support one or more encoders and decoders. In this way, the mobile terminal 200 can process images or videos in multiple encoding formats, such as: JPEG (Joint Photographic Experts Group, Joint Photographic Experts Group), PNG (Portable Network Graphics, portable network graphics), BMP (Bitmap, bitmap), etc. Image format, MPEG (Moving Picture Experts Group, moving picture expert group) 1, MPEG2, H.263, H.264, HEVC (High Efficiency Video Coding, high-efficiency video coding) and other video formats.
处理器201可以通过总线203与存储器202或其他部件形成连接。The processor 201 can form a connection with the memory 202 or other components through the bus 203 .
存储器202可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器201通过运行存储在存储器202的指令,执行移动终端200的各种功能应用以及数据处理。存储器202还可以存储应用数据,例如存储图像,视频等文件。 Memory 202 may be used to store computer-executable program code, which includes instructions. The processor 201 executes various functional applications and data processing of the mobile terminal 200 by executing instructions stored in the memory 202 . The memory 202 can also store application data, such as storing images, videos and other files.
移动终端200的通信功能可以通过移动通信模块204、天线1、无线通信模块205、天线2、调制解调处理器以及基带处理器等实现。天线1和天线2用于发射和接收电磁波信号。移动通信模块204可以提供应用在移动终端200上2G、3G、4G、5G等移动通信解决方案。无线通信模块205可以提供应用在移动终端200上的无线局域网、蓝牙、近场通信等无线通信解决方案。The communication function of the mobile terminal 200 can be realized by the mobile communication module 204, the antenna 1, the wireless communication module 205, the antenna 2, the modem processor and the baseband processor. Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 204 can provide 2G, 3G, 4G, 5G and other mobile communication solutions applied on the mobile terminal 200 . The wireless communication module 205 can provide wireless communication solutions such as wireless local area network, bluetooth, and near field communication applied on the mobile terminal 200 .
显示屏206用于实现显示功能,如显示用户界面、图像、视频等。传感器模块207用于实现各种感应检测功能,如可以包括压力传感器、陀螺仪传感器等,以实现触控压力、设备位姿的检测。音频模块208用于实现音频功能,如播放音频,采集语音等。电源模块209用于实现电源管理功能,如为电池充电、为设备供电、监测电池状态等。The display screen 206 is used to implement a display function, such as displaying a user interface, images, videos, and the like. The sensor module 207 is used to implement various sensing and detection functions, such as a pressure sensor, a gyroscope sensor, etc., to realize the detection of touch pressure and device pose. The audio module 208 is used to implement audio functions, such as playing audio, collecting voice, and so on. The power module 209 is used to implement power management functions, such as charging the battery, supplying power to the device, and monitoring the state of the battery.
摄像模块210可以包括镜头2101、图像传感器2102、光学防抖系统2103等组件。镜头2101用于成像以及调节光路;图像传感器2102用于采集光信号并转换为数字信号,该数字信号可以进一步传输至ISP进行处理;光学防抖系统2103用于稳定镜头2101,以防止成像抖动,提高图像质量。摄像模块210可用于采集目标用户的人脸图像。The camera module 210 may include a lens 2101 , an image sensor 2102 , an optical anti-shake system 2103 and other components. The lens 2101 is used for imaging and adjusting the optical path; the image sensor 2102 is used for collecting optical signals and converting them into digital signals, which can be further transmitted to the ISP for processing; the optical anti-shake system 2103 is used for stabilizing the lens 2101 to prevent imaging shake, Improve image quality. The camera module 210 can be used to capture the face image of the target user.
下面结合图3对本示例性实施方式的距离检测方法进行说明,图3示出了该距离检测方法的示例性流程,可以包括:The distance detection method of this exemplary embodiment will be described below in conjunction with FIG. 3. FIG. 3 shows an exemplary flow of the distance detection method, which may include:
步骤S310,获取由图像采集设备所采集的目标用户的人脸图像;Step S310, acquiring the face image of the target user collected by the image acquisition device;
步骤S320,在人脸图像中确定至少两种人脸预设部位的成像尺寸;Step S320, determining the imaging sizes of at least two preset parts of the face in the face image;
步骤S330,根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离。Step S330: Determine the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face.
基于上述方法,一方面,结合人脸图像中至少两种人脸预设部位的成像尺寸来确定目标用户与图像采集设备之间的距离,能够降低单一人脸预设部位的成像不稳定性所带来的影响,并且人脸图像受到光照等环境条件的影响较小,有利于提高距离检测的准确性。另一方面,本方案基于摄像头等图像采集设备即可实现,无需专门配置距离传感器,具有较低的硬件成本,特别适合于部署在手机等移动场景下。Based on the above method, on the one hand, the distance between the target user and the image acquisition device is determined by combining the imaging sizes of at least two preset parts of the face in the face image, which can reduce the instability caused by the imaging instability of a single preset part of the face. In addition, the face image is less affected by environmental conditions such as illumination, which is conducive to improving the accuracy of distance detection. On the other hand, this solution can be realized based on image acquisition devices such as cameras, without special configuration of distance sensors, and has low hardware cost, which is especially suitable for deployment in mobile scenarios such as mobile phones.
下面对图3中的每个步骤进行具体说明。Each step in Fig. 3 is described in detail below.
参考图3,在步骤S310中,获取由图像采集设备所采集的目标用户的人脸图像。Referring to FIG. 3 , in step S310 , the face image of the target user collected by the image collection device is acquired.
目标用户可以是位于图像采集设备的镜头前方的用户。例如,图像采集设备可以是手机的前置摄像头,当某个用户拿起手机时或使用手机的过程中,由前置摄像头采集该用户的人脸图像,该用户即目标用户。The target user may be a user located in front of the lens of the image capture device. For example, the image collection device may be a front camera of a mobile phone. When a user picks up the mobile phone or is using the mobile phone, the front camera collects the face image of the user, and the user is the target user.
在一些特定场景下,与距离检测相关的功能需要用户面对设备来实现。例如,上述手机的屏幕自动唤起、提示用户注意手机距离、门禁系统的触发身份验证都功能均需要在用户面对设备的情况下执行。基于此,图像采集设备所采集的目标用户的人脸图像可以是正面人脸图像,如果图像采集设备采集到某个用户的非正面人脸图像,则该用户可能并需要上述相关功能,即无需检测该用户与设备之间的距离。例如,手机拍摄到某个用户的俯视人脸图像,该用户可能并不是正在使用手机的用户,门禁系统拍摄到某个用户的侧脸图像,该用户可能是从门禁系统前经过的路人。因而,无需对这样的人脸图像进行处理。在一种实施方式中,步骤S310中所获取的人脸图像是正面人脸图像,如果图像采集设备采集到非正面人脸图像,则不对该非正面人脸图像进行后续处理。本公开对于检测人脸图像是否为正面人脸图像的具体方式不做限定。示例性的,可以检测人脸图像中的眼睛视线方向,如果眼睛视线方向为正视前方(即看向图像采集设备),则判断该人脸图像为正面人脸图像;也可以检测人脸图像中的人脸关键点,进而判断左侧的人脸关键点与右侧的人脸关键点是否为对称分布,如果为对称分布或近似对称分布,则判断 该人脸图像为正面人脸图像。In some specific scenarios, functions related to distance detection need to be implemented by the user facing the device. For example, the above functions of automatically waking up the screen of the mobile phone, prompting the user to pay attention to the distance of the mobile phone, and triggering identity verification of the access control system all need to be executed when the user faces the device. Based on this, the face image of the target user collected by the image acquisition device may be a frontal face image. If the image acquisition device collects a non-frontal face image of a certain user, the user may not need the above-mentioned relevant functions, that is, no Detect the distance between the user and the device. For example, if the mobile phone captures a user's overlooking face image, the user may not be using the mobile phone, and the access control system captures a user's profile image, and the user may be a passerby passing in front of the access control system. Therefore, there is no need to process such face images. In one embodiment, the human face image acquired in step S310 is a frontal human face image, and if the image acquisition device acquires a non-frontal human face image, no subsequent processing is performed on the non-frontal human face image. The present disclosure does not limit the specific manner of detecting whether the face image is a frontal face image. Exemplarily, the eye sight direction in the face image can be detected, if the eye sight direction is looking straight ahead (that is, looking at the image acquisition device), then it is judged that the face image is a frontal face image; The key points of the face, and then judge whether the key points of the face on the left and the key points of the face on the right are symmetrically distributed, and if they are symmetrically distributed or approximately symmetrically distributed, then it is judged that the face image is a frontal face image.
在一种实施方式中,可以对人脸图像进行预处理。例如,人脸图像包括了人脸以外的图像内容,如拍摄到目标用户的一部分身体,则可以通过裁剪仅保留人脸部分的图像;为了便于后续的处理,可以将人脸图像转换为统一的尺寸,如480*480,或者对人脸图像进行数值归一化等。In an implementation manner, preprocessing may be performed on the face image. For example, the face image includes image content other than the face. If a part of the body of the target user is captured, only the image of the face part can be retained by cropping; in order to facilitate subsequent processing, the face image can be converted into a unified Size, such as 480*480, or numerical normalization of face images, etc.
继续参考图3,在步骤S320中,在人脸图像中确定至少两种人脸预设部位的成像尺寸。Continuing to refer to FIG. 3 , in step S320 , the imaging sizes of at least two preset parts of the face are determined in the face image.
人脸预设部位是指尺寸较为固定、不显著地因人而异的部位,换而言之,不同人的人脸预设部位的尺寸差别一般较小。本示例性实施方式中,人脸预设部位包括但不限于:脸部,虹膜,瞳孔等。其中,脸部的尺寸包括脸部宽度与脸部高度,脸部宽度因人而异的程度较低;虹膜的尺寸一般指虹膜直径,虹膜的形状为圆形或接近圆形的椭圆形,可以将虹膜近似为圆形,该圆形的直径即虹膜直径,成年人的虹膜直径通常在11.8mm左右,偏差很小;瞳孔的尺寸一般指瞳孔间距(即左右瞳孔之间的距离,又称瞳距),成年人的瞳孔间距通常在58~61mm,因人而异的程度也较低。The preset face part refers to a part whose size is relatively fixed and does not vary significantly from person to person. In other words, the size difference of the preset face parts of different people is generally small. In this exemplary embodiment, the preset parts of the human face include but are not limited to: face, iris, pupil and so on. Among them, the size of the face includes the width of the face and the height of the face, and the width of the face varies from person to person to a lesser degree; The iris is approximated as a circle, and the diameter of the circle is the iris diameter. The iris diameter of an adult is usually about 11.8mm, and the deviation is very small; the pupil size generally refers to the interpupillary distance (that is, the distance between the left and right pupils, also known as the pupil Interpupillary distance), the interpupillary distance of adults is usually 58~61mm, and the degree of interpupillary distance varies from person to person.
以上所说的尺寸为实际尺寸,人脸预设部位在人脸图像中的尺寸为成像尺寸。由于透视关系,目标用户与图像采集设备之间的距离越近,人脸预设部位的成像尺寸越大,目标用户与图像采集设备之间的距离越远,人脸预设部位的成像尺寸越小。因此可以根据人脸预设部位的成像尺寸确定目标用户与图像采集设备之间的距离。The size mentioned above is the actual size, and the size of the preset part of the face in the face image is the imaging size. Due to the perspective relationship, the closer the distance between the target user and the image acquisition device, the larger the imaging size of the preset part of the face, and the farther the distance between the target user and the image acquisition device, the larger the imaging size of the preset part of the face. Small. Therefore, the distance between the target user and the image acquisition device can be determined according to the imaging size of the preset part of the face.
参考图4所示,在人脸图像中,可以确定三种人脸预设部位的成像尺寸,分别为脸部的成像宽度d face,虹膜的成像直径d iris,瞳孔的成像间距d pupil。成像尺寸可以是人脸预设部位在人脸图像中的像素尺寸,也可以是人脸预设部位在人脸图像的像平面上的投影尺寸,像素尺寸与投影尺寸的量纲不同,两者所表示的含义是相同的。 Referring to FIG. 4 , in the face image, the imaging sizes of three preset parts of the face can be determined, which are the imaging width d face of the face, the imaging diameter d iris of the iris, and the imaging distance d pupil of the pupils. The imaging size can be the pixel size of the preset part of the face in the face image, or the projection size of the preset part of the face on the image plane of the face image. The dimension of the pixel size and the projection size are different. The meaning expressed is the same.
在一种实施方式中,参考图5所示,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,可以包括以下步骤S510和S520:In one embodiment, referring to FIG. 5 , determining the imaging sizes of at least two preset parts of the face in the face image may include the following steps S510 and S520:
步骤S510,通过检测人脸图像中的人脸关键点,以确定人脸图像中的人脸预设部位;Step S510, by detecting the key points of the face in the face image, to determine the preset part of the face in the face image;
步骤S520,根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸。Step S520: Determine the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image.
其中,人脸关键点可以是人脸预设部位的关键点,如可以包括脸部轮廓关键点、虹膜关键点、瞳孔关键点等。Wherein, the key points of the human face may be key points of preset parts of the human face, for example, may include key points of facial outline, key points of iris, key points of pupils, and the like.
在一种实施方式中,可以预先训练用于检测上述人脸关键点的模型(如神经网络),将人脸图像输入该模型,通过模型输出人脸关键点。In one embodiment, a model (such as a neural network) for detecting the key points of the human face may be pre-trained, a human face image is input into the model, and the key points of the human face are output through the model.
一般的人脸关键点检测模型或算法可能无法检测虹膜关键点、瞳孔关键点,例如将人脸图像输入人脸关键点检测模型前,需要将人脸图像下采样至人脸关键点检测模型设定的输入尺寸,使得图像一定程度上失去细节信息,难以检测到虹膜、瞳孔这样细小的部位。在一种实施方式中,上述通过检测人脸图像中的人脸关键点,以确定人脸图像中的人脸预设部位,可以包括以下步骤:General face key point detection models or algorithms may not be able to detect iris key points and pupil key points. A certain input size makes the image lose detail information to a certain extent, making it difficult to detect such small parts as iris and pupil. In one embodiment, the above-mentioned detection of key points of the face in the face image to determine the preset position of the face in the face image may include the following steps:
检测人脸图像中的人脸关键点,该人脸关键点包括脸部轮廓关键点和眼部关键点;Detect face key points in the face image, the face key points include facial contour key points and eye key points;
根据脸部轮廓关键点确定人脸图像中的脸部;Determine the face in the face image according to the key points of the face contour;
基于眼部关键点从人脸图像中截取眼部图像,并在眼部图像中检测虹膜关键点和/或瞳孔关键点,以确定人脸图像中的虹膜和/或瞳孔。The eye image is intercepted from the human face image based on the eye key point, and the iris key point and/or pupil key point are detected in the eye image to determine the iris and/or pupil in the human face image.
示例性的,可以先通过一般的人脸关键点检测模型检测人脸图像中的脸部轮廓关键点与眼部关键点,示例性的,可以将人脸图像转换为320*320的尺寸,输入人脸关键点检测模型,该模型输出49个人脸关键点的信息,从中确定脸部轮廓关键点与眼部关键点。根据脸部轮廓关键点确定人脸图像中的脸部,如可以输出脸部的位置信息。根据眼部关键点确定眼部区域在人脸图像中的位置,然后从人脸图像中截取出眼部图像。应当理解,可以从原始的高分辨率人脸图像中截取眼部图像,使得眼部图像也具有高分辨率;或者在眼部图像分辨率较低的情况下,对其进行上采样。进而,可以通过虹膜或瞳孔检测模型检测眼部图像中的虹膜关键点和/或瞳孔关键点,从而得到所需的人脸预设部位的信息。Exemplarily, the face contour key points and eye key points in the face image can be detected by a general face key point detection model. Exemplarily, the face image can be converted to a size of 320*320, input Face key point detection model, which outputs information of 49 face key points, from which the key points of the face contour and the key points of the eyes are determined. Determine the face in the face image according to the key points of the face contour, for example, the position information of the face can be output. The position of the eye area in the face image is determined according to the key points of the eye, and then the eye image is cut out from the face image. It should be understood that the eye image may be cut from the original high-resolution face image so that the eye image also has a high resolution; or in the case of a low-resolution eye image, it may be up-sampled. Furthermore, the iris key points and/or pupil key points in the eye image can be detected by the iris or pupil detection model, so as to obtain the required information of the preset parts of the face.
根据人脸关键点可以确定人脸图像中的人脸预设部位,例如可以根据人脸关键点确定人脸预设部位的外边界,外边界可用于表征人脸预设部位的位置,或者根据外边界提取人脸预设部位的掩模(mask),同样可以表征人脸预设部位的位置。According to the key points of the human face, the preset position of the human face in the face image can be determined, for example, the outer boundary of the preset part of the human face can be determined according to the key points of the human face, and the outer boundary can be used to characterize the position of the preset position of the human face, or according to The outer boundary extracts the mask (mask) of the preset part of the face, which can also represent the position of the preset part of the face.
图6示出了将眼部区域图像输入虹膜检测模型,该模型为预先训练的图像分割网络,可以输出虹膜的信息,为虹膜区域的掩模。Fig. 6 shows that the image of the eye area is input into the iris detection model, which is a pre-trained image segmentation network and can output iris information, which is the mask of the iris area.
根据人脸预设部位在人脸图像中所覆盖的像素点,可以将人脸预设部位的尺寸以像素数加以表示,得到人脸预设部位的像素尺寸,或者将像素尺寸转换为投影尺寸,两种尺寸均为人脸预设部位的成像尺寸,本公开不限定具体采用哪种。According to the pixel points covered by the preset part of the face in the face image, the size of the preset part of the face can be expressed in pixels to obtain the pixel size of the preset part of the face, or convert the pixel size to the projection size , the two sizes are the imaging sizes of the preset parts of the face, and the disclosure does not limit which one is used specifically.
下面对于每种人脸预设部位的成像尺寸的计算方法进行示例性说明。The calculation method of the imaging size of each preset part of the face will be exemplified below.
在一种实施方式中,当人脸预设部位包括脸部时,上述根据人脸预设部位在人脸图像中所覆盖的像 素点,确定人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, when the preset part of the face includes a face, determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image may include the following steps :
在人脸图像中脸部所覆盖的像素点中,获取沿预设坐标轴方向的最小坐标值与最大坐标值,并根据最小坐标值与最大坐标值确定脸部的成像宽度。In the pixel points covered by the face in the face image, the minimum coordinate value and the maximum coordinate value along the direction of the preset coordinate axis are obtained, and the imaging width of the face is determined according to the minimum coordinate value and the maximum coordinate value.
其中,预设坐标轴方向为脸部的宽度方向,一般也是人脸图形中的水平方向(与人脸图像本身的方向相关,本公开不做限定),即x轴方向。获取脸部像素点中的最小x坐标值与最大x坐标值,两者相减即为脸部的成像宽度。Wherein, the preset coordinate axis direction is the width direction of the face, which is generally the horizontal direction in the face image (related to the direction of the face image itself, which is not limited in this disclosure), that is, the x-axis direction. Obtain the minimum x-coordinate value and maximum x-coordinate value of the face pixels, and subtract them to obtain the imaging width of the face.
在一种实施方式中,可以先根据脸部在人脸图像中所覆盖的像素点,确定脸部对称轴;例如可以对在脸部轮廓的像素点处生成法线,检测脸部的像素点是否以该法线对称,若是,则该法线为脸部对称轴。然后将脸部对称轴的垂直方向作为预设坐标轴方向,在脸部像素点中确定最小坐标值与最大坐标值,两者相减即为脸部的成像宽度。In one embodiment, the facial symmetry axis can be determined according to the pixels covered by the face in the face image; for example, the normal line can be generated at the pixel points of the facial contour to detect the pixel points of the face Whether to be symmetric about this normal, if so, this normal is the axis of symmetry of the face. Then, the vertical direction of the facial symmetry axis is used as the preset coordinate axis direction, and the minimum coordinate value and the maximum coordinate value are determined in the face pixel points, and the subtraction of the two is the imaging width of the face.
在一种实施方式中,当人脸预设部位包括虹膜时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, when the preset part of the face includes the iris, determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image may include the following steps:
根据虹膜在人脸图像中所包含的像素点数量,确定虹膜的成像面积;Determine the imaging area of the iris according to the number of pixels contained in the iris in the face image;
根据虹膜的成像面积确定虹膜的成像直径。The imaging diameter of the iris is determined according to the imaging area of the iris.
参考上述图6所示,可以根据虹膜区域的掩模统计虹膜在人脸图像中所包含的像素点数量,该像素点数量即为虹膜的成像面积S iris,再通过以下公式(1)计算虹膜的成像直径d irisReferring to the above-mentioned figure 6, the number of pixels contained in the iris in the face image can be counted according to the mask of the iris area, and the number of pixels is the imaging area Siris of the iris , and then the iris is calculated by the following formula (1): The imaging diameter d iris :
Figure PCTCN2022117067-appb-000001
Figure PCTCN2022117067-appb-000001
成像直径d iris也相当于虹膜的椭圆形中长轴与短轴的平均值的2倍。 The imaging diameter d iris is also equivalent to twice the average value of the major and minor axes of the ellipse of the iris.
在一种实施方式中,当人脸预设部位包括瞳孔时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, when the preset part of the face includes the pupil, determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image may include the following steps:
分别根据左瞳孔与右瞳孔在人脸图像中所覆盖的像素点,确定左瞳孔的中心点与右瞳孔的中心点。具体地,可以在左瞳孔的像素点中找到横坐标的中值与纵坐标的中值(中值也可以替换为平均值),横、纵坐标的中值所在的点即为左瞳孔的中心点。同理可得右瞳孔的中心点。The center point of the left pupil and the center point of the right pupil are determined respectively according to the pixel points covered by the left pupil and the right pupil in the face image. Specifically, the median value of the abscissa and ordinate can be found in the pixels of the left pupil (the median can also be replaced by the average value), and the point where the median of the abscissa and ordinate is located is the center of the left pupil point. In the same way, the center point of the right pupil can be obtained.
确定左瞳孔的中心点与右瞳孔的中心点之间的距离,即瞳孔的成像间距。Determine the distance between the center point of the left pupil and the center point of the right pupil, that is, the imaging distance of the pupils.
在一种实施方式中,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, the above-mentioned determination of the imaging sizes of at least two preset parts of the face in the face image may include the following steps:
将人脸图像输入预先训练的脸部尺寸检测模型,以输出人脸图像中脸部的成像宽度;Input the face image into the pre-trained face size detection model to output the imaging width of the face in the face image;
将人脸图像与脸部的成像宽度输入预先训练的虹膜尺寸检测模型或瞳孔尺寸检测模型,以输出人脸图像中虹膜的成像直径或瞳孔的成像间距。Input the face image and the imaging width of the face into the pre-trained iris size detection model or pupil size detection model to output the imaging diameter of the iris or the imaging distance of the pupils in the face image.
一般的,由于人脸图像中脸部所占的面积较大,受到图像低分辨率的影响较小,易于实现较为准确地尺寸检测。相对的,虹膜或瞳孔本身尺寸小,在人脸图像中所占的面积较小,受到图像低分辨率的影响较小,不易于实现准确地尺寸检测。因此,在检测虹膜尺寸或瞳孔尺寸时,可以将脸部的成像宽度作为一个维度的信息,与人脸图像共同输入虹膜尺寸检测模型或瞳孔尺寸检测模型,以提供参考,有利于提高虹膜尺寸或瞳孔尺寸的准确性。Generally, since the face occupies a large area in the face image, it is less affected by the low resolution of the image, and it is easy to achieve more accurate size detection. In contrast, the iris or pupil itself is small in size, occupies a small area in the face image, is less affected by the low resolution of the image, and is not easy to achieve accurate size detection. Therefore, when detecting iris size or pupil size, the imaging width of the face can be used as one-dimensional information, which can be input into the iris size detection model or pupil size detection model together with the face image to provide a reference, which is beneficial to improve the iris size or pupil size. Accuracy of pupil size.
在一种实施方式中,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, the above-mentioned determination of the imaging sizes of at least two preset parts of the face in the face image may include the following steps:
在人脸图像中确定脸部的成像宽度;Determining the imaging width of the face in the face image;
根据脸部的成像宽度与第一比例范围确定针对虹膜的第一尺寸范围;determining a first size range for the iris according to the imaging width of the face and the first scale range;
在人脸图像中确定虹膜的成像直径,若该成像直径处于第一尺寸范围内,则确定该成像直径有效。The imaging diameter of the iris is determined in the face image, and if the imaging diameter is within the first size range, it is determined that the imaging diameter is valid.
其中,第一比例范围是脸部宽度与虹膜直径的比例范围。由于脸部宽度与虹膜直径的大小均较为固定,两者的比例也较为固定,第一比例范围是根据经验确定的范围,脸部宽度与虹膜直径的比例通常处于该范围内。由此,先确定脸部的成像宽度,再通过第一比例范围计算对应的虹膜的第一尺寸范围,即假设脸部宽度与虹膜直径的比例处于第一比例范围的情况下,虹膜直径应当处于第一尺寸范围内。进而,在确定虹膜的成像直径后,通过第一尺寸范围判断该成像直径是否准确,若该成像直径处于第一尺寸范围内,则确定该成像直径的结果准确、有效;反之,若该成像直径未处于第一尺寸范围内,则确定该成像直径的结果不准确,可以不予保留。Wherein, the first ratio range is a ratio range of the face width to the iris diameter. Since the size of the face width and the iris diameter are relatively fixed, and the ratio of the two is also relatively fixed, the first ratio range is a range determined based on experience, and the ratio of the face width to the iris diameter is usually within this range. Therefore, first determine the imaging width of the face, and then calculate the first size range of the corresponding iris through the first ratio range, that is, assuming that the ratio of the face width to the iris diameter is in the first ratio range, the iris diameter should be in the within the first dimension. Furthermore, after determining the imaging diameter of the iris, judge whether the imaging diameter is accurate through the first size range, if the imaging diameter is within the first size range, then the result of determining the imaging diameter is accurate and effective; otherwise, if the imaging diameter If it is not within the first size range, the result of determining the imaging diameter is inaccurate and may not be retained.
在一种实施方式中,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,可以包括以下步骤:In one embodiment, the above-mentioned determination of the imaging sizes of at least two preset parts of the face in the face image may include the following steps:
在人脸图像中确定脸部的成像宽度;Determining the imaging width of the face in the face image;
根据脸部的成像宽度与第二比例范围确定针对瞳孔的第二尺寸范围;determining a second size range for the pupil according to the imaging width of the face and the second scale range;
在人脸图像中确定瞳孔的成像间距,若该成像间距处于第二尺寸范围内,则确定该成像间距有效。The imaging distance of the pupils is determined in the face image, and if the imaging distance is within the second size range, it is determined that the imaging distance is valid.
其中,第二比例范围是脸部宽度与瞳孔间距的比例范围。由于脸部宽度与瞳孔间距的大小均较为固定,两者的比例也较为固定,第二比例范围是根据经验确定的范围,脸部宽度与瞳孔间距的比例通常处于该范围内。由此,先确定脸部的成像宽度,再通过第二比例范围计算对应的瞳孔的第二尺寸范围,即 假设脸部宽度与瞳孔间距的比例处于第二比例范围的情况下,瞳孔间距应当处于第二尺寸范围内。进而,在确定瞳孔的成像间距后,通过第二尺寸范围判断该成像间距是否准确,若该成像间距处于第二尺寸范围内,则确定准确、有效,反之则可以不予保留。Wherein, the second ratio range is a ratio range between the face width and the interpupillary distance. Since the size of the face width and the interpupillary distance are relatively fixed, the ratio of the two is also relatively fixed. The second ratio range is a range determined based on experience, and the ratio of the face width to the interpupillary distance is usually within this range. Therefore, first determine the imaging width of the face, and then calculate the corresponding second size range of pupils through the second ratio range, that is, assuming that the ratio of the face width to the interpupillary distance is in the second ratio range, the interpupillary distance should be in the within the second size range. Furthermore, after determining the imaging distance of the pupils, judge whether the imaging distance is accurate through the second size range, if the imaging distance is within the second size range, it is determined to be accurate and effective, otherwise it may not be retained.
继续参考图3,在步骤S330中,根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离。Continuing to refer to FIG. 3 , in step S330 , the distance between the target user and the image acquisition device is determined according to the imaging sizes of the above-mentioned at least two preset parts of the face.
其中,每种人脸预设部位的成像尺寸均可以单独用于确定目标用户与图像采集设备之间的距离。然而,单一人脸预设部位的成像可能存在不稳定性,导致无法准确得到其成像尺寸。举例来说,人脸图像可能存在闭眼、遮挡、暗环境等情况,导致无法确定某一个或多个人脸预设部位(如闭眼时无法确定瞳孔与虹膜,脸部被遮挡时无法确定脸部,暗环境下影响人脸预设部位的识别),无法得到其成像尺寸;目标用户的人脸与图像采集设备的镜头存在相对角度,使得所采集的人脸图像并非完全正面的人脸图像,导致其中人脸预设部位的成像尺寸的误差;人脸图像的分辨率较低或局部不清晰时,导致人脸关键点的检测与人脸预设部位的确定上存在误差,进而导致人脸预设部位的成像尺寸的误差,特别是以像素尺寸表示成像尺寸时,虹膜等尺寸较小的人脸预设部位所占的区域往往小于20个像素,这样一个像素的误差会导致这样人脸预设部位的成像尺寸上较大的误差;成像过程中的畸变、噪声、失真等缺陷所导致的人脸预设部位的成像尺寸的误差,等等。本示例性实施方式结合由多种人脸预设部位的成像尺寸来确定目标用户与图像采集设备之间的距离,能够降低单一人脸预设部位的成像尺寸的误差所带来的影响,有利于提高距离检测的准确性。Wherein, the imaging size of each preset part of the face can be used independently to determine the distance between the target user and the image acquisition device. However, the imaging of a preset part of a single face may be unstable, resulting in an inability to accurately obtain its imaging size. For example, the face image may have closed eyes, occlusion, dark environment, etc., resulting in the inability to determine one or more preset parts of the face (such as the pupil and iris cannot be determined when the eyes are closed, and the face cannot be determined when the face is occluded). In the dark environment, the recognition of the preset parts of the face is affected), and its imaging size cannot be obtained; there is a relative angle between the face of the target user and the lens of the image acquisition device, so that the collected face image is not a completely frontal face image , leading to the error of the imaging size of the preset part of the face; when the resolution of the face image is low or the part is not clear, there will be errors in the detection of the key points of the face and the determination of the preset part of the face, which will lead to human The error of the imaging size of the preset part of the face, especially when the imaging size is represented by the pixel size, the area occupied by the preset part of the face with a smaller size such as the iris is often less than 20 pixels, such an error of one pixel will cause such a person Large errors in the imaging size of the preset parts of the face; errors in the imaging size of the preset parts of the face caused by defects such as distortion, noise, and distortion in the imaging process, and so on. In this exemplary embodiment, the distance between the target user and the image acquisition device is determined by the imaging size of various preset parts of the face, which can reduce the impact of the error of the imaging size of a single preset part of the face, and has It is beneficial to improve the accuracy of distance detection.
在一种实施方式中,上述根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离,可以包括以下步骤:In one embodiment, the determination of the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face may include the following steps:
分别根据每种人脸预设部位的实际尺寸与成像尺寸的比例以及图像采集设备的成像参数,确定目标用户与图像采集设备之间的候选距离。The candidate distance between the target user and the image acquisition device is determined according to the ratio of the actual size of each preset part of the face to the imaging size and the imaging parameters of the image acquisition device.
基于每种人脸预设部位的成像尺寸所对应的候选距离,确定目标用户与图像采集设备之间的距离。Based on the candidate distance corresponding to the imaging size of each preset part of the face, the distance between the target user and the image acquisition device is determined.
参考图7所示,以脸部为例,D face表示脸部的实际宽度,d face表示脸部的成像宽度,Z face表示目标用户与图像采集设备之间的距离,由于是根据脸部的成像宽度所确定的,称为脸部的成像宽度所对应的候选距离;z表示图像采集设备的成像参数,当d face为投影尺寸时,该成像参数与图像采集设备的焦距、视场角相关,当d face为像素尺寸时,该成像参数与图像采集设备的焦距、视场角、人脸图像的分辨率以及图像传感器的尺寸相关。根据相似三角形的关系,有如下公式(2): As shown in FIG. 7, taking the face as an example, D face represents the actual width of the face, d face represents the imaging width of the face, and Z face represents the distance between the target user and the image acquisition device. Determined by the imaging width, it is called the candidate distance corresponding to the imaging width of the face; z represents the imaging parameter of the image acquisition device. When d face is the projection size, the imaging parameter is related to the focal length and field angle of the image acquisition device , when d face is the pixel size, the imaging parameter is related to the focal length of the image acquisition device, the angle of view, the resolution of the face image, and the size of the image sensor. According to the relationship of similar triangles, there is the following formula (2):
Figure PCTCN2022117067-appb-000002
Figure PCTCN2022117067-appb-000002
由此可以计算出脸部的成像宽度所对应的候选距离Z face。同理可得虹膜的成像直径所对应的候选距离Z iris,以及瞳孔的成像间距所对应的候选距离Z pupilAccordingly, the candidate distance Z face corresponding to the imaging width of the face can be calculated. Similarly, the candidate distance Z iris corresponding to the imaging diameter of the iris and the candidate distance Z pupil corresponding to the imaging distance of the pupils can be obtained.
进而,通过结合上述两个或更多的候选距离,可以确定目标用户与图像采集设备之间的距离,作为距离检测的结果。例如,可以对多个候选距离计算平均值或加权平均值,得到最终的距离。Furthermore, by combining the above two or more candidate distances, the distance between the target user and the image acquisition device can be determined as a result of the distance detection. For example, an average or weighted average may be calculated for multiple candidate distances to obtain the final distance.
在一种实施方式中,上述基于每种人脸预设部位的成像尺寸所对应的候选距离,确定目标用户与图像采集设备之间的距离,可以包括以下步骤:In one embodiment, determining the distance between the target user and the image acquisition device based on the candidate distance corresponding to the imaging size of each preset part of the face may include the following steps:
根据至少一种人脸预设部位的成像尺寸或者至少一个候选距离,确定每种人脸预设部位的权重;Determine the weight of each preset face part according to the imaging size of at least one preset face part or at least one candidate distance;
基于每种人脸预设部位的权重,对每种人脸预设部位的成像尺寸所对应的候选距离进行加权,得到目标用户与所述图像采集设备之间的距离。Based on the weight of each preset part of the face, the candidate distance corresponding to the imaging size of each preset part of the face is weighted to obtain the distance between the target user and the image acquisition device.
一般的,人脸预设部位的实际尺寸越大,该人脸预设部位在低分辨率的人脸图像中成像尺寸的误差相对越小,该人脸预设部位的实际尺寸因人而异的程度越高,即该人脸预设部位的实际尺寸越不稳定。例如,按照实际尺寸大小,有脸部宽度>瞳孔间距>虹膜直径,在人脸图像分辨率较低的情况下,这三个人脸预设部位的成像尺寸的误差依次递增,从低分辨率的因素来说,可以为脸部、瞳孔、虹膜设置递减的权重;然而,按照实际尺寸不稳定的程度,有脸部宽度>瞳孔间距>虹膜直径,也就是说,这三个人脸预设部位的实际尺寸的误差依次递减,从实际尺寸不稳定的因素来说,可以为脸部、瞳孔、虹膜设置递增的权重。因此,可以通过平衡这两方面因素,来确定每种人脸预设部位的权重,例如,选取任一种人脸预设部位,其成像尺寸越大或者其成像尺寸对应的候选距离越小,说明目标用户与图像采集设备之间的距离越近,此时在人脸图像中容易得到较为清晰的瞳孔或虹膜信息,即低分辨率因素的影响较小,因此可以为瞳孔或虹膜设置较高的权重;反之,上述人脸预设部位的成像尺寸越小或者其成像尺寸对应的候选距离越大,说明目标用户与图像采集设备之间的距离越远,此时在人脸图像中不容易得到较为清晰的瞳孔或虹膜信息,即低分辨率因素的影响较大,因此可以为脸部设置较高的权重。Generally, the larger the actual size of the preset part of the face, the smaller the error of the imaging size of the preset part of the face in the low-resolution face image, and the actual size of the preset part of the face varies from person to person The higher the degree is, the more unstable the actual size of the preset part of the face is. For example, according to the actual size, there is face width > interpupillary distance > iris diameter. When the resolution of the face image is low, the errors of the imaging sizes of the three preset parts of the face increase in turn, from the low-resolution In terms of factors, you can set decreasing weights for the face, pupil, and iris; however, according to the degree of instability of the actual size, there is face width > interpupillary distance > iris diameter, that is, the three preset parts of the face The error of the actual size decreases successively. From the perspective of factors that are unstable in the actual size, increasing weights can be set for the face, pupil, and iris. Therefore, the weight of each preset part of the face can be determined by balancing these two factors. For example, if any preset part of the face is selected, the larger the imaging size or the smaller the candidate distance corresponding to the imaging size, It shows that the closer the distance between the target user and the image acquisition device, the clearer the pupil or iris information can be easily obtained in the face image at this time, that is, the influence of the low resolution factor is less, so the pupil or iris can be set higher On the contrary, the smaller the imaging size of the above-mentioned preset parts of the face or the larger the candidate distance corresponding to the imaging size, the farther the distance between the target user and the image acquisition device is. Clearer pupil or iris information is obtained, that is, the influence of low-resolution factors is greater, so a higher weight can be set for the face.
示例性的,当选取脸部与虹膜这两种人脸预设部位来进行距离检测时,可以通过以下公式(3)确定每种人脸预设部位的权重:Exemplarily, when the two preset parts of the face and the iris are selected for distance detection, the weight of each preset part of the face can be determined by the following formula (3):
Figure PCTCN2022117067-appb-000003
Figure PCTCN2022117067-appb-000003
其中,w iris表示虹膜的权重,w face表示脸部的权重;e1为线性系数,可以是经验数值。进而,可以通过以下公式(4)来确定目标用户与图像采集设备之间的距离Z: Among them, wiris represents the weight of the iris, and w face represents the weight of the face; e1 is a linear coefficient, which can be an empirical value. Furthermore, the distance Z between the target user and the image acquisition device can be determined by the following formula (4):
Z=w iris·Z iris+w face·Z face(4) Z=w iris Z iris +w face Z face (4)
当选取脸部、瞳孔与虹膜三种人脸预设部位来进行距离检测时,可以通过以下公式(5)确定每种人脸预设部位的权重:When selecting the face, pupil and iris three preset parts of the face for distance detection, the weight of each preset part of the face can be determined by the following formula (5):
Figure PCTCN2022117067-appb-000004
Figure PCTCN2022117067-appb-000004
其中,w pupil表示瞳孔的权重;e2与e3均为线性系数,可以是经验数值。进而,可以通过以下公式(6)来确定目标用户与图像采集设备之间的距离Z: Among them, w pupil represents the weight of the pupil; both e2 and e3 are linear coefficients, which can be empirical values. Furthermore, the distance Z between the target user and the image acquisition device can be determined by the following formula (6):
Z=w iris·Z iris+w pupil·Z pupil+w face·Z face(6) Z=w iris Z iris +w pupil Z pupil +w face Z face (6)
由此,根据实际因素对两种以上人脸预设部位的成像尺寸所对应的候选距离进行加权,结合了不同人脸预设部位的信息,有利于输出准确的距离检测结果。Therefore, weighting the candidate distances corresponding to the imaging sizes of more than two preset parts of the face according to actual factors, and combining the information of different preset parts of the face is beneficial to output accurate distance detection results.
本公开的示例性实施方式还提供另一种距离检测方法。图8示出了该距离检测方法的示例性流程,可以包括以下步骤S810至S840:Exemplary embodiments of the present disclosure also provide another distance detection method. FIG. 8 shows an exemplary flow of the distance detection method, which may include the following steps S810 to S840:
步骤S810,获取由图像采集设备所采集的目标用户的人脸图像。Step S810, acquiring the face image of the target user collected by the image collection device.
该步骤的具体实施方式请参考步骤S310的相关内容。For the specific implementation manner of this step, please refer to the relevant content of step S310.
步骤S820,在人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位。Step S820, determining at least one first predetermined face part in the face preset part in the face image.
其中,人脸预设部位包括但不限于:脸部、瞳孔、虹膜,等。第一人脸预设部位用于对目标用户与图像采集设备之间的距离进行初步估计。可以选取任一种人脸预设部位作为第一人脸预设部位。Wherein, the preset parts of the face include but not limited to: face, pupil, iris, and so on. The first preset part of the human face is used for preliminary estimation of the distance between the target user and the image acquisition device. Any one of the preset parts of the face can be selected as the first preset part of the face.
在一种实施方式中,可以将人脸图像中成像尺寸最大的人脸预设部位确定为第一人脸预设部位,例如脸部的尺寸一般大于瞳孔与虹膜,可以将脸部确定为第一人脸预设部位。In one embodiment, the preset part of the face with the largest imaging size in the face image can be determined as the first preset part of the face. For example, the size of the face is generally larger than the pupil and iris, and the face can be determined as the first preset part. A preset part of a face.
在一种实施方式中,可以将人脸图像中成像尺寸大于预定尺寸阈值的人脸预设部位确定为第一人脸预设部位,以保证第一人脸预设部位的成像尺寸不会过小,降低误差。In one embodiment, the preset face part whose imaging size is greater than a predetermined size threshold in the face image can be determined as the first preset part of the face, so as to ensure that the imaging size of the first preset part of the face will not be too large. Small, reduce the error.
需要说明的是,本公开对于第一人脸预设部位的数量不做限定。It should be noted that the present disclosure does not limit the number of preset parts of the first human face.
步骤S830,根据人脸图像中第一人脸预设部位的成像尺寸,在人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位。Step S830, according to the imaging size of the first predetermined face part in the face image, determine at least one second preset part of the face in the preset parts of the face in the face image.
第二人脸预设部位用于对目标用户与图像采集设备之间的距离进行准确计算,可以是结合低分辨率因素与实际尺寸不稳定因素两方面考虑后所确定的。一般的,在低分辨率因素影响较小的情况下,倾向于将实际尺寸较小、较稳定的人脸预设部位作为第二人脸预设部位。本示例性实施方式中,根据人脸图像中第一人脸预设部位的成像尺寸,可以初步估计目标用户与图像采集设备之间的距离,进而确定低分辨率因素的影响大小。The second preset part of the face is used to accurately calculate the distance between the target user and the image acquisition device, and may be determined after considering two aspects of the low resolution factor and the unstable factor of the actual size. Generally, in the case where the influence of the low-resolution factor is small, the preset face part with a smaller actual size and more stable tends to be used as the second preset part of the face. In this exemplary embodiment, according to the imaging size of the first preset part of the face in the face image, the distance between the target user and the image acquisition device can be preliminarily estimated, and then the influence of the low-resolution factor can be determined.
在一种实施方式中,可以针对脸部的成像宽度预先设置第一阈值,步骤S830可以包括:In one embodiment, the first threshold may be preset for the imaging width of the face, and step S830 may include:
当人脸图像中脸部的成像宽度大于第一阈值时,将人脸图像中的虹膜确定为第二人脸预设部位;When the imaging width of the face in the face image is greater than the first threshold, the iris in the face image is determined as the second preset part of the face;
当人脸图像中脸部的成像宽度小于第一阈值时,将脸部确定为第二人脸预设部位。When the imaging width of the face in the face image is smaller than the first threshold, the face is determined as the second preset part of the face.
其中,第一阈值可以根据经验以及图像采集设备的参数来确定,例如对于某型号手机,第一阈值可以是110像素。当人脸图像中脸部的成像宽度大于110像素时,估计目标用户与图像采集设备之间的距离小于30cm,此时人脸图像中虹膜区域较为清晰,即低分辨率因素的影响较小,可以将虹膜确定为第二人脸预设部位。当人脸图像中脸部的成像宽度小于110像素时,估计目标用户与图像采集设备之间的距离大于30cm,此时人脸图像中虹膜区域不清晰,即低分辨率因素的影响较大,可以将脸部确定为第二人脸预设部位。Wherein, the first threshold may be determined according to experience and parameters of the image acquisition device, for example, for a certain type of mobile phone, the first threshold may be 110 pixels. When the imaging width of the face in the face image is greater than 110 pixels, it is estimated that the distance between the target user and the image acquisition device is less than 30 cm. At this time, the iris area in the face image is relatively clear, that is, the influence of low resolution factors is small. The iris can be determined as the second preset part of the human face. When the imaging width of the face in the face image is less than 110 pixels, it is estimated that the distance between the target user and the image acquisition device is greater than 30 cm. At this time, the iris area in the face image is not clear, that is, the low resolution factor has a greater impact. The face can be determined as the second preset part of the human face.
在一种实施方式中,可以针对脸部的成像宽度预先设置第二阈值和第三阈值,第二阈值大于第三阈值,步骤S830可以包括:In one embodiment, a second threshold and a third threshold may be preset for the imaging width of the face, and the second threshold is greater than the third threshold. Step S830 may include:
当人脸图像中脸部的成像宽度大于第二阈值时,将虹膜确定为第二人脸预设部位;When the imaging width of the face in the face image is greater than the second threshold, the iris is determined as the second preset part of the face;
当人脸图像中脸部的成像宽度小于第二阈值且大于第三阈值时,将瞳孔确定为第二人脸预设部位;When the imaging width of the face in the face image is less than the second threshold and greater than the third threshold, the pupil is determined as the second preset part of the face;
当人脸图像中脸部的成像宽度小于第三阈值时,将脸部确定为第二人脸预设部位。When the imaging width of the face in the face image is smaller than the third threshold, the face is determined as the second preset part of the face.
其中,第二阈值、第三阈值可以根据经验以及图像采集设备的参数来确定。可见,随着低分辨率因素的影响减小,倾向于采用更小的人脸预设部位作为第二人脸预设部位。Wherein, the second threshold and the third threshold may be determined according to experience and parameters of the image acquisition device. It can be seen that as the influence of the low-resolution factor decreases, a smaller preset face part tends to be used as the second preset face part.
需要说明的是,本公开对于第二人脸预设部位的数量也不做限定。It should be noted that, the present disclosure does not limit the number of preset parts of the second human face.
步骤S840,根据人脸图像中第二人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的 距离。Step S840: Determine the distance between the target user and the image acquisition device according to the imaging size of the second preset part of the face in the face image.
可以参考上述图6及其相关内容,根据相似三角形的关系计算目标用户与图像采集设备之间的距离。The distance between the target user and the image acquisition device can be calculated according to the relationship of similar triangles with reference to the above-mentioned FIG. 6 and related contents.
当选取多种第二人脸预设部位时,可以参考步骤S330的相关内容,结合多种第二人脸预设部位的成像尺寸来确定距离。When multiple second preset parts of the human face are selected, the distance can be determined in combination with the imaging sizes of the multiple second preset parts of the human face with reference to the relevant content in step S330.
基于图8所示的方法,一方面,通过第一人脸预设部位来初步估计目标用户与图像采集设备之间的距离,以根据实际因素确定合适的第二人脸预设部位,进而根据第二人脸预设部位的成像尺寸最终确定目标用户与图像采集设备之间的距离,能够降低单一人脸预设部位的成像不稳定性所带来的影响,并且人脸图像受到光照等环境条件的影响较小,有利于提高距离检测的准确性。另一方面,本方案基于摄像头等图像采集设备即可实现,无需专门配置距离传感器,具有较低的硬件成本,特别适合于部署在手机等移动场景下。Based on the method shown in Figure 8, on the one hand, the distance between the target user and the image acquisition device is preliminarily estimated through the first preset part of the face, so as to determine a suitable second preset part of the face according to actual factors, and then according to The imaging size of the second preset part of the face finally determines the distance between the target user and the image acquisition device, which can reduce the impact of the imaging instability of a single preset part of the face, and the face image is affected by the environment such as light The influence of conditions is small, which is beneficial to improve the accuracy of distance detection. On the other hand, this solution can be realized based on image acquisition devices such as cameras, without special configuration of distance sensors, and has low hardware cost, which is especially suitable for deployment in mobile scenarios such as mobile phones.
在一种实施方式中,图8所示的距离检测方法可以通过图9所示的流程实现,包括:In one embodiment, the distance detection method shown in FIG. 8 can be implemented through the process shown in FIG. 9, including:
步骤S910,输入人脸图像,该人脸图像是由图像采集设备所采集的目标用户的人脸图像;Step S910, input a face image, the face image is the face image of the target user collected by the image acquisition device;
步骤S920,检测人脸关键点,以脸部为第一人脸预设部位;Step S920, detecting the key points of the human face, using the face as the first preset part of the human face;
步骤S930,确定脸部的成像宽度;Step S930, determining the imaging width of the face;
步骤S940,判断脸部的成像宽度是否大于第一阈值,若是,则执行步骤S950,若否,则执行步骤S960;Step S940, judging whether the imaging width of the face is greater than the first threshold, if yes, execute step S950, if not, execute step S960;
步骤S950,以虹膜为第二人脸预设部位,进行虹膜检测,继续执行步骤S970;Step S950, using the iris as the preset part of the second face to detect the iris, and continue to execute step S970;
步骤S960,以脸部为第二人脸预设部位,继续执行步骤S970;Step S960, taking the face as the preset part of the second human face, and proceed to step S970;
步骤S970,确定第二人脸预设部位的成像尺寸;Step S970, determining the imaging size of the preset part of the second face;
步骤S980,根据第二人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离。流程结束。Step S980: Determine the distance between the target user and the image acquisition device according to the imaging size of the preset part of the second face. The process ends.
本公开的示例性实施方式还提供一种控制方法。参考图10所示,该控制方法可以包括以下步骤S1010和S1020:Exemplary embodiments of the present disclosure also provide a control method. Referring to Fig. 10, the control method may include the following steps S1010 and S1020:
步骤S1010,获取目标用户与图像采集设备之间的距离,该距离是根据本示例性实施方式中的距离检测方法所检测得到的;Step S1010, acquiring the distance between the target user and the image acquisition device, which is detected according to the distance detection method in this exemplary embodiment;
步骤S1020,根据上述距离生成对应的控制指令。Step S1020, generating a corresponding control instruction according to the above distance.
其中,该控制指令可以是任意方面的指令,如针对电子设备显示屏的控制指令,针对当前运行的应用程序的控制指令。一般的,可以预先配置特定距离或距离范围所对应的控制指令,进而在运行中当检测到距离满足所配置的距离或距离范围时,触发生成并执行对应的控制指令。示例性,当目标用户与图像采集设备之间的距离小于20cm时,可以生成呈现提示信息的控制指令,该提示信息用于提示用户注意手机距离以及保护眼睛,可以是文字或语音信息;当目标用户与图像采集设备之间的距离大于40cm时,可以生成息屏的控制指令,以控制电子设备进入息屏状态。Wherein, the control instruction may be an instruction in any aspect, such as a control instruction for a display screen of an electronic device, or a control instruction for a currently running application program. Generally, control instructions corresponding to a specific distance or distance range may be pre-configured, and then when it is detected that the distance satisfies the configured distance or distance range during operation, the corresponding control instruction is triggered to be generated and executed. Exemplarily, when the distance between the target user and the image acquisition device is less than 20cm, a control instruction for presenting prompt information may be generated, and the prompt information is used to prompt the user to pay attention to the distance of the mobile phone and protect the eyes, which may be text or voice information; when the target When the distance between the user and the image acquisition device is greater than 40 cm, a control instruction for keeping the screen off may be generated to control the electronic device to enter the screen-off state.
在一种实施方式中,还可以预先配置特定场景下特定距离或距离范围所对应的控制指令,该特定场景可以是运行特定的应用程序,电子设备处于特定的运行状态等。由此,在步骤S1020中,可以根据上述距离以及电子设备当前的运行场景来生成对应的控制指令。例如,在播放视频的场景下,当目标用户与图像采集设备之间的距离小于20cm时,可以生成呈现上述提示信息的控制指令;在显示桌面的场景下或用户超过预设时间未操作的状态下,当目标用户与图像采集设备之间的距离大于40cm时,可以生成息屏的控制指令。In an implementation manner, control instructions corresponding to a specific distance or distance range in a specific scenario may also be pre-configured. The specific scenario may be running a specific application program, the electronic device is in a specific operating state, and the like. Thus, in step S1020, a corresponding control command may be generated according to the above distance and the current operating scene of the electronic device. For example, in the scene of playing video, when the distance between the target user and the image acquisition device is less than 20cm, a control command to present the above prompt information can be generated; Next, when the distance between the target user and the image acquisition device is greater than 40cm, a control instruction for the screen can be generated.
基于图10所示的方法,能够根据用户与设备的距离执行对应的控制指令,实现了自动化、智能化地控制,并能够减少用户操作,提升用户体验。Based on the method shown in FIG. 10 , corresponding control instructions can be executed according to the distance between the user and the device, realizing automatic and intelligent control, reducing user operations and improving user experience.
本公开的示例性实施方式还提供一种距离检测装置。参考图11所示,该距离检测装置1100可以包括处理器1110和存储器1120。存储器1120包括以下程序模块:Exemplary embodiments of the present disclosure also provide a distance detection device. Referring to FIG. 11 , the distance detecting device 1100 may include a processor 1110 and a memory 1120 . Memory 1120 includes the following program modules:
图像获取模块1121,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module 1121 is configured to acquire the face image of the target user collected by the image acquisition device;
成像尺寸确定模块1122,被配置为在人脸图像中确定至少两种人脸预设部位的成像尺寸;The imaging size determination module 1122 is configured to determine the imaging sizes of at least two preset parts of the face in the face image;
距离确定模块1123,被配置为根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离;The distance determination module 1123 is configured to determine the distance between the target user and the image acquisition device according to the imaging sizes of the above-mentioned at least two preset parts of the face;
处理器1110用于执行上述程序模块。The processor 1110 is used to execute the above program modules.
本公开的示例性实施方式还提供另一种距离检测装置。参考图12所示,该距离检测装置1200可以包括:Exemplary embodiments of the present disclosure also provide another distance detection device. Referring to Figure 12, the distance detection device 1200 may include:
图像获取模块1210,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module 1210 is configured to acquire the face image of the target user collected by the image acquisition device;
成像尺寸确定模块1220,被配置为在人脸图像中确定至少两种人脸预设部位的成像尺寸;The imaging size determination module 1220 is configured to determine the imaging sizes of at least two preset parts of the face in the face image;
距离确定模块1230,被配置为根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像 采集设备之间的距离。The distance determination module 1230 is configured to determine the distance between the target user and the image acquisition device according to the imaging sizes of the above-mentioned at least two preset parts of the face.
在一种实施方式中,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:In one embodiment, the determination of the imaging sizes of at least two preset parts of the face in the face image includes:
通过检测人脸图像中的人脸关键点,以确定人脸图像中的人脸预设部位;By detecting the key points of the face in the face image, to determine the preset part of the face in the face image;
根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸。The imaging size of the preset part of the face is determined according to the pixels covered by the preset part of the face in the face image.
在一种实施方式中,上述检测人脸图像中的人脸关键点,确定人脸图像中的人脸预设部位,包括:In one embodiment, the above-mentioned detection of key points of the face in the face image, and determining the preset position of the face in the face image include:
检测人脸图像中的人脸关键点,人脸关键点包括脸部轮廓关键点和眼部关键点;Detect the key points of the face in the face image, including the key points of the face contour and the key points of the eyes;
根据脸部轮廓关键点确定人脸图像中的脸部;Determine the face in the face image according to the key points of the face contour;
基于眼部关键点从人脸图像中截取眼部图像,并在眼部图像中检测虹膜关键点和/或瞳孔关键点,以确定人脸图像中的虹膜和/或瞳孔。The eye image is intercepted from the human face image based on the eye key point, and the iris key point and/or pupil key point are detected in the eye image to determine the iris and/or pupil in the human face image.
在一种实施方式中,当人脸预设部位包括脸部时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,包括:In one embodiment, when the preset part of the face includes a face, determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image includes:
在人脸图像中脸部所覆盖的像素点中,获取沿预设坐标轴方向的最小坐标值与最大坐标值,并根据最小坐标值与最大坐标值确定脸部的成像宽度。In the pixel points covered by the face in the face image, the minimum coordinate value and the maximum coordinate value along the direction of the preset coordinate axis are obtained, and the imaging width of the face is determined according to the minimum coordinate value and the maximum coordinate value.
在一种实施方式中,当人脸预设部位包括脸部时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,还包括:In one embodiment, when the preset part of the face includes a face, the above-mentioned determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image further includes:
根据脸部在人脸图像中所覆盖的像素点,确定脸部对称轴,将脸部对称轴的垂直方向作为预设坐标轴方向。According to the pixel points covered by the face in the face image, the symmetry axis of the face is determined, and the vertical direction of the symmetry axis of the face is taken as the direction of the preset coordinate axis.
在一种实施方式中,当人脸预设部位包括虹膜时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,包括:In one embodiment, when the preset part of the face includes the iris, determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image includes:
根据虹膜在人脸图像中所覆盖的像素点数量,确定虹膜的成像面积;Determine the imaging area of the iris according to the number of pixels covered by the iris in the face image;
根据虹膜的成像面积确定虹膜的成像直径。The imaging diameter of the iris is determined according to the imaging area of the iris.
在一种实施方式中,当人脸预设部位包括瞳孔时,上述根据人脸预设部位在人脸图像中所覆盖的像素点,确定人脸预设部位的成像尺寸,包括:In one embodiment, when the preset part of the face includes the pupil, the above-mentioned determining the imaging size of the preset part of the face according to the pixels covered by the preset part of the face in the face image includes:
分别根据左瞳孔与右瞳孔在人脸图像中所覆盖的像素点,确定左瞳孔的中心点与右瞳孔的中心点;Determining the center point of the left pupil and the center point of the right pupil according to the pixel points covered by the left pupil and the right pupil respectively in the face image;
确定左瞳孔的中心点与右瞳孔的中心点之间的距离,得到瞳孔的成像间距。The distance between the center point of the left pupil and the center point of the right pupil is determined to obtain the imaging distance of the pupils.
在一种实施方式中,人脸预设部位包括脸部和虹膜,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:In one embodiment, the predetermined parts of the human face include the face and the iris, and the above-mentioned determination of the imaging sizes of at least two preset parts of the human face in the human face image includes:
在人脸图像中确定脸部的成像宽度;Determining the imaging width of the face in the face image;
根据脸部的成像宽度与第一比例范围确定针对虹膜的第一尺寸范围;determining a first size range for the iris according to the imaging width of the face and the first scale range;
在人脸图像中确定虹膜的成像直径,若成像直径处于第一尺寸范围内,则确定成像直径有效。The imaging diameter of the iris is determined in the face image, and if the imaging diameter is within the first size range, it is determined that the imaging diameter is valid.
在一种实施方式中,人脸预设部位包括脸部和瞳孔,上述在人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:In one embodiment, the predetermined parts of the human face include the face and the pupil, and the above-mentioned determination of the imaging sizes of at least two preset parts of the human face in the human face image includes:
在人脸图像中确定脸部的成像宽度;Determining the imaging width of the face in the face image;
根据脸部的成像宽度与第二比例范围确定针对虹膜的第二尺寸范围;determining a second size range for the iris according to the imaging width of the face and the second scale range;
在人脸图像中确定瞳孔的成像间距,若成像间距处于第二尺寸范围内,则确定成像间距有效。The imaging distance of the pupils is determined in the face image, and if the imaging distance is within the second size range, it is determined that the imaging distance is valid.
在一种实施方式中,上述根据上述至少两种人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离,包括:In one embodiment, the determination of the distance between the target user and the image acquisition device based on the imaging sizes of the at least two preset parts of the face includes:
分别根据每种人脸预设部位的实际尺寸与成像尺寸的比例以及图像采集设备的成像参数,确定目标用户与图像采集设备之间的候选距离;Determine the candidate distance between the target user and the image acquisition device according to the ratio of the actual size of each preset part of the face to the imaging size and the imaging parameters of the image acquisition device;
基于每种人脸预设部位的成像尺寸所对应的候选距离,确定目标用户与图像采集设备之间的距离。Based on the candidate distance corresponding to the imaging size of each preset part of the face, the distance between the target user and the image acquisition device is determined.
在一种实施方式中,上述基于每种人脸预设部位的成像尺寸对应的候选距离,确定目标用户与图像采集设备之间的距离,包括:In one embodiment, the above-mentioned candidate distance corresponding to the imaging size of each preset part of the face is used to determine the distance between the target user and the image acquisition device, including:
根据至少一种人脸预设部位的成像尺寸或者至少一个候选距离,确定每种人脸预设部位的权重;Determine the weight of each preset face part according to the imaging size of at least one preset face part or at least one candidate distance;
基于每种人脸预设部位的权重,对每种人脸预设部位的成像尺寸所对应的候选距离进行加权,得到目标用户与图像采集设备之间的距离。Based on the weight of each preset face part, the candidate distance corresponding to the imaging size of each preset face part is weighted to obtain the distance between the target user and the image acquisition device.
在一种实施方式中,人脸预设部位包括脸部和虹膜,上述至少一种人脸预设部位的成像尺寸包括脸部的成像宽度;上述根据至少一种人脸预设部位的成像尺寸或者至少一个候选距离,确定每种人脸预设部位的权重,包括:In one embodiment, the preset parts of the face include the face and the iris, and the imaging size of the at least one preset part of the face includes the imaging width of the face; Or at least one candidate distance to determine the weight of each preset part of the face, including:
通过以下公式确定脸部的权重和虹膜的权重:The weight of the face and the weight of the iris are determined by the following formula:
Figure PCTCN2022117067-appb-000005
Figure PCTCN2022117067-appb-000005
其中,w iris表示虹膜的权重,w face表示脸部的权重;e1为线性系数;d face表示脸部的成像宽度。 Among them, wiris represents the weight of the iris, w face represents the weight of the face; e1 represents the linear coefficient; d face represents the imaging width of the face.
本公开的示例性实施方式还提供另一种距离检测装置。参考图13所示,该距离检测装置1300可以包括处理器1310和存储器1320。存储器1320包括以下程序模块:Exemplary embodiments of the present disclosure also provide another distance detection device. Referring to FIG. 13 , the distance detecting device 1300 may include a processor 1310 and a memory 1320 . Memory 1320 includes the following program modules:
图像获取模块1321,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module 1321 is configured to acquire the face image of the target user collected by the image acquisition device;
第一人脸预设部位确定模块1322,被配置为在人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;The first preset human face part determination module 1322 is configured to determine at least one first preset human face part among the preset human face parts in the face image;
第二人脸预设部位确定模块1323,被配置为根据人脸图像中第一人脸预设部位的成像尺寸,在人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;The second preset human face part determination module 1323 is configured to determine at least one second human face in the preset human face parts in the human face image according to the imaging size of the first preset human face part in the human face image preset position;
距离确定模块1324,被配置为根据人脸图像中第二人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离;The distance determination module 1324 is configured to determine the distance between the target user and the image acquisition device according to the imaging size of the second preset part of the face in the face image;
处理器1310用于执行上述程序模块。The processor 1310 is used to execute the above program modules.
本公开的示例性实施方式还提供另一种距离检测装置。参考图14所示,该距离检测装置1400可以包括:Exemplary embodiments of the present disclosure also provide another distance detection device. Referring to Figure 14, the distance detection device 1400 may include:
图像获取模块1410,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module 1410 is configured to acquire the face image of the target user collected by the image acquisition device;
第一人脸预设部位确定模块1420,被配置为在人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;The first preset human face part determination module 1420 is configured to determine at least one first preset human face part among the preset human face parts in the face image;
第二人脸预设部位确定模块1430,被配置为根据人脸图像中第一人脸预设部位的成像尺寸,在人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;The second preset human face part determination module 1430 is configured to determine at least one second human face in the preset human face parts in the human face image according to the imaging size of the first preset human face part in the human face image preset position;
距离确定模块1440,被配置为根据人脸图像中第二人脸预设部位的成像尺寸,确定目标用户与图像采集设备之间的距离。The distance determination module 1440 is configured to determine the distance between the target user and the image acquisition device according to the imaging size of the second preset part of the face in the face image.
在一种实施方式中,第一人脸预设部位包括脸部。上述根据人脸图像中第一人脸预设部位的成像尺寸,在人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位,包括:In an implementation manner, the first predetermined face part includes a face. According to the imaging size of the first preset part of the face in the face image, at least one second preset part of the face is determined in the preset parts of the face in the face image, including:
当人脸图像中脸部的成像宽度大于第一阈值时,将人脸图像中的虹膜确定为第二人脸预设部位;When the imaging width of the face in the face image is greater than the first threshold, the iris in the face image is determined as the second preset part of the face;
当人脸图像中脸部的成像宽度小于第一阈值时,将脸部确定为第二人脸预设部位。When the imaging width of the face in the face image is smaller than the first threshold, the face is determined as the second preset part of the face.
本公开的示例性实施方式还提供一种控制装置。参考图15所示,该控制装置1500可以包括处理器1510和存储器1520。存储器1520包括以下程序模块::Exemplary embodiments of the present disclosure also provide a control device. Referring to FIG. 15 , the control device 1500 may include a processor 1510 and a memory 1520 . Memory 1520 includes the following program modules:
距离获取模块1521,获取目标用户与图像采集设备之间的距离,该距离是根据本示例性实施方式中的距离检测方法所检测得到的;The distance acquisition module 1521 is configured to acquire the distance between the target user and the image acquisition device, which is detected according to the distance detection method in this exemplary embodiment;
控制指令生成模块1522,被配置为根据上述距离生成对应的控制指令;The control instruction generation module 1522 is configured to generate a corresponding control instruction according to the distance;
处理器1510用于执行上述程序模块。The processor 1510 is used to execute the above program modules.
本公开的示例性实施方式还提供另一种控制装置。参考图16所示,该控制装置1600可以包括:Exemplary embodiments of the present disclosure also provide another control device. Referring to FIG. 16, the control device 1600 may include:
距离获取模块1610,获取目标用户与图像采集设备之间的距离,该距离是根据本示例性实施方式中的距离检测方法所检测得到的;The distance acquisition module 1610 is configured to acquire the distance between the target user and the image acquisition device, which is detected according to the distance detection method in this exemplary embodiment;
控制指令生成模块1620,被配置为根据上述距离生成对应的控制指令。The control instruction generation module 1620 is configured to generate a corresponding control instruction according to the above distance.
上述装置中各部分的具体细节在方法部分实施方式中已经详细说明,未披露的细节内容可以参见方法部分的实施方式内容,因而不再赘述。The specific details of each part of the above-mentioned device have been described in detail in the implementation of the method, and details that are not disclosed can be found in the implementation of the method, so details are not repeated here.
本公开的示例性实施方式还提供了一种计算机可读存储介质,可以实现为一种程序产品的形式,其包括程序代码,当该程序产品在电子设备上运行时,程序代码用于使电子设备执行(更具体地说,是使电子设备的处理器执行)本说明书上述“示例性方法”部分中描述的各种示例性实施方式的步骤。Exemplary embodiments of the present disclosure also provide a computer-readable storage medium, which can be realized in the form of a program product, which includes program code, and when the program product is run on the electronic device, the program code is used to make the electronic device The device executes (more specifically, causes the processor of the electronic device to execute) the steps of the various exemplary embodiments described in the "Exemplary Methods" section above in this specification.
在一种实施方式中,该程序产品可以实现为便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在电子设备,例如个人电脑上运行。然而,本公开的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。In one embodiment, the program product can be implemented as a portable compact disk read only memory (CD-ROM) and include program code, and can run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, apparatus or device.
程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质包括但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、CD-ROM、光存储器件、磁存储器件、或者上述的任意合适的组合。A program product may take the form of any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium includes, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: electrical connection with one or more conductors, portable disk, hard disk, random access memory (RAM), read only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, CD-ROM, optical storage device, magnetic storage device, or any suitable combination of the above.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a data signal carrying readable program code in baseband or as part of a carrier wave. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等 等,或者上述的任意合适的组合。Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本公开操作的程序代码,程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages—such as Java, C++, etc., as well as conventional procedural programming Language - such as "C" or similar programming language. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server to execute. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider). business to connect via the Internet).
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的示例性实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. Actually, according to the exemplary embodiment of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided to be embodied by a plurality of modules or units.
所属技术领域的技术人员能够理解,本公开的各个方面可以实现为系统、方法或程序产品。因此,本公开的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其他实施方式。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施方式仅被视为示例性的,本公开的真正范围和精神由权利要求指出。Those skilled in the art can understand that various aspects of the present disclosure can be implemented as a system, method or program product. Therefore, various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which can be collectively referred to herein as "circuit", "module" or "system". Other embodiments of the present disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, and these modifications, uses or adaptations follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not disclosed in the present disclosure . The specification and embodiments are to be considered as exemplary only, with the true scope and spirit of the disclosure indicated by the appended claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限定。It should be understood that the present disclosure is not limited to the precise constructions which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (20)

  1. 一种距离检测方法,其特征在于,包括:A distance detection method, characterized in that, comprising:
    获取由图像采集设备所采集的目标用户的人脸图像;Obtaining the face image of the target user collected by the image collection device;
    在所述人脸图像中确定至少两种人脸预设部位的成像尺寸;determining the imaging sizes of at least two preset parts of the face in the face image;
    根据所述至少两种人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。The distance between the target user and the image acquisition device is determined according to the imaging sizes of the at least two preset parts of the face.
  2. 根据权利要求1所述的方法,其特征在于,所述在所述人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:The method according to claim 1, wherein the determining the imaging sizes of at least two preset parts of the face in the face image comprises:
    检测所述人脸图像中的人脸关键点,确定所述人脸图像中的人脸预设部位;Detecting the key points of the human face in the human face image, and determining the preset position of the human face in the human face image;
    根据所述人脸预设部位在所述人脸图像中所覆盖的像素点,确定所述人脸预设部位的成像尺寸。The imaging size of the preset part of the face is determined according to the pixels covered by the preset part of the face in the face image.
  3. 根据权利要求2所述的方法,其特征在于,所述检测所述人脸图像中的人脸关键点,确定所述人脸图像中的人脸预设部位,包括:The method according to claim 2, wherein the detecting the key points of the human face in the human face image and determining the preset position of the human face in the human face image comprises:
    检测所述人脸图像中的人脸关键点,所述人脸关键点包括脸部轮廓关键点和眼部关键点;Detecting human face key points in the human face image, the human face key points include facial contour key points and eye key points;
    根据所述脸部轮廓关键点确定所述人脸图像中的脸部;Determining the face in the face image according to the key points of the face contour;
    基于所述眼部关键点从所述人脸图像中截取眼部图像,并在所述眼部图像中检测虹膜关键点和/或瞳孔关键点,以确定所述人脸图像中的虹膜和/或瞳孔。Intercepting an eye image from the human face image based on the eye key points, and detecting iris key points and/or pupil key points in the eye image to determine the iris and/or pupil key points in the human face image or pupils.
  4. 根据权利要求2所述的方法,其特征在于,当所述人脸预设部位包括脸部时,所述根据所述人脸预设部位在所述人脸图像中所覆盖的像素点,确定所述人脸预设部位的成像尺寸,包括:The method according to claim 2, wherein when the preset part of the human face includes a face, determining according to the pixels covered by the preset part of the human face in the face image The imaging size of the predetermined part of the face includes:
    在所述人脸图像中所述脸部所覆盖的像素点中,获取沿预设坐标轴方向的最小坐标值与最大坐标值,并根据所述最小坐标值与最大坐标值确定所述脸部的成像宽度。In the pixel points covered by the face in the face image, obtain the minimum coordinate value and the maximum coordinate value along the direction of the preset coordinate axis, and determine the face according to the minimum coordinate value and the maximum coordinate value image width.
  5. 根据权利要求4所述的方法,其特征在于,当所述人脸预设部位包括脸部时,所述根据所述人脸预设部位在所述人脸图像中所覆盖的像素点,确定所述人脸预设部位的成像尺寸,还包括:The method according to claim 4, wherein when the preset part of the human face includes a face, determining according to the pixels covered by the preset part of the human face in the face image The imaging size of the predetermined part of the face also includes:
    根据所述脸部在所述人脸图像中所覆盖的像素点,确定脸部对称轴,将所述脸部对称轴的垂直方向作为所述预设坐标轴方向。A face symmetry axis is determined according to the pixels covered by the face in the human face image, and the vertical direction of the face symmetry axis is used as the preset coordinate axis direction.
  6. 根据权利要求2所述的方法,其特征在于,当所述人脸预设部位包括虹膜时,所述根据所述人脸预设部位在所述人脸图像中所覆盖的像素点,确定所述人脸预设部位的成像尺寸,包括:The method according to claim 2, wherein when the preset part of the human face includes an iris, the determined according to the pixels covered by the preset part of the human face in the face image Describe the imaging size of the preset parts of the face, including:
    根据所述虹膜在所述人脸图像中所覆盖的像素点数量,确定所述虹膜的成像面积;determining the imaging area of the iris according to the number of pixels covered by the iris in the face image;
    根据所述虹膜的成像面积确定所述虹膜的成像直径。The imaging diameter of the iris is determined according to the imaging area of the iris.
  7. 根据权利要求2所述的方法,其特征在于,当所述人脸预设部位包括瞳孔时,所述根据所述人脸预设部位在所述人脸图像中所覆盖的像素点,确定所述人脸预设部位的成像尺寸,包括:The method according to claim 2, wherein when the preset part of the human face includes pupils, the determined according to the pixels covered by the preset part of the human face in the face image Describe the imaging size of the preset parts of the face, including:
    分别根据左瞳孔与右瞳孔在所述人脸图像中所覆盖的像素点,确定所述左瞳孔的中心点与所述右瞳孔的中心点;Determining the center point of the left pupil and the center point of the right pupil respectively according to the pixel points covered by the left pupil and the right pupil in the face image;
    确定所述左瞳孔的中心点与所述右瞳孔的中心点之间的距离,得到瞳孔的成像间距。Determining the distance between the center point of the left pupil and the center point of the right pupil to obtain the imaging distance of the pupils.
  8. 根据权利要求1所述的方法,其特征在于,所述人脸预设部位包括脸部和虹膜,所述在所述人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:The method according to claim 1, wherein the preset parts of the human face include the face and the iris, and determining the imaging sizes of at least two preset parts of the human face in the face image comprises:
    在所述人脸图像中确定所述脸部的成像宽度;determining the imaging width of the face in the face image;
    根据所述脸部的成像宽度与第一比例范围确定针对虹膜的第一尺寸范围;determining a first size range for the iris according to the imaging width of the face and the first scale range;
    在所述人脸图像中确定所述虹膜的成像直径,若所述成像直径处于所述第一尺寸范围内,则确定所述成像直径有效。Determine the imaging diameter of the iris in the face image, and determine that the imaging diameter is valid if the imaging diameter is within the first size range.
  9. 根据权利要求1所述的方法,其特征在于,所述人脸预设部位包括脸部和瞳孔,所述在所述人脸图像中确定至少两种人脸预设部位的成像尺寸,包括:The method according to claim 1, wherein the preset parts of the human face include the face and pupils, and determining the imaging sizes of at least two preset parts of the human face in the human face image includes:
    在所述人脸图像中确定所述脸部的成像宽度;determining the imaging width of the face in the face image;
    根据所述脸部的成像宽度与第二比例范围确定针对虹膜的第二尺寸范围;determining a second size range for the iris according to the imaging width of the face and the second scale range;
    在所述人脸图像中确定所述瞳孔的成像间距,若所述成像间距处于所述第二尺寸范围内,则确定所述成像间距有效。Determine the imaging distance of the pupils in the face image, and determine that the imaging distance is valid if the imaging distance is within the second size range.
  10. 根据权利要求1所述的方法,其特征在于,所述根据所述至少两种人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离,包括:The method according to claim 1, wherein the determining the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face comprises:
    分别根据每种所述人脸预设部位的实际尺寸与成像尺寸的比例以及所述图像采集设备的成像参数,确定所述目标用户与所述图像采集设备之间的候选距离;Determine the candidate distance between the target user and the image acquisition device according to the ratio of the actual size of each preset part of the face to the imaging size and the imaging parameters of the image acquisition device;
    基于每种所述人脸预设部位的成像尺寸所对应的所述候选距离,确定所述目标用户与所述图像采集设备之间的距离。Based on the candidate distances corresponding to the imaging sizes of each preset part of the face, the distance between the target user and the image acquisition device is determined.
  11. 根据权利要求10所述的方法,其特征在于,所述基于每种所述人脸预设部位的成像尺寸对应的所述候选距离,确定所述目标用户与所述图像采集设备之间的距离,包括:The method according to claim 10, wherein the distance between the target user and the image acquisition device is determined based on the candidate distance corresponding to the imaging size of each preset part of the face ,include:
    根据至少一种所述人脸预设部位的成像尺寸或者至少一个所述候选距离,确定每种所述人脸预设部位的权重;determining the weight of each preset part of the face according to the imaging size of at least one preset part of the face or at least one of the candidate distances;
    基于每种所述人脸预设部位的权重,对每种所述人脸预设部位的成像尺寸所对应的所述候选距离进行加权,得到所述目标用户与所述图像采集设备之间的距离。Based on the weight of each preset part of the face, the candidate distance corresponding to the imaging size of each preset part of the face is weighted to obtain the distance between the target user and the image acquisition device. distance.
  12. 根据权利要求10所述的方法,其特征在于,所述人脸预设部位包括脸部和虹膜,至少一种所述人脸预设部位的成像尺寸包括脸部的成像宽度;所述根据至少一种所述人脸预设部位的成像尺寸或者至少一个所述候选距离,确定每种所述人脸预设部位的权重,包括:The method according to claim 10, wherein the predetermined part of the human face comprises the face and the iris, and at least one imaging size of the predetermined part of the human face comprises the imaging width of the face; An imaging size of the preset part of the human face or at least one of the candidate distances, determining the weight of each preset part of the human face, including:
    通过以下公式确定脸部的权重和虹膜的权重:The weight of the face and the weight of the iris are determined by the following formula:
    Figure PCTCN2022117067-appb-100001
    Figure PCTCN2022117067-appb-100001
    其中,w iris表示虹膜的权重,w face表示脸部的权重;e1为线性系数;d face表示脸部的成像宽度。 Among them, wiris represents the weight of the iris, w face represents the weight of the face; e1 represents the linear coefficient; d face represents the imaging width of the face.
  13. 一种距离检测方法,其特征在于,包括:A distance detection method, characterized in that, comprising:
    获取由图像采集设备所采集的目标用户的人脸图像;Obtaining the face image of the target user collected by the image collection device;
    在所述人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;Determining at least one first preset face part in the preset face part in the face image;
    根据所述人脸图像中所述第一人脸预设部位的成像尺寸,在所述人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;According to the imaging size of the first predetermined face part in the face image, at least one second preset part of the face is determined among the preset parts of the face in the face image;
    根据所述人脸图像中所述第二人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。The distance between the target user and the image acquisition device is determined according to the imaging size of the second preset part of the human face in the human face image.
  14. 根据权利要求13所述的方法,其特征在于,所述第一人脸预设部位包括脸部;所述根据所述人脸图像中所述第一人脸预设部位的成像尺寸,在所述人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位,包括:The method according to claim 13, wherein the first preset part of the human face comprises a face; and according to the imaging size of the first preset part of the human face in the face image, in the Determining at least one second preset part of the face in the preset part of the face in the face image, including:
    当所述人脸图像中所述脸部的成像宽度大于第一阈值时,将所述人脸图像中的虹膜确定为第二人脸预设部位;When the imaging width of the face in the face image is greater than a first threshold, the iris in the face image is determined as a second preset part of the face;
    当所述人脸图像中所述脸部的成像宽度小于所述第一阈值时,将所述脸部确定为第二人脸预设部位。When the imaging width of the face in the face image is smaller than the first threshold, the face is determined as a second preset part of the face.
  15. 一种控制方法,其特征在于,包括:A control method, characterized in that, comprising:
    获取目标用户与图像采集设备之间的距离,所述距离是根据权利要求1至14任一项所述的距离检测方法所检测得到的;Obtaining the distance between the target user and the image acquisition device, the distance is detected according to the distance detection method described in any one of claims 1 to 14;
    根据所述距离生成对应的控制指令。Generate corresponding control instructions according to the distance.
  16. 一种距离检测装置,其特征在于,包括处理器与存储器,所述处理器用于执行所述存储器中存储的以下程序模块:A distance detection device is characterized in that it includes a processor and a memory, and the processor is used to execute the following program modules stored in the memory:
    图像获取模块,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module is configured to acquire the face image of the target user collected by the image acquisition device;
    成像尺寸确定模块,被配置为在所述人脸图像中确定至少两种人脸预设部位的成像尺寸;The imaging size determination module is configured to determine the imaging sizes of at least two preset parts of the face in the face image;
    距离确定模块,被配置为根据所述至少两种人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。The distance determination module is configured to determine the distance between the target user and the image acquisition device according to the imaging sizes of the at least two preset parts of the face.
  17. 一种距离检测装置,其特征在于,包括处理器与存储器,所述处理器用于执行所述存储器中存储的以下程序模块:A distance detection device is characterized in that it includes a processor and a memory, and the processor is used to execute the following program modules stored in the memory:
    图像获取模块,被配置为获取由图像采集设备所采集的目标用户的人脸图像;The image acquisition module is configured to acquire the face image of the target user collected by the image acquisition device;
    第一人脸预设部位确定模块,被配置为在所述人脸图像中的人脸预设部位中确定至少一种第一人脸预设部位;The first preset human face part determination module is configured to determine at least one first preset human face part among the preset human face parts in the face image;
    第二人脸预设部位确定模块,被配置为根据所述人脸图像中所述第一人脸预设部位的成像尺寸,在所述人脸图像中的人脸预设部位中确定至少一种第二人脸预设部位;The second predetermined face part determination module is configured to determine at least one preset part of the face in the face image according to the imaging size of the first preset part of the face in the face image A second preset part of the face;
    距离确定模块,被配置为根据所述人脸图像中所述第二人脸预设部位的成像尺寸,确定所述目标用户与所述图像采集设备之间的距离。The distance determination module is configured to determine the distance between the target user and the image acquisition device according to the imaging size of the second preset part of the face in the face image.
  18. 一种控制装置,其特征在于,包括处理器与存储器,所述处理器用于执行所述存储器中存储的以下程序模块:A control device, characterized in that it includes a processor and a memory, the processor is used to execute the following program modules stored in the memory:
    距离获取模块,被配置为获取目标用户与图像采集设备之间的距离,所述距离是根据权利要求1至14任一项所述的距离检测方法所检测得到的;The distance acquisition module is configured to acquire the distance between the target user and the image acquisition device, the distance is detected according to the distance detection method according to any one of claims 1 to 14;
    控制指令生成模块,被配置为根据所述距离生成对应的控制指令。A control instruction generation module configured to generate a corresponding control instruction according to the distance.
  19. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至15任一项所述的方法。A computer-readable storage medium on which a computer program is stored, wherein the computer program implements the method according to any one of claims 1 to 15 when executed by a processor.
  20. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    处理器;以及processor; and
    存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions of the processor;
    其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1至15任一项所述的方法。Wherein, the processor is configured to execute the method according to any one of claims 1 to 15 by executing the executable instructions.
PCT/CN2022/117067 2021-10-08 2022-09-05 Distance detection method and apparatus, control method and apparatus, and storage medium and electronic device WO2023056811A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111172688.8A CN113920195A (en) 2021-10-08 2021-10-08 Distance detection method, control method, device, storage medium and electronic equipment
CN202111172688.8 2021-10-08

Publications (1)

Publication Number Publication Date
WO2023056811A1 true WO2023056811A1 (en) 2023-04-13

Family

ID=79238457

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/117067 WO2023056811A1 (en) 2021-10-08 2022-09-05 Distance detection method and apparatus, control method and apparatus, and storage medium and electronic device

Country Status (2)

Country Link
CN (1) CN113920195A (en)
WO (1) WO2023056811A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113920195A (en) * 2021-10-08 2022-01-11 Oppo广东移动通信有限公司 Distance detection method, control method, device, storage medium and electronic equipment
CN116421135A (en) * 2023-04-27 2023-07-14 北京京东拓先科技有限公司 Vision testing method, device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654040A (en) * 2015-12-24 2016-06-08 华为技术有限公司 Distance measurement method and mobile terminal based on iris
CN106792177A (en) * 2016-12-28 2017-05-31 海尔优家智能科技(北京)有限公司 A kind of TV control method and system
US20180089851A1 (en) * 2016-09-26 2018-03-29 Asustek Computer Inc. Distance measuring device for human body features and method thereof
CN111104909A (en) * 2019-12-20 2020-05-05 深圳市商汤科技有限公司 Image processing method, image processing device, computer equipment and storage medium
CN112070021A (en) * 2020-09-09 2020-12-11 深圳数联天下智能科技有限公司 Distance measurement method, distance measurement system, distance measurement equipment and storage medium based on face detection
CN113920195A (en) * 2021-10-08 2022-01-11 Oppo广东移动通信有限公司 Distance detection method, control method, device, storage medium and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654040A (en) * 2015-12-24 2016-06-08 华为技术有限公司 Distance measurement method and mobile terminal based on iris
US20180089851A1 (en) * 2016-09-26 2018-03-29 Asustek Computer Inc. Distance measuring device for human body features and method thereof
CN106792177A (en) * 2016-12-28 2017-05-31 海尔优家智能科技(北京)有限公司 A kind of TV control method and system
CN111104909A (en) * 2019-12-20 2020-05-05 深圳市商汤科技有限公司 Image processing method, image processing device, computer equipment and storage medium
CN112070021A (en) * 2020-09-09 2020-12-11 深圳数联天下智能科技有限公司 Distance measurement method, distance measurement system, distance measurement equipment and storage medium based on face detection
CN113920195A (en) * 2021-10-08 2022-01-11 Oppo广东移动通信有限公司 Distance detection method, control method, device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN113920195A (en) 2022-01-11

Similar Documents

Publication Publication Date Title
WO2023056811A1 (en) Distance detection method and apparatus, control method and apparatus, and storage medium and electronic device
TWI775896B (en) Method and apparatus for video super resolution using convolutional neural network
WO2019219065A1 (en) Video analysis method and device
KR102385024B1 (en) Apparatus and method of five dimensional (5d) video stabilization with camera and gyroscope fusion
US10963745B2 (en) Real time adaptive training face detection for ultra low power always on architecture
WO2021233032A1 (en) Video processing method, video processing apparatus, and electronic device
WO2019179283A1 (en) Image recognition method and device
CN111429517A (en) Relocation method, relocation device, storage medium and electronic device
US8626782B2 (en) Pattern identification apparatus and control method thereof
US10841485B2 (en) Photographing method and photographing apparatus for terminal, and terminal
JP2012530994A (en) Method and apparatus for half-face detection
CN111694978A (en) Image similarity detection method and device, storage medium and electronic equipment
CN115061770B (en) Method and electronic device for displaying dynamic wallpaper
CN113887547B (en) Key point detection method and device and electronic equipment
WO2024087804A1 (en) Camera switching method and electronic device
WO2022160748A1 (en) Video processing method and apparatus
Tepelea et al. A vision module for visually impaired people by using Raspberry PI platform
US11610293B2 (en) Image processing apparatus and image processing method
CN108259769B (en) Image processing method, image processing device, storage medium and electronic equipment
CN110363132B (en) Living body detection method, living body detection device, electronic apparatus, and storage medium
CN112348738B (en) Image optimization method, image optimization device, storage medium and electronic equipment
CN112507948A (en) Mask wearing prompting method and related device
RU2807472C2 (en) Method and electronic device for determining acceptance of face feature
CN115022541B (en) Video distortion correction method and device, computer readable medium and electronic equipment
JP2016021716A (en) Tracking device and control method of the same

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22877833

Country of ref document: EP

Kind code of ref document: A1