WO2022135579A1 - Skin color detection method and device, mobile terminal, and storage medium - Google Patents

Skin color detection method and device, mobile terminal, and storage medium Download PDF

Info

Publication number
WO2022135579A1
WO2022135579A1 PCT/CN2021/141287 CN2021141287W WO2022135579A1 WO 2022135579 A1 WO2022135579 A1 WO 2022135579A1 CN 2021141287 W CN2021141287 W CN 2021141287W WO 2022135579 A1 WO2022135579 A1 WO 2022135579A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
face
skin
probability
mapping function
Prior art date
Application number
PCT/CN2021/141287
Other languages
French (fr)
Chinese (zh)
Inventor
杨敏
Original Assignee
百果园技术(新加坡)有限公司
杨敏
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 百果园技术(新加坡)有限公司, 杨敏 filed Critical 百果园技术(新加坡)有限公司
Publication of WO2022135579A1 publication Critical patent/WO2022135579A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

Embodiments of the present application provide a skin color detection method and device, a mobile terminal, and a storage medium. The method comprises: detecting face data in image data, and with reference to the face data, separating head data matching a head contour; substituting a color value of the image data into a first mapping function to calculate a first target probability of the image data being skin data; generating a second mapping function with reference to a brightness value of the head data; substituting a brightness value of the image data into the second mapping function to calculate a second target probability of the image data being skin data; and detecting skin data in the image data by combining the first target probability and the second target probability.

Description

肤色检测方法、装置、移动终端和存储介质Skin color detection method, device, mobile terminal and storage medium
本申请要求在2020年12月25日提交中国专利局、申请号为202011566266.4的中国专利申请的优先权,以上申请的全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with application number 202011566266.4 filed with the China Patent Office on December 25, 2020, the entire contents of the above application are incorporated into this application by reference.
技术领域technical field
本申请实施例涉及计算机视觉的技术领域,例如涉及一种肤色检测方法、装置、移动终端和存储介质。The embodiments of the present application relate to the technical field of computer vision, for example, to a skin color detection method, device, mobile terminal, and storage medium.
背景技术Background technique
随着移动互联网与移动终端的迅速发展,移动终端中的视频数据已成为人类活动中常用的信息载体,如直播、视频通话等,它们包含着物体的大量信息,成为人们获取外界原始信息的途径之一。With the rapid development of mobile Internet and mobile terminals, video data in mobile terminals has become a common information carrier in human activities, such as live broadcasts, video calls, etc. They contain a large amount of information about objects and become a way for people to obtain original information from the outside world. one.
针对这些视频数据,用户通常会选择美颜,肤色检测作为美颜的基础,决定了美颜能够实现对视频数据的实时处理,并且也影响了美颜的效果优劣。For these video data, users usually choose beauty, and skin color detection is the basis of beauty, which determines that beauty can realize real-time processing of video data, and also affects the effect of beauty.
主流的肤色检测可以分为基于颜色空间的肤色检测、基于机器学习分类的肤色检测以及基于深度学习图像分割的肤色检测。The mainstream skin color detection can be divided into skin color detection based on color space, skin color detection based on machine learning classification, and skin color detection based on deep learning image segmentation.
其中,基于颜色空间的肤色检测由于具有快速高效的特性在从而在实时流处理领域有着广泛的应用,但精确度较低,基于机器学习分类的肤色检测以及基于深度学习图像分割的肤色检测有较高的精确度,但在实时流处理的时候性能往往会成为瓶颈,难以应用于移动终端等设备受限的情况。Among them, skin color detection based on color space has a wide range of applications in the field of real-time stream processing due to its fast and efficient characteristics, but the accuracy is low. High accuracy, but performance often becomes a bottleneck in real-time stream processing, and it is difficult to apply to limited devices such as mobile terminals.
发明内容SUMMARY OF THE INVENTION
第一方面,本申请实施例提供了一种肤色检测方法,包括:In a first aspect, the embodiments of the present application provide a method for detecting skin color, including:
在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据;Detecting face data in the image data, and dividing the head data matching the head contour with reference to the face data;
将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率;Substituting the color value of the image data into the first mapping function to calculate the first target probability that the image data belongs to skin data;
参考所述头部数据的亮度值生成第二映射函数,所述第二映射函数用于基于亮度值识别皮肤数据;generating a second mapping function with reference to the brightness value of the head data, the second mapping function being used to identify skin data based on the brightness value;
将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率;Substituting the luminance value of the image data into the second mapping function to calculate the second target probability that the image data belongs to skin data;
结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数 据。Skin data is detected in the image data in combination with the first target probability and the second target probability.
第二方面,本申请实施例还提供了一种肤色检测装置,包括:In a second aspect, the embodiments of the present application also provide a skin color detection device, including:
图像数据检测模块,设置为在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据;an image data detection module, configured to detect face data in the image data, and divide head data matching the head contour with reference to the face data;
第一目标概率计算模块,设置为将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率;a first target probability calculation module, configured to substitute the color value of the image data into a first mapping function to calculate the first target probability that the image data belongs to skin data;
映射函数生成模块,设置为参考所述头部数据的亮度值生成第二映射函数,所述第二映射函数用于基于亮度值识别皮肤数据;a mapping function generation module, configured to generate a second mapping function with reference to the brightness value of the head data, where the second mapping function is used to identify skin data based on the brightness value;
第二目标概率计算模块,设置为将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率;A second target probability calculation module, configured to substitute the brightness value of the image data into the second mapping function to calculate the second target probability that the image data belongs to skin data;
皮肤检测模块,设置为结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数据。A skin detection module configured to detect skin data in the image data in combination with the first target probability and the second target probability.
第三方面,本申请实施例还提供了一种移动终端,所述移动终端包括:In a third aspect, an embodiment of the present application further provides a mobile terminal, where the mobile terminal includes:
至少一个处理器;at least one processor;
存储器,设置为存储至少一个程序,memory, arranged to store at least one program,
当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如第一方面所述的肤色检测方法。When the at least one program is executed by the at least one processor, the at least one processor implements the skin color detection method according to the first aspect.
第四方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如第一方所述的肤色检测方法。In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the skin color detection according to the first party is implemented method.
附图说明Description of drawings
图1为本申请实施例一提供的一种肤色检测方法的流程图;1 is a flowchart of a skin color detection method provided in Embodiment 1 of the present application;
图2为本申请实施例一提供的一种头部数据的示例图;FIG. 2 is an example diagram of a header data provided in Embodiment 1 of the present application;
图3是本申请实施例一提供的一种第一映射函数的示意图;3 is a schematic diagram of a first mapping function provided in Embodiment 1 of the present application;
图4是本申请实施例一提供的一种第二映射函数的示意图;4 is a schematic diagram of a second mapping function provided in Embodiment 1 of the present application;
图5为本申请实施例一提供的一种肤色检测的概率分布对应的灰度分布图;5 is a grayscale distribution diagram corresponding to a probability distribution of skin color detection provided in Embodiment 1 of the present application;
图6为本申请实施例二提供的一种肤色检测装置的结构示意图;6 is a schematic structural diagram of a skin color detection device provided in Embodiment 2 of the present application;
图7为本申请实施例三提供的一种移动终端的结构示意图。FIG. 7 is a schematic structural diagram of a mobile terminal according to Embodiment 3 of the present application.
具体实施方式Detailed ways
下面结合附图和实施例对本申请进行说明。可以理解的是,此处所描述的 具体实施例仅仅用于解释本申请,而非对本申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本申请相关的部分而非全部结构。The present application will be described below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, the drawings only show some but not all the structures related to the present application.
实施例一Example 1
图1为本申请实施例一提供的一种肤色检测方法的流程图,本实施例可结合色彩值与亮度值进行肤色检测,该方法可以由肤色检测装置来执行,该肤色检测装置可以由软件和/或硬件实现,可配置在移动终端中,例如,手机、平板电脑、智能穿戴设备(如智能手表、智能眼镜等),等等,包括如下步骤:1 is a flowchart of a skin color detection method provided in Embodiment 1 of the present application. This embodiment can perform skin color detection in combination with color values and brightness values. The method can be performed by a skin color detection device, which can be performed by software and/or hardware implementation, which can be configured in mobile terminals, such as mobile phones, tablet computers, smart wearable devices (such as smart watches, smart glasses, etc.), etc., including the following steps:
步骤101、在图像数据中检测人脸数据、参考人脸数据划分与头部轮廓匹配的头部数据。Step 101: Detect face data in the image data, and divide head data matching the head contour with reference to the face data.
在本实施例中,等待肤色检测的视频数据一般指在具有实时性的业务场景中所生成、传输或播放的视频数据。In this embodiment, the video data waiting for skin color detection generally refers to video data generated, transmitted or played in a real-time service scenario.
一般而言,可在生成该视频数据的移动终端中对该视频数据进行肤色检测,此时,可开启移动终端的摄像头,摄像头采集视频数据。Generally speaking, skin color detection can be performed on the video data in the mobile terminal that generates the video data. At this time, the camera of the mobile terminal can be turned on, and the camera can collect the video data.
除了在生成该视频数据的移动终端中对该视频数据进行肤色检测之外,也可以在播放该视频数据的移动终端对该视频数据进行肤色检测,本实施例对此不加以限制。In addition to performing skin color detection on the video data in the mobile terminal that generates the video data, skin color detection may also be performed on the video data on the mobile terminal that plays the video data, which is not limited in this embodiment.
例如,在直播的业务场景中,等待肤色检测的视频数据可以指用于承载直播内容的视频数据,主播用户所登录的移动终端产生视频数据,以及,将该视频数据通过直播平台分发到至少一个观众用户所登录的设备进行播放,此时,通常在主播用户所登录的移动终端对该视频数据进行肤色检测。For example, in a live broadcast business scenario, the video data waiting for skin color detection may refer to the video data used to carry the live broadcast content. The mobile terminal logged in by the host user generates the video data, and the video data is distributed to at least one The device logged in by the viewer user plays the video. At this time, the video data is usually detected by skin color on the mobile terminal logged in by the host user.
又例如,在视频通话的业务场景中,等待肤色检测的视频数据可以指用于承载通话内容的视频数据,发起通话的用户所登录的移动终端产生视频数据,以及,将该视频数据发送到至少一个被邀请通话的用户所登录的设备进行播放,此时,通常在发起通话的用户所登录的移动终端对该视频数据进行肤色检测。For another example, in the business scenario of a video call, the video data waiting for skin color detection may refer to the video data used to carry the content of the call, and the mobile terminal logged in by the user who initiates the call generates video data, and sends the video data to at least A device logged in by a user who is invited to a call is played. At this time, skin color detection is usually performed on the video data on the mobile terminal logged in by the user who initiated the call.
又例如,在视频会议的业务场景中,等待肤色检测的视频数据可以指用于承载会议内容的视频数据,正在发言的用户所登录的移动终端产生视频数据,以及,将该视频数据发送到至少一个参与该会议的用户所登录的设备进行播放,此时,通常正在发言的用户所登录的移动终端对该视频数据进行肤色检测。For another example, in a video conference business scenario, the video data waiting for skin color detection may refer to video data used to carry conference content, the mobile terminal logged in by the user who is speaking generates video data, and the video data is sent to at least A device logged in by a user participating in the conference plays the video. At this time, the mobile terminal logged in by the user who is usually speaking performs skin color detection on the video data.
等待肤色检测的视频数据也可以指在实时性要求较低的业务场景中所生成的视频数据,如短视频等,本实施例对此不加以限制。The video data waiting for skin color detection may also refer to video data generated in a service scenario with low real-time requirements, such as a short video, which is not limited in this embodiment.
在不同的业务场景中,通常是对用户采集视频数据,因此,在视频数据的多帧图像数据中通常具有用户的人物形象,所谓人物形象,可以指图像数据中 用于表示人物的像素点。In different business scenarios, video data is usually collected from users. Therefore, the multi-frame image data of the video data usually contains the user's character image. The so-called character image can refer to the pixels in the image data used to represent the character.
该人物形象至少包括用于表示人脸的人脸数据(像素点),除此之外,还可以包括用于表示头发的头发数据(像素点)、用于表示躯体的躯体数据(像素点)、用于表示四肢的四肢数据(像素点),等等,本申请实施例对此不加以限制。The character image includes at least face data (pixels) for representing a human face, and may also include hair data (pixels) for representing hair and body data (pixels) for representing a body , limb data (pixel points) used to represent limbs, etc., which are not limited in this embodiment of the present application.
其中,对于人脸数据、躯体数据、四肢数据等可以包括用于表示皮肤的皮肤数据(像素点)。Wherein, for face data, body data, limb data, etc., skin data (pixel points) for representing skin may be included.
在本实施例中,可对多帧图像数据分别进行人脸检测,识别该图像数据中包含的人脸数据,以人脸数据作为优质的锚点,可捕捉到质量较高的皮肤数据。In this embodiment, face detection can be performed on multiple frames of image data respectively, and face data included in the image data can be identified. Using the face data as a high-quality anchor point, high-quality skin data can be captured.
在一些情况中,人脸数据以人脸关键点表示,即给定人脸数据,定位出人脸面部的关键区域位置,包括眉毛、眼睛、鼻子、嘴巴、脸部轮廓等等。In some cases, face data is represented by face key points, that is, given face data, key regions of the face are located, including eyebrows, eyes, nose, mouth, facial contours, and so on.
在另一些情况中,可以基于人脸关键点生成指定形状的范围,用该范围表示人脸数据,其中,该形状包括矩形、椭圆形等,对于矩形的范围,又可称之为人脸框。In other cases, a range of a specified shape can be generated based on the key points of the face, and the range is used to represent the face data, wherein the shape includes a rectangle, an ellipse, etc., and the range of the rectangle can also be called a face frame.
可以使用如下方法对多帧图像数据进行人脸检测:Face detection can be performed on multi-frame image data using the following methods:
1、利用人工提取特征,如haar特征,使用特征训练分类器,使用分类器进行人脸检测。1. Use artificial extraction features, such as haar features, use features to train classifiers, and use classifiers for face detection.
2、从通用的目标检测算法中继承人脸检测,例如,利用Faster R-CNN来检测人脸。2. Inherit face detection from general object detection algorithms, for example, use Faster R-CNN to detect faces.
3、使用级联结构的卷积神经网络,例如,Cascade CNN(级联卷积神经网络),MTCNN(Multi-task Cascaded Convolutional Networks,多任务卷积神经网络)。3. Convolutional neural network using cascade structure, for example, Cascade CNN (Cascade Convolutional Neural Network), MTCNN (Multi-task Cascaded Convolutional Networks, multi-task convolutional neural network).
这些实现人脸检测的方法可以集成在应用的模块中,直接调用该应用的模块对图像数据进行人脸检测,这些实现人脸检测的方法也可以集成在SDK(Software Development Kit,软件开发工具包),该SDK作为应用的组装数据,应用可请求SDK对多帧图像数据进行人脸检测,SDK检测到图像数据中的人脸数据,并将人脸数据返回应用。These methods for implementing face detection can be integrated in the modules of the application, and the modules of the application are directly called to perform face detection on image data. These methods for implementing face detection can also be integrated in the SDK (Software Development Kit, software development kit). ), the SDK is used as the assembly data of the application, the application can request the SDK to perform face detection on multi-frame image data, the SDK detects the face data in the image data, and returns the face data to the application.
若该应用为与摄像头配套的系统应用,该系统应用通常为这些实现人脸检测的方法提供API(应用程序编程接口,Application Program Interface)、作为人脸检测接口,例如,在Android(安卓)系统中,提供了两个人脸检测接口android.media.FaceDetector和android.media.FaceDetector.Face,在iOS系统中,提供了两个人脸检测接口AVCaptureMetadataOutput和CIDetector。If the application is a system application supporting the camera, the system application usually provides API (Application Program Interface, Application Program Interface) for these methods of implementing face detection, as a face detection interface, for example, in the Android (Android) system , provides two face detection interfaces android.media.FaceDetector and android.media.FaceDetector.Face, in iOS system, provides two face detection interfaces AVCaptureMetadataOutput and CIDetector.
针对此情况,可调用摄像头提供的人脸检测接口,以请求在摄像头采集的多帧图像数据中检测人脸数据,接收人脸检测接口返回的一个或多个人脸框,人脸框为矩形框,可用于框定人脸数据,即人脸数据位于人脸框中。In response to this situation, you can call the face detection interface provided by the camera to request to detect the face data in the multi-frame image data collected by the camera, and receive one or more face frames returned by the face detection interface. The face frame is a rectangular frame , which can be used to frame the face data, that is, the face data is located in the face frame.
对于系统应用提供的人脸检测接口,有硬件支持,以及,基于少数人脸关键点(2个人脸关键点)标定人脸框,速度快,性能消耗很低,并且,精确度可满足要求。For the face detection interface provided by the system application, there is hardware support, and the face frame is calibrated based on a few key points of the face (2 key points of the face), the speed is fast, the performance consumption is very low, and the accuracy can meet the requirements.
由于人脸数据可以在一定程度上体现用户头部的空间位置信息,因此,在本实施例中,可以参照人脸数据的位置、形状等信息,在图像数据中划分出与头部轮廓匹配的头部数据,从而提高表达头部、人脸等部位的精确度。Since the face data can reflect the spatial position information of the user's head to a certain extent, in this embodiment, the position, shape and other information of the face data can be referred to, and the image data can be divided into a matching head contour. Head data, thereby improving the accuracy of expressing parts such as heads and faces.
对于头部轮廓而言,在人脸数据朝正面、朝侧面时有所不同,可以呈现出头发、脸型、耳朵、鼻子、嘴巴等部位,相应地,头部数据可在形状上体现这些部位。For the head contour, it is different when the face data faces the front and the side, and can present parts such as hair, face shape, ears, nose, mouth, etc. Correspondingly, the head data can reflect these parts in shape.
在一实施例中,为了降低拟合头部数据的复杂度,提高计算的速度,降低计算的耗时,可以简化头部数据的形状,拟合为规范的形状,例如,将头部数据的形状拟合为椭圆形、圆形等。In one embodiment, in order to reduce the complexity of fitting the head data, increase the speed of calculation, and reduce the time-consuming of calculation, the shape of the head data can be simplified and fitted to a standard shape, for example, the Shape fitting is oval, circle, etc.
在本申请第一个实施例中,如图2所示,头部数据包括脸部数据202、头发数据203,其中,脸部数据202与头部轮廓中的脸部轮廓相近,主要包含脸部,头发数据203与头部轮廓中的头发轮廓相近,主要包含头发。In the first embodiment of the present application, as shown in FIG. 2 , the head data includes face data 202 and hair data 203 , wherein the face data 202 is similar to the face contour in the head contour, mainly including the face , the hair data 203 is similar to the hair contour in the head contour, and mainly contains hair.
一方面,如图2所示,参考人脸数据201的形状、位置等信息,在图像数据中划分与头部轮廓中的脸部轮廓匹配的脸部数据202。On the one hand, as shown in FIG. 2 , with reference to the shape, position and other information of the face data 201 , face data 202 matching the face contour in the head contour is divided into the image data.
在一个示例中,针对某种摄像头回调的人脸数据,若人脸数据201以人脸框框定,则脸部数据202符合如下条件:In an example, for the face data recalled by a certain camera, if the face data 201 is framed by a face frame, the face data 202 meets the following conditions:
脸部数据的形状为椭圆形;The shape of the face data is oval;
脸部数据的焦点为人脸框中宽对应的框边的中点;The focus of the face data is the midpoint of the frame edge corresponding to the width of the face frame;
脸部数据的短轴的长度与人脸框中的宽相等;The length of the short axis of the face data is equal to the width of the face frame;
脸部数据的长轴的长度与目标边的长度的n(n为正数,如2)倍相等,目标边为第一候选边、第二侯选边作为直角边时对应的斜边,第一侯选边为人脸框中宽取指定的第一比例,第二侯选边为人脸框中高取指定的第二比例。The length of the long axis of the face data is equal to n (n is a positive number, such as 2) times the length of the target side. The target side is the hypotenuse corresponding to the first candidate side and the second candidate side as the right-angle side. The first candidate side is the width of the face frame with a specified first ratio, and the second candidate side is the height of the face frame with a specified second ratio.
在本示例中,设人脸框的宽为w,高为h,四个焦点分别为A(x 1,y 1)、B(x 2,y 2)、C(x 3,y 3)、D(x 4,y 4),则脸部数据的焦点分别为F 1((x 1+x 2)/2,(y 1+y 2)/2),F 2((x 3+x 4)/2,(y 3+y 4)/2),脸部数据的短轴的长度为2b=w,脸部数据的长轴的长度为
Figure PCTCN2021141287-appb-000001
其中,i为第一比例, 属于小于或等于1的正数,如0.5,j为第二比例,属于小于或等于1的正数,如0.5。
In this example, let the width of the face frame be w, the height be h, and the four focal points are A(x 1 , y 1 ), B(x 2 , y 2 ), C(x 3 , y 3 ), D(x 4 , y 4 ), then the focus of the face data is F 1 ((x 1 +x 2 )/2, (y 1 +y 2 )/2), F 2 ((x 3 +x 4 ) )/2, (y 3 +y 4 )/2), the length of the short axis of the face data is 2b=w, and the length of the long axis of the face data is
Figure PCTCN2021141287-appb-000001
Wherein, i is the first ratio, which belongs to a positive number less than or equal to 1, such as 0.5, and j is the second ratio, which belongs to a positive number less than or equal to 1, such as 0.5.
另一方面,如图2所示,参考人脸数据201的形状、位置等信息,在图像数据中划分与头部轮廓中的头发轮廓匹配的头发数据203。On the other hand, as shown in FIG. 2 , with reference to information such as the shape and position of the face data 201 , the image data is divided into hair data 203 matching the hair outline in the head outline.
在头部数据中,头发数据203包围脸部数据202,两者相互独立,并不重叠。In the head data, the hair data 203 surrounds the face data 202, and the two are independent of each other and do not overlap.
在一个示例中,针对某种摄像头回调的人脸数据,若人脸数据201以人脸框框定,则头发数据203符合如下条件:In an example, for the face data recalled by a certain camera, if the face data 201 is framed by a face frame, the hair data 203 meets the following conditions:
头发数据的形状为椭圆形;The shape of the hair data is an ellipse;
头发数据的焦点为人脸框中宽对应的框边的中点;The focus of the hair data is the midpoint of the frame edge corresponding to the width of the face frame;
头发数据的短轴的长度与人脸框中的宽的m(m为正数,表示头发数据对脸部数据放大m倍)倍相等;The length of the short axis of the hair data is equal to the width m in the face frame (m is a positive number, indicating that the hair data is magnified by m times the face data) times;
头发数据的长轴的长度与目标边的长度的n×m倍相等,目标边为第一候选边、第二侯选边作为直角边时对应的斜边,第一侯选边为人脸框中宽取指定的第一比例,第二侯选边为人脸框中高取指定的第二比例。The length of the long axis of the hair data is equal to n×m times the length of the target side. The target side is the hypotenuse corresponding to the first candidate side and the second candidate side as the right-angle side, and the first candidate side is the face frame. The width takes the specified first ratio, and the second candidate edge is the height of the face frame and takes the specified second ratio.
在本示例中,设人脸框的宽为w,高为h,四个焦点分别为A(x 1,y 1)、B(x 2,y 2)、C(x 3,y 3)、D(x 4,y 4),则头发数据的焦点分别为F 1((x 1+x 2)/2,(y 1+y 2)/2),F 2((x 3+x 4)/2,(y 3+y 4)/2),头发数据的短轴的长度为2b=mw,头发数据的长轴的长度为
Figure PCTCN2021141287-appb-000002
其中,i为第一比例,属于小于或等于1的正数,如0.5,j为第一比例,属于小于或等于1的正数,如0.5。
In this example, let the width of the face frame be w, the height be h, and the four focal points are A(x 1 , y 1 ), B(x 2 , y 2 ), C(x 3 , y 3 ), D(x 4 , y 4 ), then the focus of the hair data is F 1 ((x 1 +x 2 )/2, (y 1 +y 2 )/2), F 2 ((x 3 +x 4 ) /2, (y 3 +y 4 )/2), the length of the short axis of the hair data is 2b=mw, and the length of the long axis of the hair data is
Figure PCTCN2021141287-appb-000002
Among them, i is the first ratio, which belongs to a positive number less than or equal to 1, such as 0.5, and j is the first ratio, which belongs to a positive number less than or equal to 1, such as 0.5.
在一示例中,m可以为预设的经验值,属于常数,m也可以为自适应的变量,与人脸数据的面积正相关,即人脸数据的面积越大,头发数据的面积也越大,此时,m的数值越大,反之,人脸数据的面积越小,头发数据的面积也越小,此时,m的数值越小。In an example, m can be a preset empirical value, which is a constant, and m can also be an adaptive variable, which is positively related to the area of the face data, that is, the larger the area of the face data, the larger the area of the hair data. Large, at this time, the value of m is larger, on the contrary, the area of the face data is smaller, and the area of the hair data is also smaller, at this time, the value of m is smaller.
上述头部数据及其划分方式只是作为示例,在不同操作系统、不同版本的摄像头所回调的人脸数据有所不同,在实施本申请实施例时,可以根据实际情况设置其它头部数据及其划分方式,本申请实施例对此不加以限制。另外,除了上述头部数据及其划分方式外,本领域技术人员还可以根据实际需要采用其它头部数据及其划分方式,本申请实施例对此也不加以限制。The above-mentioned head data and its division method are only examples, and the face data recalled by different operating systems and different versions of the cameras are different. When implementing the embodiments of the present application, other head data and other head data may be set according to the actual situation. The division manner is not limited in this embodiment of the present application. In addition, in addition to the above header data and its division manner, those skilled in the art may also adopt other header data and its division manner according to actual needs, which are not limited in this embodiment of the present application.
一般情况下,脸部数据中可以包括额头、眼睛、鼻子、嘴巴、脸颊、耳朵等部位,头发数据中可以包括头发等部位,在简化脸部数据的情况下,脸部数据中除了包括额头、眼睛、鼻子、嘴巴、脸颊、耳朵等部位之外,还可能包括 部分头发、背景等数据,头发数据中除了包括头发等部位之外,还可能包括部分额头、部分耳朵、部分两部、脖子、背景等数据。In general, face data may include forehead, eyes, nose, mouth, cheeks, ears and other parts, and hair data may include hair and other parts. In the case of simplified face data, in addition to forehead, In addition to parts such as eyes, nose, mouth, cheeks, ears, etc., it may also include data such as part of hair, background, etc. In addition to parts such as hair, hair data may also include part of forehead, part of ears, part of two parts, neck, background data.
此外,若图像数据中存在多个人脸数据,则分别统计多个人脸数据的面积,若人脸数据以人脸框框定,该人脸框的宽为w,高为h,则该人脸数据的面积S=w×h。In addition, if there are multiple face data in the image data, the area of the multiple face data is counted respectively. If the face data is framed by a face frame, the width of the face frame is w and the height is h, then the face data The area S=w×h.
将至少一个人脸数据的面积进行比较,提取面积最大的k个(k为正整数,如3个)人脸数据,参考面积最大的k个人脸数据划分与头部轮廓匹配的头部数据,由于摄像头的成像特性、回调人脸数据的方法,其对面积较大的人脸数据的颜色描述较为准确,选择面积最大的k个人脸数据划分与头部轮廓匹配的头部数据,可以在降低计算量的情况下、保证后续统计皮肤数据的亮度值的精确度。Compare the area of at least one face data, extract the k face data with the largest area (k is a positive integer, such as 3), and refer to the k face data with the largest area to divide the head data that matches the head contour, Due to the imaging characteristics of the camera and the method of recalling face data, the color description of face data with a larger area is more accurate. Selecting the k face data with the largest area to divide the head data that matches the head contour can reduce the In the case of the amount of calculation, the accuracy of the brightness value of the subsequent statistical skin data is guaranteed.
例如,面积最大的k个人脸数据,可为,按照面积从大至小对人脸数据进行排序,k个人脸数据可为此排序中的前k个人脸数据。但不限制于此类基于面积大小选取人脸数据的选取方式。For example, the k face data with the largest area may be the face data sorted according to the area from large to small, and the k face data may be the top k face data in this sorting. However, it is not limited to such a selection method of selecting face data based on the size of the area.
在图像数据中存在多个人脸数据的情况下,也可以针对全部人脸数据划分与头部轮廓匹配的头部数据,本实施例对此不加以限制。In the case where there are multiple face data in the image data, head data matching the head contour may also be divided for all face data, which is not limited in this embodiment.
步骤102、将图像数据的色彩值代入第一映射函数中,以计算图像数据属于皮肤数据的第一目标概率。Step 102: Substitute the color value of the image data into the first mapping function to calculate the first target probability that the image data belongs to the skin data.
在本实施例中,可以通过对皮肤数据、非皮肤数据等不同样本中的像素点统计色彩值的方式设置第一映射函数,该第一映射函数可用于基于色彩值识别皮肤数据,即该第一映射函数的输入为色彩值,输出为当前数据属于皮肤数据的概率,此时,可统计不同样本中的像素点在某一色彩值下为皮肤数据的概率,从而将这些色彩值及其概率拟合为第一映射函数。In this embodiment, a first mapping function can be set by counting color values of pixels in different samples such as skin data and non-skin data, and the first mapping function can be used to identify skin data based on color values, that is, the first mapping function can be used to identify skin data based on color values. The input of a mapping function is the color value, and the output is the probability that the current data belongs to skin data. At this time, the probability that the pixels in different samples are skin data under a certain color value can be counted, so that these color values and their probabilities can be calculated. fit to the first mapping function.
为了保持通用性,第一映射函数可以参照不同种族、不同年龄段、不同肤色的用户的皮肤数据,也可以参照在不同光照情况下的皮肤数据,因此,第一映射函数较为宽泛,精确度相对较高。In order to maintain generality, the first mapping function can refer to the skin data of users of different races, different ages, and different skin tones, and can also refer to the skin data under different lighting conditions. Therefore, the first mapping function is relatively broad and relatively accurate. higher.
一般情况下,第一映射函数中当前数据属于皮肤数据的概率为连续值,如[0-1],在部分情况下,第一映射函数中当前数据属于皮肤数据的概率为离散值,如0、1,本实施例对此不加以限制。In general, the probability that the current data in the first mapping function belongs to skin data is a continuous value, such as [0-1], and in some cases, the probability that the current data in the first mapping function belongs to skin data is a discrete value, such as 0 1, which is not limited in this embodiment.
在一个示例中,如图3所示,在第一映射函数所处坐标系中,横坐标(横轴)为色彩值(X)、纵坐标(纵轴)为当前数据属于皮肤数据的概率(P)。In an example, as shown in FIG. 3 , in the coordinate system where the first mapping function is located, the abscissa (horizontal axis) is the color value (X), and the ordinate (vertical axis) is the probability that the current data belongs to skin data ( P).
该第一映射函数包括依次连接的第一色彩映射段(横坐标为[x 0,x 1])、第 二色彩映射段(横坐标为[x 1,x 2])、第三色彩映射段(横坐标为[x 2,x 3]),其中,第一色彩映射段中属于皮肤数据的概率从0上升至1,第二色彩映射段中属于皮肤数据的概率为1,第三色彩映射段中属于皮肤数据的概率从1下降至0。 The first mapping function includes a first color mapping segment (the abscissa is [x 0 , x 1 ]), a second color mapping segment (the abscissa is [x 1 , x 2 ]), and a third color mapping segment connected in sequence (the abscissa is [x 2 , x 3 ]), wherein the probability of belonging to skin data in the first color mapping segment increases from 0 to 1, the probability of belonging to skin data in the second color mapping segment is 1, and the third color mapping segment The probability that a segment belongs to skin data drops from 1 to 0.
在一个示例中,第二色彩映射段属于线段,第一色彩映射段、第三色彩映射段属于曲线,可以通过使用多项式函数等方式进行拟合。In an example, the second color map segment belongs to a line segment, and the first color map segment and the third color map segment belong to a curve, which can be fitted by using a polynomial function or the like.
上述第一映射函数只是作为示例,在实施本申请实施例时,可以根据实际情况设置其它第一映射函数,例如,该第一映射函数包括依次连接的第一色彩映射段、第二色彩映射段,其中,第一色彩映射段中当前数据属于皮肤数据的概率从0上升至1,第二色彩映射段中当前数据属于皮肤数据的概率从1下降至0,此时,映射函数以一元二次方程等函数表达,等等,本申请实施例对此不加以限制。另外,除了上述第一映射函数外,本领域技术人员还可以根据实际需要采用其它第一映射函数,本申请实施例对此也不加以限制。The above-mentioned first mapping function is only an example. When implementing the embodiments of the present application, other first mapping functions may be set according to actual conditions. For example, the first mapping function includes a first color mapping segment and a second color mapping segment connected in sequence. , where the probability that the current data in the first color mapping segment belongs to skin data increases from 0 to 1, and the probability that the current data in the second color mapping segment belongs to skin data decreases from 1 to 0. At this time, the mapping function is a one-dimensional quadratic Function expressions such as equations, etc., are not limited in the embodiments of the present application. In addition, in addition to the above-mentioned first mapping function, those skilled in the art may also adopt other first mapping functions according to actual needs, which are not limited in this embodiment of the present application.
在不同颜色空间中,色彩值具有不同的色度分量,可针对每个色彩分量设置相应的映射函数,例如,在RGB颜色空间中,具有红色色度分量(R)、绿色色度分量(G)、蓝色色度分量(B),则可以针对红色色度分量(R)设置映射函数、针对绿色色度分量(G)设置映射函数、针对蓝色色度分量(B)设置映射函数,又例如,在YCbCr颜色空间中,具有蓝色色度分量(Cb)、红色色度分量(Cr),则可以针对蓝色色度分量(Cb)设置映射函数、针对红色色度分量(Cr)设置映射函数,等等。In different color spaces, color values have different chrominance components, and a corresponding mapping function can be set for each color component. ), blue chrominance component (B), then you can set the mapping function for the red chrominance component (R), set the mapping function for the green chrominance component (G), set the mapping function for the blue chrominance component (B), and for example , in the YCbCr color space, with blue chrominance components (Cb) and red chrominance components (Cr), you can set the mapping function for the blue chrominance component (Cb) and set the mapping function for the red chrominance component (Cr), and many more.
在本实施例中,可以应用第一映射函数对图像数据进行肤色检测,从而在色彩值的维度下、检测图像数据中每个像素点表征皮肤数据的程度。In this embodiment, the first mapping function may be applied to detect the skin color of the image data, so as to detect the degree to which each pixel in the image data represents the skin data in the dimension of color value.
在一个示例中,可在第一映射函数所处的坐标系中的横轴标记图像数据每个像素点的色彩值,若图像数据中像素点的色彩值在第一映射函数外,则该像素点属于皮肤数据的概率为0,若图像数据中像素点的色彩值在第一映射函数内,则可通过第一映射函数查找该色彩值在纵轴对应的概率,作为该像素点属于皮肤数据的第一目标概率。In one example, the color value of each pixel of the image data can be marked on the horizontal axis in the coordinate system where the first mapping function is located. If the color value of the pixel in the image data is outside the first mapping function, the pixel The probability that the point belongs to the skin data is 0. If the color value of the pixel in the image data is within the first mapping function, the probability corresponding to the color value on the vertical axis can be found through the first mapping function, as the pixel belongs to the skin data. The first target probability of .
在一些情况中,映射函数的横坐标为色彩值、纵坐标为像素点属于皮肤数据的概率,在不同颜色空间中,色彩值具有不同的色度分量,每个色彩分量具有相应的映射函数,针对同一个像素点,可计算出不同的概率。In some cases, the abscissa of the mapping function is the color value, and the ordinate is the probability that the pixel belongs to the skin data. In different color spaces, the color value has different chromaticity components, and each color component has a corresponding mapping function, For the same pixel, different probabilities can be calculated.
针对此情况,可查询图像数据中每个像素点的色彩值,将色彩值代入相应的第一映射函数中,以映射为像素点在该色彩值下属于皮肤数据的候选概率,基于这些候选概率,可使用求平均值、求和、乘积、线性融合(即配置权重之 后求和)等方式计算像素点属于皮肤数据的第一目标概率,这些第一目标概率体现了在色彩值的维度下、肤色的ROI(region of interest,感兴趣区域)区域。In view of this situation, the color value of each pixel in the image data can be queried, and the color value can be substituted into the corresponding first mapping function to map it as the candidate probability that the pixel belongs to the skin data under the color value. Based on these candidate probabilities , the first target probability that the pixel belongs to the skin data can be calculated by means of averaging, summing, product, linear fusion (that is, summing after configuring the weight), and these first target probabilities are reflected in the dimension of color value, ROI (region of interest, region of interest) area of skin color.
在一个示例中,针对YCbCr颜色空间,图像数据具有蓝色色度分量Cb、红色色度分量Cr。In one example, for the YCbCr color space, the image data has a blue chrominance component Cb, a red chrominance component Cr.
一方面,将蓝色色度分量Cb的色彩值代入蓝色色度分量Cb对应的第一映射函数中,以映射为像素点在蓝色色度分量Cb下属于皮肤数据的蓝色概率,作为候选概率
Figure PCTCN2021141287-appb-000003
On the one hand, the color value of the blue chrominance component Cb is substituted into the first mapping function corresponding to the blue chrominance component Cb, so as to be mapped as the blue probability that the pixel belongs to the skin data under the blue chrominance component Cb, as the candidate probability
Figure PCTCN2021141287-appb-000003
另一方面,将红色色度分量Cr的色彩值代入红色色度分量Cr对应的第一映射函数中,以映射为像素点在红色色度分量Cr下属于皮肤数据的红色概率,作为候选概率
Figure PCTCN2021141287-appb-000004
On the other hand, the color value of the red chrominance component Cr is substituted into the first mapping function corresponding to the red chrominance component Cr, so as to be mapped as the red probability that the pixel belongs to the skin data under the red chrominance component Cr, as the candidate probability
Figure PCTCN2021141287-appb-000004
此时,可计算蓝色概率
Figure PCTCN2021141287-appb-000005
与红色概率
Figure PCTCN2021141287-appb-000006
之间的乘积,作为像素点属于皮肤数据的第一目标概率
Figure PCTCN2021141287-appb-000007
At this point, the blue probability can be calculated
Figure PCTCN2021141287-appb-000005
with red probability
Figure PCTCN2021141287-appb-000006
The product between , as the first target probability that the pixel belongs to the skin data
Figure PCTCN2021141287-appb-000007
步骤103、参考头部数据的亮度值生成第二映射函数。 Step 103 , generating a second mapping function with reference to the luminance value of the header data.
如果在图像数据中检测到人脸数据,则可以对人脸数据进行修正,得到头部数据,在头部数据的范围内统计亮度值,该亮度值为皮肤数据的亮度值的置信度较高,可作为针对当前用户生成第二映射函数,提高第二映射函数对于当前用户的精确度,即,在本实施例中,可以通过头部数据的亮度值设置第二映射函数,该第二映射函数可用于基于亮度值识别皮肤数据,即该映射函数的输入为亮度值,输出为当前数据属于皮肤数据的概率,此时,可统计头部数据的像素点在某一亮度值下为皮肤数据的概率,从而将这些亮度值及其概率拟合为第二映射函数。If face data is detected in the image data, the face data can be corrected to obtain head data, and the brightness value is counted in the range of the head data. The brightness value of the brightness value has a high confidence in the brightness value of the skin data , which can be used to generate a second mapping function for the current user to improve the accuracy of the second mapping function for the current user, that is, in this embodiment, the second mapping function can be set by the brightness value of the header data, and the second mapping function The function can be used to identify skin data based on the brightness value, that is, the input of the mapping function is the brightness value, and the output is the probability that the current data belongs to skin data. At this time, the pixels of the head data can be counted as skin data under a certain brightness value. to fit these luminance values and their probabilities to the second mapping function.
一般情况下,第二映射函数中当前数据属于皮肤数据的概率为连续值,如[0-1],在部分情况下,第二映射函数中当前数据属于皮肤数据的概率为离散值,如0、1,本实施例对此不加以限制。In general, the probability that the current data in the second mapping function belongs to skin data is a continuous value, such as [0-1], and in some cases, the probability that the current data in the second mapping function belongs to skin data is a discrete value, such as 0 1, which is not limited in this embodiment.
在一个示例中,如图4所示,在第二映射函数所处坐标系中,横坐标(横轴)为亮度值(X)、纵坐标(纵轴)为当前数据属于皮肤数据的概率(P)。In an example, as shown in FIG. 4 , in the coordinate system where the second mapping function is located, the abscissa (horizontal axis) is the luminance value (X), and the ordinate (vertical axis) is the probability that the current data belongs to skin data ( P).
该第二映射函数包括依次连接的第一亮度映射段(横坐标为[x 0,x 1])、第二亮度映射段(横坐标为[x 1,x 2]),其中,第一亮度映射段中当前数据属于皮肤数据的概率从0上升至1,第二亮度映射段中当前数据属于皮肤数据的概率为1。 The second mapping function includes a first luminance mapping segment (the abscissa is [x 0 , x 1 ]) and a second luminance mapping segment (the abscissa is [x 1 , x 2 ]) connected in sequence, wherein the first luminance The probability that the current data in the mapping segment belongs to skin data increases from 0 to 1, and the probability that the current data in the second luminance mapping segment belongs to skin data is 1.
在一个示例中,第二亮度映射段属于线段,第一亮度映射段属于曲线,可以通过使用多项式函数等方式进行拟合。In an example, the second luminance mapping segment belongs to a line segment, and the first luminance mapping segment belongs to a curve, which can be fitted by using a polynomial function or the like.
上述第二映射函数只是作为示例,在实施本申请实施例时,可以根据实际情况设置其它第二映射函数,例如,该第二映射函数包括依次连接的第一亮度映射段、第二亮度映射段、第三亮度映射段,其中,第一亮度映射段参考头发数据中的像素点拟合、其属于皮肤数据的概率从0上升至1,第二亮度映射段参考脸部数据中肤色范围内的像素点拟合、其属于皮肤数据的概率为1,第三亮度映射段参考脸部数据中非肤色范围(如眼镜、牙齿、眉毛等)内的像素点拟合、其属于皮肤数据的概率从1下降至0,等等,本申请实施例对此不加以限制。另外,除了上述第二映射函数外,本领域技术人员还可以根据实际需要采用其它第二映射函数,本申请实施例对此也不加以限制。The above-mentioned second mapping function is only an example. When implementing the embodiments of the present application, other second mapping functions may be set according to actual conditions. For example, the second mapping function includes a first luminance mapping segment and a second luminance mapping segment connected in sequence. , the third brightness mapping segment, wherein, the first brightness mapping segment refers to the pixel point fitting in the hair data, and the probability of it belonging to the skin data rises from 0 to 1, and the second brightness mapping segment refers to the skin color range in the face data. Pixel point fitting, the probability that it belongs to skin data is 1, and the third brightness mapping segment refers to the pixel point fitting in the non-skin color range (such as glasses, teeth, eyebrows, etc.) in the face data, and its probability of belonging to skin data is from 1 drops to 0, etc., which are not limited in the embodiments of the present application. In addition, in addition to the above-mentioned second mapping function, those skilled in the art may also adopt other second mapping functions according to actual needs, which are not limited in this embodiment of the present application.
在一种拟合的方式中,若头部数据包括与头部轮廓中的脸部轮廓匹配的脸部数据、与头部轮廓中的头发轮廓匹配的头发数据,在脸部数据中,像素点属于皮肤数据的概率较高,在头发数据中,像素点属于皮肤数据的概率较低。如果脸部数据的亮度值大于头发数据的亮度值,那么,可以利用亮度值来对肤色检测进行压制。In a fitting method, if the head data includes face data matching the face contour in the head contour and hair data matching the hair contour in the head contour, in the face data, the pixel point The probability of belonging to skin data is high, and in hair data, the probability of pixels belonging to skin data is low. If the brightness value of the face data is greater than the brightness value of the hair data, then the skin color detection can be suppressed by using the brightness value.
一方面统计头发数据的亮度值,作为第一参考亮度值,在亮度值-概率的坐标系中,将第一参考亮度值对应像素点属于皮肤数据的概率为0。On the one hand, the brightness value of the hair data is counted as the first reference brightness value. In the brightness value-probability coordinate system, the probability that the pixel corresponding to the first reference brightness value belongs to the skin data is 0.
另一方面,统计脸部数据与头发数据的亮度值,作为第二参考亮度值,在亮度值-概率的坐标系中,将第二参考亮度值对应像素点属于皮肤数据的概率为1。On the other hand, the luminance values of the face data and hair data are counted as the second reference luminance value, and in the luminance value-probability coordinate system, the probability that the pixel corresponding to the second reference luminance value belongs to the skin data is 1.
此时,可在第一亮度映射段中,以第一参考亮度值作为起点、第二参考亮度值作为终点拟合曲线,在第二亮度映射段中,以第二参考亮度值作为起点拟合直线,从而生成第二映射函数。At this time, in the first luminance mapping section, the first reference luminance value is used as the starting point and the second reference luminance value is used as the end point to fit the curve, and in the second luminance mapping section, the second reference luminance value is used as the starting point to fit the curve straight line, thereby generating the second mapping function.
此外,对于脸部数据为椭圆形等情况,对椭圆形中像素点进行统计亮度值的操作较为复杂,而人脸数据多以人脸框框定,人脸框为矩形,对矩形中像素点进行统计亮度值的操作较为简单,而两者相差较少,因此,可将人脸数据替代脸部数据,在保持一定精确度的情况下,提高操作的简便性,提高计算的速度,降低计算的耗时。In addition, for the case where the face data is an ellipse, it is more complicated to calculate the brightness value of the pixels in the ellipse, while the face data is mostly framed by a face frame, and the face frame is a rectangle. The operation of counting the brightness values is relatively simple, and the difference between the two is relatively small. Therefore, the face data can be replaced by the face data, while maintaining a certain accuracy, the simplicity of the operation is improved, the calculation speed is increased, and the calculation time is reduced. time consuming.
在一个示例中,一方面统计头发数据的亮度值,作为第一参考亮度值,在亮度值-概率的坐标系中,将第一参考亮度值对应像素点属于皮肤数据的概率为0,另一方面,统计人脸数据与头发数据的亮度值,作为第二参考亮度值,在亮度值-概率的坐标系中,将第二参考亮度值对应像素点属于皮肤数据的概率为1。In an example, on the one hand, the brightness value of the hair data is counted as the first reference brightness value. In the brightness value-probability coordinate system, the probability that the pixel corresponding to the first reference brightness value belongs to the skin data is 0, and the other In one aspect, the brightness values of the face data and the hair data are counted as the second reference brightness value. In the brightness value-probability coordinate system, the probability that the pixel corresponding to the second reference brightness value belongs to the skin data is 1.
此时,可在第一亮度映射段中,以第一参考亮度值作为起点、第二参考亮 度值作为终点拟合曲线,在第二亮度映射段中,以第二参考亮度值作为起点拟合直线,从而生成第二映射函数。At this time, in the first luminance mapping section, the first reference luminance value is used as the starting point and the second reference luminance value is used as the end point to fit the curve, and in the second luminance mapping section, the second reference luminance value is used as the starting point to fit the curve straight line, thereby generating the second mapping function.
步骤104、将图像数据的亮度值代入第二映射函数中,以计算图像数据属于皮肤数据的第二目标概率。Step 104: Substitute the brightness value of the image data into the second mapping function to calculate the second target probability that the image data belongs to the skin data.
在本实施例中,可以应用第二映射函数对图像数据进行肤色检测,从而在亮度值的维度下、检测图像数据中每个像素点表征皮肤数据的程度。In this embodiment, the second mapping function can be applied to detect the skin color of the image data, so as to detect the degree to which each pixel point in the image data represents the skin data in the dimension of brightness value.
在一示例中,可查询图像数据中每个像素点的亮度值,将亮度值代入第二映射函数中,以映射为像素点属于皮肤数据的第二目标概率,即,在第二映射函数所处的坐标系中的横轴标记图像数据每个像素点的亮度值,若图像数据中像素点的亮度值在第二映射函数外,则该像素点属于皮肤数据的概率为0,若图像数据中像素点的亮度值在第二映射函数内,则可通过第二映射函数查找该亮度值在纵轴对应的概率,作为该像素点属于皮肤数据的第二目标概率。In an example, the brightness value of each pixel in the image data can be queried, and the brightness value can be substituted into the second mapping function to be mapped as the second target probability that the pixel belongs to the skin data, that is, in the second mapping function. The horizontal axis marks the brightness value of each pixel of the image data in the coordinate system at If the brightness value of the middle pixel is within the second mapping function, the probability corresponding to the brightness value on the vertical axis can be found through the second mapping function as the second target probability that the pixel belongs to the skin data.
步骤105、结合第一目标概率与第二目标概率在图像数据中检测皮肤数据。 Step 105, combining the first target probability and the second target probability to detect skin data in the image data.
针对同一个帧图像数据,可以使用求平均值、求和、乘积、线性融合(即配置权重之后求和)等方式结合在色彩值的维度下的第一目标概率、在亮度值的维度下的第二目标概率,对目标数据进行肤色检测,从而在图像数据中检测像素点表征皮肤数据的程度。For the same frame of image data, methods such as averaging, summing, multiplying, linear fusion (that is, summing after configuring weights) can be used to combine the first target probability in the dimension of color value and the probability in the dimension of luminance value. The second target probability is to perform skin color detection on the target data, so as to detect the degree to which the pixel points represent the skin data in the image data.
在一个示例中,可认为色彩值、亮度值均较为重要,此时,针对图像数据中的同一个像素点,计算第一目标概率与第二目标概率之间的乘积,作为像素点属于皮肤数据的第三目标概率,在色彩值的维度下的第一目标概率、在亮度值的维度下的第二目标概率均较大时,两者相乘的第三目标概率的数值较大,在色彩值的维度下的第一目标概率、在亮度值的维度下的第二目标概率中的某一者较大、另一者较小时,两者相乘的第三目标概率的数值较小。In an example, it can be considered that both the color value and the brightness value are important. At this time, for the same pixel in the image data, the product between the first target probability and the second target probability is calculated, as the pixel belongs to the skin data. The third target probability of , when the first target probability in the dimension of color value and the second target probability in the dimension of brightness value are both larger, the value of the third target probability multiplied by the two is larger, and in the color value When one of the first target probability in the dimension of value and the second target probability in the dimension of luminance value is larger and the other is smaller, the value of the third target probability multiplied by the two is smaller.
此外,若在先未检测到人脸数据,则可以基于颜色空间在图像数据中检测皮肤数据,基于颜色空间的方法计算简单,因此,计算速度快,耗时少,统计多个皮肤数据的颜色值可以在整体上保持较高的精确度,满足先验知识的要求。In addition, if the face data is not detected before, skin data can be detected in the image data based on the color space. The method based on the color space is simple to calculate, so the calculation speed is fast, the time-consuming is small, and the color of multiple skin data is counted. The value can maintain a high accuracy on the whole to meet the requirements of prior knowledge.
由于图像数据的颜色空间有所不同,针对不同的颜色空间,可使用与该颜色空间相应的方法在人脸数据中检测皮肤数据,或者,将图像数据转换至指定的颜色空间中,使用与指定的颜色空间相应的方法在人脸数据中检测皮肤数据,本实施例对此不加以限制。Since the color space of the image data is different, for different color spaces, you can use the method corresponding to the color space to detect the skin data in the face data, or convert the image data to the specified color space, use and specify The method corresponding to the color space of 1 detects skin data in the face data, which is not limited in this embodiment.
在一个示例中,针对RGB颜色空间,像素点的色彩值符合如下条件时,可以认为该像素点是皮肤数据(即该像素点属于皮肤数据的概率为1),像素点的 色彩值不符合如下条件时,可以认为该像素点不是皮肤数据(即该像素点属于皮肤数据的概率为0):In an example, for the RGB color space, when the color value of a pixel meets the following conditions, it can be considered that the pixel is skin data (that is, the probability that the pixel belongs to skin data is 1), and the color value of the pixel does not meet the following conditions When the conditions are met, it can be considered that the pixel is not skin data (that is, the probability that the pixel belongs to skin data is 0):
R>95,G>40,B>20,R>G,R>BR>95, G>40, B>20, R>G, R>B
(Max(R,G,B)-Min(R,G,B))>15(Max(R,G,B)-Min(R,G,B))>15
Abs(R-G)>5Abs(R-G)>5
其中,Max表示取最大值,Min表示取最小值,Abs表示取绝对值。Among them, Max represents the maximum value, Min represents the minimum value, and Abs represents the absolute value.
其中,R表示红色色度分量,G表示绿色色度分量,B表示蓝色色度分量。Among them, R represents the red chrominance component, G represents the green chrominance component, and B represents the blue chrominance component.
在另一个示例中,针对YCbCr颜色空间,像素点的色彩值符合如下条件时,可以认为该像素点是皮肤数据(即该像素点属于皮肤数据的概率为1),像素点的色彩值不符合如下条件时,可以认为该像素点不是皮肤数据(即该像素点属于皮肤数据的概率为0):In another example, for the YCbCr color space, when the color value of a pixel meets the following conditions, it can be considered that the pixel is skin data (that is, the probability that the pixel belongs to skin data is 1), and the color value of the pixel does not meet the following conditions. Under the following conditions, it can be considered that the pixel is not skin data (that is, the probability that the pixel belongs to skin data is 0):
Figure PCTCN2021141287-appb-000008
Figure PCTCN2021141287-appb-000008
Figure PCTCN2021141287-appb-000009
Figure PCTCN2021141287-appb-000009
c x=109.38,c y=152.02,θ=2.53,
Figure PCTCN2021141287-appb-000010
a=25.39,b=14.03
c x =109.38, c y =152.02, θ = 2.53,
Figure PCTCN2021141287-appb-000010
a=25.39, b=14.03
其中,Cb表示蓝色色度分量,Cr表示红色色度分量。Among them, Cb represents the blue chrominance component, and Cr represents the red chrominance component.
为使本领域技术人员更好地理解本申请实施例,以下通过示例来说明本实施例中的肤色检测方法。In order for those skilled in the art to better understand the embodiments of the present application, the following examples are used to describe the skin color detection method in this embodiment.
如图5所示,针对同一帧图像数据,左侧为使用基于颜色空间进行肤色检测所得到的概率分布对应的灰度分布,右侧为应用本实施例进行肤色检测所得到的概率分布对应的灰度分布,其中,像素点的灰度越高(越偏白色)表示该像素点属于皮肤数据的概率越高,灰度越低(越偏黑色)表示该像素点属于皮肤数据的概率越低。As shown in Figure 5, for the same frame of image data, the left side is the grayscale distribution corresponding to the probability distribution obtained by using the color space-based skin color detection, and the right side is the probability distribution corresponding to the skin color detection obtained by applying this embodiment. Grayscale distribution, in which, the higher the grayscale of a pixel (more white), the higher the probability that the pixel belongs to skin data, and the lower the grayscale (more black), the lower the probability that the pixel belongs to skin data. .
由于采集图像数据时,光照、肤色、发色等因素交杂,头发、脸部非肤色区域与肤色区域在色彩值上较为接近,在颜色的维度下较为容易发生错检的情况,但头发、脸部非肤色区域与肤色区域在亮度值上存在较大的差异。Due to the combination of factors such as illumination, skin color, and hair color when collecting image data, the color value of the non-skin color area of the hair and face is relatively close to the skin color area. There is a big difference in the brightness value between the non-skin area and the skin area of the face.
基于颜色空间进行肤色检测将头发、脸部非肤色区域(如眉毛、眼睛、鼻子、嘴巴等)、背景(如电灯等)均较多地认为属于皮肤数据,而本实施例可以很好地排除头发、脸部非肤色区域(如眉毛、眼睛、鼻子、嘴巴等)、背景(如 电灯等),大大提高了肤色检测的准确率,在后续的美颜处理(如磨皮)中可以很好地保护头发、脸部非肤色区域(如眉毛、眼睛、鼻子、嘴巴等)、背景(如电灯等)。Skin color detection based on color space considers hair, non-skin color areas of the face (such as eyebrows, eyes, nose, mouth, etc.), and background (such as electric lights, etc.) to belong to skin data, and this embodiment can be well excluded. Hair, non-skin color areas of the face (such as eyebrows, eyes, nose, mouth, etc.), background (such as electric lights, etc.), greatly improve the accuracy of skin color detection, and can be very good in subsequent beauty processing (such as microdermabrasion) Protect hair, non-skinned areas of the face (such as eyebrows, eyes, nose, mouth, etc.), background (such as electric lights, etc.).
在本实施例中,在图像数据中检测人脸数据、参考人脸数据划分与头部轮廓匹配的头部数据,将图像数据的色彩值代入第一映射函数中,以计算图像数据属于皮肤数据的第一目标概率,参考头部数据的亮度值生成第二映射函数,第二映射函数用于基于亮度值识别皮肤数据,将图像数据的亮度值代入第二映射函数中,以计算图像数据属于皮肤数据的第二目标概率,结合第一目标概率与第二目标概率在图像数据中检测皮肤数据,人脸数据可以在一定程度上体现用户头部的空间位置信息,以人脸数据作为基础描述头部数据,可以保证头部数据的准确性,以头部数据作为锚点可以捕捉到优质的皮肤数据及其接近的非皮肤数据,可以在当前的业务场景中对皮肤数据统计出较为准确的亮度值,以此自适应生成第二映射函数,可以保证第二映射函数在当前的业务场景中进行肤色检测的准确性,并且,在色彩、亮度这两个维度下结合进行肤色检测,丰富了肤色检测的维度,从而提高了肤色检测的准确性,此外,人脸检测、绘制头部数据、统计色彩值与亮度值、第一映射函数与第二映射函数的生成及其应用等操作均较为简单,计算量少、速度快、耗时短,在移动终端等设备性能受限的情况下,可实现实时对视频数据进行肤色检测。In this embodiment, face data is detected in the image data, the head data matching the head contour is divided with reference to the face data, and the color value of the image data is substituted into the first mapping function to calculate that the image data belongs to the skin data The first target probability of The second target probability of the skin data, combined with the first target probability and the second target probability to detect skin data in the image data, the face data can reflect the spatial position information of the user's head to a certain extent, and the face data is used as the basic description Head data can ensure the accuracy of head data. Using head data as an anchor point, high-quality skin data and its close non-skin data can be captured, and more accurate skin data can be counted in current business scenarios. The brightness value is used to adaptively generate the second mapping function, which can ensure the accuracy of skin color detection by the second mapping function in the current business scene. The dimension of skin color detection improves the accuracy of skin color detection. In addition, operations such as face detection, drawing head data, statistics of color values and brightness values, generation and application of the first mapping function and the second mapping function are relatively simple. It is simple, requires less computation, is fast, and takes less time. When the performance of devices such as mobile terminals is limited, skin color detection can be performed on video data in real time.
在一实施例中,在提高肤色检测的准确性的情况下,可以排除色彩值上一些与皮肤数据相似的数据,如头发、脸部非肤色区域、背景等,使得在后续美颜处理(如磨皮处理)中保护色彩与皮肤数据相似的数据,减缓或避免与皮肤数据相似的数据因美颜处理(如磨皮处理)而导致清晰度下降的情况,从而保证美颜处理的质量。In one embodiment, under the condition of improving the accuracy of skin color detection, some data on color values that are similar to skin data can be excluded, such as hair, non-skin color areas of the face, background, etc., so that in the subsequent beauty processing (such as Microdermabrasion) to protect data whose color is similar to skin data, slow down or avoid the loss of clarity of data similar to skin data due to beautification processing (such as microdermabrasion), so as to ensure the quality of beautification processing.
对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请实施例并不受所描述的动作顺序的限制,因为依据本申请实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例所涉及的动作并不一定是本申请实施例所必须的。The method embodiments are described as a series of action combinations for the sake of simple description, but those skilled in the art should know that the embodiments of the present application are not limited by the described sequence of actions, because according to the embodiments of the present application , certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the actions involved in the embodiments described in the specification are not necessarily required by the embodiments of the present application.
实施例二Embodiment 2
图6为本申请实施例二提供的一种肤色检测装置的结构框图,可以包括如下模块:6 is a structural block diagram of a skin color detection device provided in Embodiment 2 of the present application, which may include the following modules:
图像数据检测模块601,设置为在图像数据中检测人脸数据、参考所述人脸 数据划分与头部轮廓匹配的头部数据;Image data detection module 601 is set to detect face data in image data, divide the head data that matches with head contour with reference to described face data;
第一目标概率计算模块602,设置为将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率;The first target probability calculation module 602 is configured to substitute the color value of the image data into the first mapping function to calculate the first target probability that the image data belongs to skin data;
映射函数生成模块603,设置为参考所述头部数据的亮度值生成第二映射函数,所述第二映射函数用于基于亮度值识别皮肤数据;A mapping function generation module 603, configured to generate a second mapping function with reference to the brightness value of the head data, where the second mapping function is used to identify skin data based on the brightness value;
第二目标概率计算模块604,设置为将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率;The second target probability calculation module 604 is configured to substitute the brightness value of the image data into the second mapping function to calculate the second target probability that the image data belongs to skin data;
皮肤检测模块605,设置为结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数据。The skin detection module 605 is configured to detect skin data in the image data by combining the first target probability and the second target probability.
在本申请的一个实施例中,所述图像数据检测模块601包括:In an embodiment of the present application, the image data detection module 601 includes:
人脸检测接口调用模块,设置为调用摄像头提供的人脸检测接口,以请求在所述摄像头采集的图像数据中检测人脸数据;a face detection interface calling module, configured to call the face detection interface provided by the camera to request to detect the face data in the image data collected by the camera;
人脸框接收模块,设置为接收所述人脸检测接口返回的至少一个人脸框,所述人脸框用于框定人脸数据。The face frame receiving module is configured to receive at least one face frame returned by the face detection interface, where the face frame is used to frame face data.
在本申请的一个实施例中,所述头部数据包括脸部数据、头发数据;所述图像数据检测模块601包括:In an embodiment of the present application, the head data includes face data and hair data; the image data detection module 601 includes:
脸部数据划分模块,设置为参考所述人脸数据划分与头部轮廓中的脸部轮廓匹配的脸部数据;a face data division module, configured to divide face data matching the face contour in the head contour with reference to the face data;
头发数据划分模块,设置为参考所述人脸数据划分与头部轮廓中的头发轮廓匹配的头发数据,所述头发数据包围所述脸部数据。The hair data division module is configured to divide the hair data matching the hair contour in the head contour with reference to the face data, and the hair data surrounds the face data.
在本申请实施例的一个示例中,若所述人脸数据以人脸框框定,则所述脸部数据符合如下条件:In an example of the embodiment of the present application, if the face data is framed by a face frame, the face data meets the following conditions:
所述脸部数据的形状为椭圆形;The shape of the face data is an ellipse;
所述脸部数据的焦点为所述人脸框中宽对应的框边的中点;The focus of the face data is the midpoint of the frame edge corresponding to the width of the face frame;
所述脸部数据的短轴的长度与所述人脸框中的宽相等;The length of the short axis of the face data is equal to the width in the face frame;
所述脸部数据的长轴的长度与目标边的长度的n倍相等,所述目标边为第一候选边、第二侯选边分别作为直角三角形的直角边时对应的斜边,所述第一侯选边为所述人脸框中宽取指定的第一比例,所述第二侯选边为所述人脸框中高取指定的第二比例。The length of the long axis of the face data is equal to n times the length of the target side. The first candidate edge is the width of the face frame with a specified first ratio, and the second candidate edge is the height of the face frame with a specified second ratio.
在本申请实施例的一个示例中,若所述人脸数据以人脸框框定,则所述头发数据符合如下条件:In an example of the embodiment of the present application, if the face data is framed by a face frame, the hair data meets the following conditions:
所述头发数据的形状为椭圆形;The shape of the hair data is an ellipse;
所述头发数据的焦点为所述人脸框中宽对应的框边的中点;The focus of the hair data is the midpoint of the frame edge corresponding to the width of the face frame;
所述头发数据的短轴的长度与所述人脸框中的宽的m倍相等,所述m与所述人脸数据的面积正相关;The length of the short axis of the hair data is equal to m times the width in the face frame, and the m is positively correlated with the area of the face data;
所述头发数据的长轴的长度与目标边的长度的n×m倍相等,所述目标边为第一候选边、第二侯选边分别作为直角三角形的直角边时对应的斜边,所述第一侯选边为所述人脸框中宽取指定的第一比例,所述第二侯选边为所述人脸框中高取指定的第二比例。The length of the long axis of the hair data is equal to n×m times the length of the target side, and the target side is the hypotenuse when the first candidate side and the second candidate side are respectively used as right-angled sides of a right-angled triangle, so The first candidate edge is the width of the face frame with a specified first ratio, and the second candidate edge is the height of the face frame with a specified second ratio.
在本申请的一个实施例中,所述图像数据检测模块601包括:In an embodiment of the present application, the image data detection module 601 includes:
面积统计模块,设置为响应于所述图像数据中存在多个人脸数据,分别统计多个所述人脸数据的面积;an area statistics module, configured to count the areas of a plurality of the face data respectively in response to the presence of a plurality of face data in the image data;
面积选取模块,设置为参考所述面积最大的k个所述人脸数据划分与头部轮廓匹配的头部数据。The area selection module is configured to divide the head data matching the head contour with reference to the k pieces of the face data with the largest area.
在本申请的一个实施例中,所述第一映射函数的横坐标为色彩值、纵坐标为当前数据属于皮肤数据的概率;In an embodiment of the present application, the abscissa of the first mapping function is the color value, and the ordinate is the probability that the current data belongs to skin data;
所述第一映射函数包括依次连接的第一色彩映射段、第二色彩映射段、第三色彩映射段,所述第一色彩映射段中当前数据属于皮肤数据的概率从0上升至1,所述第二色彩映射段中当前数据属于皮肤数据的概率为1,所述第三色彩映射段中当前数据属于皮肤数据的概率从1下降至0。The first mapping function includes a first color mapping section, a second color mapping section, and a third color mapping section that are connected in sequence, and the probability that the current data in the first color mapping section belongs to skin data increases from 0 to 1, so The probability that the current data in the second color mapping section belongs to skin data is 1, and the probability that the current data in the third color mapping section belongs to skin data decreases from 1 to 0.
在本申请的一个实施例中,所述第一目标概率计算模块602包括:In an embodiment of the present application, the first target probability calculation module 602 includes:
色彩值查询模块,设置为查询所述图像数据中像素点的色彩值;a color value query module, configured to query the color value of the pixel in the image data;
候选概率映射模块,设置为将所述色彩值代入所述第一映射函数中,以映射为所述像素点在所述色彩值下属于皮肤数据的候选概率;a candidate probability mapping module, configured to substitute the color value into the first mapping function to map the pixel point to the candidate probability of skin data under the color value;
目标概率结合模块,设置为基于所述候选概率计算所述像素点属于皮肤数据的第一目标概率。The target probability combining module is configured to calculate the first target probability that the pixel point belongs to the skin data based on the candidate probability.
在本申请的一个实施例中,所述候选概率映射模块包括:In an embodiment of the present application, the candidate probability mapping module includes:
蓝色概率映射模块,设置为将蓝色色度分量的色彩值代入所述蓝色色度分量对应的所述第一映射函数中,以映射为所述像素点在所述蓝色色度分量下属于皮肤数据的蓝色概率,作为候选概率;The blue probability mapping module is configured to substitute the color value of the blue chrominance component into the first mapping function corresponding to the blue chrominance component, so as to map the pixel point to the skin under the blue chrominance component The blue probability of the data, as the candidate probability;
红色概率映射模块,设置为将红色色度分量的色彩值代入所述红色色度分量对应的所述第一映射函数中,以映射为所述像素点在所述红色色度分量下属于皮肤数据的红色概率,作为候选概率;A red probability mapping module, configured to substitute the color value of the red chrominance component into the first mapping function corresponding to the red chrominance component, so as to map the pixel points to belong to skin data under the red chrominance component The red probability of , as the candidate probability;
所述目标概率结合模块包括:The target probability combination module includes:
第一概率乘积计算模块,设置为计算所述蓝色概率与所述红色概率之间的乘积,作为所述像素点属于皮肤数据的第一目标概率。The first probability product calculation module is configured to calculate the product between the blue probability and the red probability as the first target probability that the pixel belongs to the skin data.
在本申请的一个实施例中,所述第二映射函数的横坐标为亮度值、纵坐标为当前数据属于皮肤数据的概率;In an embodiment of the present application, the abscissa of the second mapping function is the brightness value, and the ordinate is the probability that the current data belongs to skin data;
所述第二映射函数包括依次连接的第一亮度映射段、第二亮度映射段,所述第一亮度映射段中当前数据属于皮肤数据的概率从0上升至1,所述第二亮度映射段中当前数据属于皮肤数据的概率为1。The second mapping function includes a first luminance mapping segment and a second luminance mapping segment connected in sequence, the probability that the current data in the first luminance mapping segment belongs to skin data increases from 0 to 1, and the second luminance mapping segment The probability that the current data belongs to skin data is 1.
在本申请的一个实施例中,所述头部数据包括与头部轮廓中的脸部轮廓匹配的脸部数据、与头部轮廓中的头发轮廓匹配的头发数据,In an embodiment of the present application, the head data includes face data matched with the face contour in the head contour, hair data matched with the hair contour in the head contour,
所述映射函数生成模块603包括:The mapping function generation module 603 includes:
第一参考亮度值统计模块,设置为统计所述头发数据的亮度值,作为第一参考亮度值,所述第一参考亮度值对应当前数据属于皮肤数据的概率为0;a first reference brightness value statistics module, configured to count the brightness value of the hair data as the first reference brightness value, and the probability that the first reference brightness value corresponds to the current data belonging to the skin data is 0;
第二参考亮度值统计模块,设置为统计所述脸部数据与所述头发数据的亮度值,作为第二参考亮度值,所述第二参考亮度值对应当前数据属于皮肤数据的概率为1;The second reference brightness value statistics module is configured to count the brightness values of the face data and the hair data as the second reference brightness value, and the probability that the second reference brightness value corresponds to the current data belonging to the skin data is 1;
第一亮度映射段拟合模块,设置为在所述第一亮度映射段中,以所述第一参考亮度值作为起点、所述第二参考亮度值作为终点拟合曲线;a first luminance mapping segment fitting module, configured to fit a curve with the first reference luminance value as a starting point and the second reference luminance value as an end point in the first luminance mapping segment;
第二亮度映射段拟合模块,设置为在所述第二亮度映射段中,以所述第二参考亮度值作为起点拟合直线。The second luminance mapping segment fitting module is configured to fit a straight line with the second reference luminance value as a starting point in the second luminance mapping segment.
在本申请的一个实施例中,所述映射函数生成模块603包括:In an embodiment of the present application, the mapping function generation module 603 includes:
脸部数据替代模块,设置为将所述人脸数据替代所述脸部数据。A face data replacement module, configured to replace the face data with the face data.
在本申请的一个实施例中,所述第二目标概率计算模块604包括:In an embodiment of the present application, the second target probability calculation module 604 includes:
亮度值统计模块,设置为查询所述图像数据中像素点的亮度值;a brightness value statistics module, configured to query the brightness values of pixels in the image data;
亮度值映射模块,设置为将所述亮度值代入所述第二映射函数中,以映射为所述像素点属于皮肤数据的第二目标概率。The luminance value mapping module is configured to substitute the luminance value into the second mapping function, so as to map the pixel to the second target probability that the pixel belongs to the skin data.
在本申请的一个实施例中,所述皮肤检测模块605包括:In an embodiment of the present application, the skin detection module 605 includes:
第二概率乘积计算模块,设置为针对所述图像数据中的同一个像素点,计算所述像素点的所述第一目标概率与所述像素点的所述第二目标概率之间的乘积,作为所述像素点属于皮肤数据的第三目标概率。A second probability product calculation module, configured to calculate the product between the first target probability of the pixel and the second target probability of the pixel for the same pixel in the image data, As the third target probability that the pixel belongs to skin data.
本申请实施例所提供的肤色检测装置可执行本申请任意实施例所提供的肤色检测方法,具备执行方法相应的功能模块和有益效果。The skin color detection apparatus provided by the embodiment of the present application can execute the skin color detection method provided by any embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
实施例三Embodiment 3
图7为本申请实施例三提供的一种移动终端的结构示意图。图7示出了适于用来实现本申请实施方式的示例性移动终端12的框图。图7显示的移动终端12仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。FIG. 7 is a schematic structural diagram of a mobile terminal according to Embodiment 3 of the present application. FIG. 7 shows a block diagram of an exemplary mobile terminal 12 suitable for use in implementing embodiments of the present application. The mobile terminal 12 shown in FIG. 7 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present application.
如图7所示,移动终端12以通用计算设备的形式表现。移动终端12的组件可以包括但不限于:一个或者多个处理器或者处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。As shown in FIG. 7, the mobile terminal 12 takes the form of a general-purpose computing device. Components of the mobile terminal 12 may include, but are not limited to, one or more processors or processing units 16 , a system memory 28 , and a bus 18 connecting various system components including the system memory 28 and the processing unit 16 .
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(ISA,Industry Standard Architecture)总线,微通道体系结构(MCA,Micro Channel Architecture)总线,增强型ISA总线、视频电子标准协会(VESA,Video Electronics Standards Association)局域总线以及外围组件互连(PCI,Peripheral Component Interconnect)总线。 Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include, but are not limited to, Industry Standard Architecture (ISA, Industry Standard Architecture) bus, Micro Channel Architecture (MCA, Micro Channel Architecture) bus, enhanced ISA bus, Video Electronics Standards Association (VESA, Video Electronics Standards Association) local bus and Peripheral Component Interconnect (PCI, Peripheral Component Interconnect) bus.
移动终端12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被移动终端12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。 Mobile terminal 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the mobile terminal 12, including volatile and non-volatile media, removable and non-removable media.
系统存储器(也可记为内存)28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(RAM,Random Access Memory)30和/或高速缓存存储器32。移动终端12可以包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(图7未显示,通常称为“硬盘驱动器”)。尽管图7中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如CD-ROM,DVD-ROM或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本申请各实施例的功能。System memory (also referred to as memory) 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and/or cache memory 32 . The mobile terminal 12 may include other removable/non-removable, volatile/non-volatile computer system storage media. For example only, storage system 34 may be used to read and write to non-removable, non-volatile magnetic media (not shown in FIG. 7, commonly referred to as a "hard drive"). Although not shown in Figure 7, a disk drive for reading and writing to removable non-volatile magnetic disks (eg "floppy disks") and removable non-volatile optical disks (eg CD-ROM, DVD-ROM) may be provided or other optical media) to read and write optical drives. In these cases, each drive may be connected to bus 18 through one or more data media interfaces. Memory 28 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of various embodiments of the present application.
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如存储器28中,这样的程序模块42包括但不限于操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本申请所描述的实施例中的功能和/或方法。A program/utility 40 having a set (at least one) of program modules 42, which may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data , each or some combination of these examples may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
移动终端12也可以与一个或多个外部设备14(例如键盘、指向设备、显示 器24等)通信,还可与一个或者多个使得用户能与该移动终端12交互的设备通信,和/或与使得该移动终端12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口22进行。并且,移动终端12还可以通过网络适配器20与一个或者多个网络(例如局域网(LAN,Local Area Network),广域网(WAN,Wide Area Network)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与移动终端12的其它模块通信。应当明白,尽管图7中未示出,可以结合移动终端12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID(Redundant Arrays of Independent Disks,磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。The mobile terminal 12 may also communicate with one or more external devices 14 (eg, a keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable a user to interact with the mobile terminal 12, and/or communicate with Any device (eg, network card, modem, etc.) that enables the mobile terminal 12 to communicate with one or more other computing devices. Such communication may take place through input/output (I/O) interface 22 . Moreover, the mobile terminal 12 can also communicate with one or more networks (such as a local area network (LAN, Local Area Network), a wide area network (WAN, Wide Area Network) and/or a public network, such as the Internet, through the network adapter 20. As shown, the network adapter 20 communicates with other modules of the mobile terminal 12 via the bus 18 . It should be understood that, although not shown in FIG. 7, other hardware and/or software modules may be used in conjunction with the mobile terminal 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays) of Independent Disks, disk array) systems, tape drives, and data backup storage systems.
处理单元16通过运行存储在系统存储器28中的程序,从而执行至少一种功能应用以及数据处理,例如实现本申请实施例所提供的肤色检测方法。The processing unit 16 executes at least one functional application and data processing by running a program stored in the system memory 28, for example, to implement the skin color detection method provided by the embodiments of the present application.
实施例四Embodiment 4
本申请实施例四还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述肤色检测方法的多个过程,且能达到相同的效果,为避免重复,这里不再赘述。The fourth embodiment of the present application also provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, multiple processes of the above-mentioned skin color detection method can be realized, and the same effect can be achieved , in order to avoid repetition, it will not be repeated here.
其中,计算机可读存储介质例如可以包括但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM,Read-Only Memory)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Wherein, the computer-readable storage medium may include, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination of the above. Examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM, Read-Only Memory) ), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
存储介质可以是非暂态(non-transitory)存储介质。The storage medium may be a non-transitory storage medium.
本申请实施例提出了一种肤色检测方法、装置、移动终端和存储介质,以解决如何在性能受限的情况下,兼顾肤色检测的实时性与精确度的问题。The embodiments of the present application propose a skin color detection method, device, mobile terminal, and storage medium, so as to solve the problem of how to take into account the real-time performance and accuracy of skin color detection under the condition of limited performance.
本领域技术人员会理解,本申请不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种变化、重新调整和替代而不会脱离本申请的保护范围。因此,虽然通过以上实施例对本申请进行了说明,但是本申请不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本申请的范围由所附的权利要求范围决定。Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and various changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present application. Therefore, although the present application has been described by the above embodiments, the present application is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present application is defined by The appended claims determine the scope.

Claims (17)

  1. 一种肤色检测方法,包括:A skin color detection method, comprising:
    在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据;Detecting face data in the image data, and dividing the head data matching the head contour with reference to the face data;
    将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率;Substituting the color value of the image data into the first mapping function to calculate the first target probability that the image data belongs to skin data;
    参考所述头部数据的亮度值生成第二映射函数,所述第二映射函数用于基于亮度值识别皮肤数据;generating a second mapping function with reference to the brightness value of the head data, the second mapping function being used to identify skin data based on the brightness value;
    将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率;Substituting the luminance value of the image data into the second mapping function to calculate the second target probability that the image data belongs to skin data;
    结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数据。Skin data is detected in the image data in combination with the first target probability and the second target probability.
  2. 根据权利要求1所述的方法,其中,所述在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据,包括:The method according to claim 1, wherein the detecting face data in the image data and dividing the head data matching the head contour with reference to the face data comprises:
    调用摄像头提供的人脸检测接口,以请求在所述摄像头采集的图像数据中检测人脸数据;calling the face detection interface provided by the camera to request to detect face data in the image data collected by the camera;
    接收所述人脸检测接口返回的至少一个人脸框,所述人脸框用于框定人脸数据。At least one face frame returned by the face detection interface is received, and the face frame is used to frame face data.
  3. 根据权利要求1所述的方法,其中,所述头部数据包括脸部数据、头发数据;所述在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据,包括:The method according to claim 1, wherein the head data includes face data and hair data; the detecting face data in the image data, and dividing the head matching the head contour with reference to the face data data, including:
    参考所述人脸数据划分与头部轮廓中的脸部轮廓匹配的脸部数据;dividing face data matching the face contour in the head contour with reference to the face data;
    参考所述人脸数据划分与头部轮廓中的头发轮廓匹配的头发数据,所述头发数据包围所述脸部数据。Hair data matching the hair contour in the head contour is divided with reference to the face data, the hair data surrounding the face data.
  4. 根据权利要求3所述的方法,其中,响应于所述人脸数据以人脸框框定,所述脸部数据符合如下条件:The method of claim 3, wherein, in response to the face data being framed by a face frame, the face data meets the following conditions:
    所述脸部数据的形状为椭圆形;The shape of the face data is an ellipse;
    所述脸部数据的焦点为所述人脸框中宽对应的框边的中点;The focus of the face data is the midpoint of the frame edge corresponding to the width of the face frame;
    所述脸部数据的短轴的长度与所述人脸框中的宽相等;The length of the short axis of the face data is equal to the width in the face frame;
    所述脸部数据的长轴的长度与目标边的长度的n倍相等,所述目标边为第一候选边、第二侯选边分别作为直角三角形的直角边时对应的斜边,所述第一侯选边为所述人脸框中宽取指定的第一比例,所述第二侯选边为所述人脸框中高取指定的第二比例。The length of the long axis of the face data is equal to n times the length of the target side. The first candidate edge is the width of the face frame with a specified first ratio, and the second candidate edge is the height of the face frame with a specified second ratio.
  5. 根据权利要求3所述的方法,其中,响应于所述人脸数据以人脸框框定,所述头发数据符合如下条件:The method of claim 3, wherein, in response to the face data being framed by a face frame, the hair data meets the following conditions:
    所述头发数据的形状为椭圆形;The shape of the hair data is an ellipse;
    所述头发数据的焦点为所述人脸框中宽对应的框边的中点;The focus of the hair data is the midpoint of the frame edge corresponding to the width of the face frame;
    所述头发数据的短轴的长度与所述人脸框中的宽的m倍相等,所述m与所述人脸数据的面积正相关;The length of the short axis of the hair data is equal to m times the width in the face frame, and the m is positively correlated with the area of the face data;
    所述头发数据的长轴的长度与目标边的长度的n×m倍相等,所述目标边为第一候选边、第二侯选边分别作为直角三角形的直角边时对应的斜边,所述第一侯选边为所述人脸框中宽取指定的第一比例,所述第二侯选边为所述人脸框中高取指定的第二比例。The length of the long axis of the hair data is equal to n×m times the length of the target side, and the target side is the hypotenuse when the first candidate side and the second candidate side are respectively used as right-angled sides of a right-angled triangle, so The first candidate edge is the width of the face frame with a specified first ratio, and the second candidate edge is the height of the face frame with a specified second ratio.
  6. 根据权利要求1所述的方法,其中,所述在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据,包括:The method according to claim 1, wherein the detecting face data in the image data and dividing the head data matching the head contour with reference to the face data comprises:
    响应于所述图像数据中存在多个人脸数据,分别统计多个所述人脸数据的面积;In response to the existence of a plurality of face data in the image data, count the areas of the plurality of face data respectively;
    参考所述面积最大的k个所述人脸数据划分与头部轮廓匹配的头部数据。The head data matching the head contour is divided with reference to the k face data with the largest area.
  7. 根据权利要求1所述的方法,其中,所述第一映射函数的横坐标为色彩值、纵坐标为当前数据属于皮肤数据的概率;The method according to claim 1, wherein the abscissa of the first mapping function is the color value, and the ordinate is the probability that the current data belongs to the skin data;
    所述第一映射函数包括依次连接的第一色彩映射段、第二色彩映射段、第三色彩映射段,所述第一色彩映射段中当前数据属于皮肤数据的概率从0上升至1,所述第二色彩映射段中当前数据属于皮肤数据的概率为1,所述第三色彩映射段中当前数据属于皮肤数据的概率从1下降至0。The first mapping function includes a first color mapping section, a second color mapping section, and a third color mapping section that are connected in sequence, and the probability that the current data in the first color mapping section belongs to skin data increases from 0 to 1, so The probability that the current data in the second color mapping segment belongs to skin data is 1, and the probability that the current data in the third color mapping segment belongs to skin data decreases from 1 to 0.
  8. 根据权利要求1-7中任一项所述的方法,其中,所述将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率,包括:The method according to any one of claims 1-7, wherein said substituting the color value of the image data into a first mapping function to calculate the first target probability that the image data belongs to skin data, comprising: :
    查询所述图像数据中像素点的色彩值;query the color value of the pixel in the image data;
    将所述色彩值代入所述第一映射函数中,以映射为所述像素点在所述色彩值下属于皮肤数据的候选概率;Substituting the color value into the first mapping function to map the pixel as a candidate probability that the pixel belongs to skin data under the color value;
    基于所述候选概率计算所述像素点属于皮肤数据的第一目标概率。A first target probability that the pixel point belongs to skin data is calculated based on the candidate probability.
  9. 根据权利要求8所述的方法,其中,所述将所述色彩值代入所述第一映射函数中,以映射为所述像素点在所述色彩值下属于皮肤数据的候选概率,包括:The method according to claim 8, wherein, substituting the color value into the first mapping function to map the pixel point to a candidate probability of skin data under the color value, comprising:
    将蓝色色度分量的色彩值代入所述蓝色色度分量对应的所述第一映射函数 中,以映射为所述像素点在所述蓝色色度分量下属于皮肤数据的蓝色概率,作为候选概率;Substitute the color value of the blue chrominance component into the first mapping function corresponding to the blue chrominance component, so as to map the blue probability that the pixel belongs to the skin data under the blue chrominance component, as a candidate probability;
    将红色色度分量的色彩值代入所述红色色度分量对应的所述第一映射函数中,以映射为所述像素点在所述红色色度分量下属于皮肤数据的红色概率,作为候选概率;Substitute the color value of the red chrominance component into the first mapping function corresponding to the red chrominance component, so as to map to the red probability that the pixel belongs to the skin data under the red chrominance component, as a candidate probability ;
    所述基于所述候选概率计算所述像素点属于皮肤数据的第一目标概率,包括:The calculating, based on the candidate probability, the first target probability that the pixel belongs to the skin data, including:
    计算所述蓝色概率与所述红色概率之间的乘积,作为所述像素点属于皮肤数据的第一目标概率。The product between the blue probability and the red probability is calculated as the first target probability that the pixel point belongs to the skin data.
  10. 根据权利要求1所述的方法,其中,所述第二映射函数的横坐标为亮度值、纵坐标为当前数据属于皮肤数据的概率;The method according to claim 1, wherein the abscissa of the second mapping function is the brightness value, and the ordinate is the probability that the current data belongs to the skin data;
    所述第二映射函数包括依次连接的第一亮度映射段、第二亮度映射段,所述第一亮度映射段中当前数据属于皮肤数据的概率从0上升至1,所述第二亮度映射段中当前数据属于皮肤数据的概率为1。The second mapping function includes a first luminance mapping segment and a second luminance mapping segment connected in sequence, the probability that the current data in the first luminance mapping segment belongs to skin data increases from 0 to 1, and the second luminance mapping segment The probability that the current data belongs to skin data is 1.
  11. 根据权利要求10所述的方法,其中,所述头部数据包括与头部轮廓中的脸部轮廓匹配的脸部数据、与头部轮廓中的头发轮廓匹配的头发数据,11. The method of claim 10, wherein the head data includes face data matched to a face contour in the head contour, hair data matched to a hair contour in the head contour,
    所述参考所述头部数据的亮度值生成第二映射函数,包括:The generating a second mapping function with reference to the luminance value of the header data includes:
    统计所述头发数据的亮度值,作为第一参考亮度值,所述第一参考亮度值对应当前数据属于皮肤数据的概率为0;Counting the brightness value of the hair data as a first reference brightness value, the probability that the first reference brightness value corresponds to the current data belonging to skin data is 0;
    统计所述脸部数据与所述头发数据的亮度值,作为第二参考亮度值,所述第二参考亮度值对应当前数据属于皮肤数据的概率为1;Counting the brightness values of the face data and the hair data as a second reference brightness value, the probability that the second reference brightness value corresponds to the current data belonging to skin data is 1;
    在所述第一亮度映射段中,以所述第一参考亮度值作为起点、所述第二参考亮度值作为终点拟合曲线;In the first luminance mapping segment, a curve is fitted with the first reference luminance value as a starting point and the second reference luminance value as an end point;
    在所述第二亮度映射段中,以所述第二参考亮度值作为起点拟合直线。In the second luminance mapping section, a straight line is fitted with the second reference luminance value as a starting point.
  12. 根据权利要求11所述的方法,其中,所述参考所述头部数据的亮度值生成第二映射函数,还包括:The method according to claim 11, wherein the generating the second mapping function with reference to the luminance value of the header data, further comprises:
    将所述人脸数据替代所述脸部数据。The face data is replaced with the face data.
  13. 根据权利要求1-7、9-12中任一项所述的方法,其中,所述将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率,包括:The method according to any one of claims 1-7 and 9-12, wherein the luminance value of the image data is substituted into the second mapping function to calculate whether the image data belongs to the skin data The second target probability, including:
    查询所述图像数据中像素点的亮度值;query the brightness value of the pixel point in the image data;
    将所述亮度值代入所述第二映射函数中,以映射为所述像素点属于皮肤数 据的第二目标概率。The luminance value is substituted into the second mapping function to map to the second target probability that the pixel belongs to skin data.
  14. 根据权利要求1-7、9-12中任一项所述的方法,其中,所述结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数据,包括:The method according to any one of claims 1-7 and 9-12, wherein the detecting skin data in the image data by combining the first target probability and the second target probability comprises:
    针对所述图像数据中的同一个像素点,计算所述像素点的所述第一目标概率与所述像素点的所述第二目标概率之间的乘积,作为所述像素点属于皮肤数据的第三目标概率。For the same pixel in the image data, the product between the first target probability of the pixel and the second target probability of the pixel is calculated, as the pixel belonging to the skin data. The third target probability.
  15. 一种肤色检测装置,包括:A skin color detection device, comprising:
    图像数据检测模块,设置为在图像数据中检测人脸数据、参考所述人脸数据划分与头部轮廓匹配的头部数据;an image data detection module, configured to detect face data in the image data, and to divide head data matching the head contour with reference to the face data;
    第一目标概率计算模块,设置为将所述图像数据的色彩值代入第一映射函数中,以计算所述图像数据属于皮肤数据的第一目标概率;a first target probability calculation module, configured to substitute the color value of the image data into a first mapping function to calculate the first target probability that the image data belongs to skin data;
    映射函数生成模块,设置为参考所述头部数据的亮度值生成第二映射函数,所述第二映射函数用于基于亮度值识别皮肤数据;a mapping function generation module, configured to generate a second mapping function with reference to the brightness value of the head data, where the second mapping function is used to identify skin data based on the brightness value;
    第二目标概率计算模块,设置为将所述图像数据的亮度值代入所述第二映射函数中,以计算所述图像数据属于皮肤数据的第二目标概率;A second target probability calculation module, configured to substitute the brightness value of the image data into the second mapping function to calculate the second target probability that the image data belongs to skin data;
    皮肤检测模块,设置为结合所述第一目标概率与所述第二目标概率在所述图像数据中检测皮肤数据。A skin detection module configured to detect skin data in the image data in combination with the first target probability and the second target probability.
  16. 一种移动终端,所述移动终端包括:A mobile terminal, the mobile terminal comprising:
    至少一个处理器;at least one processor;
    存储器,设置为存储至少一个程序,memory, arranged to store at least one program,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-14中任一项所述的肤色检测方法。When the at least one program is executed by the at least one processor, the at least one processor implements the skin color detection method according to any one of claims 1-14.
  17. 一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1-14中任一项所述的肤色检测方法。A computer-readable storage medium, storing a computer program on the computer-readable storage medium, and when the computer program is executed by a processor, implements the skin color detection method according to any one of claims 1-14.
PCT/CN2021/141287 2020-12-25 2021-12-24 Skin color detection method and device, mobile terminal, and storage medium WO2022135579A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011566266.4A CN112686965A (en) 2020-12-25 2020-12-25 Skin color detection method, device, mobile terminal and storage medium
CN202011566266.4 2020-12-25

Publications (1)

Publication Number Publication Date
WO2022135579A1 true WO2022135579A1 (en) 2022-06-30

Family

ID=75451866

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/141287 WO2022135579A1 (en) 2020-12-25 2021-12-24 Skin color detection method and device, mobile terminal, and storage medium

Country Status (2)

Country Link
CN (1) CN112686965A (en)
WO (1) WO2022135579A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112686965A (en) * 2020-12-25 2021-04-20 百果园技术(新加坡)有限公司 Skin color detection method, device, mobile terminal and storage medium
CN114710627B (en) * 2022-04-06 2024-03-29 Oppo广东移动通信有限公司 Skin detection method, mobile terminal, computer device and medium
CN114708543B (en) * 2022-06-06 2022-08-30 成都信息工程大学 Examination student positioning method in examination room monitoring video image

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140079319A1 (en) * 2012-09-20 2014-03-20 Htc Corporation Methods for enhancing images and apparatuses using the same
CN107564073A (en) * 2017-09-14 2018-01-09 广州市百果园信息技术有限公司 Skin color model method and device, storage medium
CN107633252A (en) * 2017-09-19 2018-01-26 广州市百果园信息技术有限公司 Skin color detection method, device and storage medium
CN112597911A (en) * 2020-12-25 2021-04-02 百果园技术(新加坡)有限公司 Buffing processing method and device, mobile terminal and storage medium
CN112686965A (en) * 2020-12-25 2021-04-20 百果园技术(新加坡)有限公司 Skin color detection method, device, mobile terminal and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140079319A1 (en) * 2012-09-20 2014-03-20 Htc Corporation Methods for enhancing images and apparatuses using the same
CN107564073A (en) * 2017-09-14 2018-01-09 广州市百果园信息技术有限公司 Skin color model method and device, storage medium
CN107633252A (en) * 2017-09-19 2018-01-26 广州市百果园信息技术有限公司 Skin color detection method, device and storage medium
CN112597911A (en) * 2020-12-25 2021-04-02 百果园技术(新加坡)有限公司 Buffing processing method and device, mobile terminal and storage medium
CN112686965A (en) * 2020-12-25 2021-04-20 百果园技术(新加坡)有限公司 Skin color detection method, device, mobile terminal and storage medium

Also Published As

Publication number Publication date
CN112686965A (en) 2021-04-20

Similar Documents

Publication Publication Date Title
WO2022135579A1 (en) Skin color detection method and device, mobile terminal, and storage medium
JP7110502B2 (en) Image Background Subtraction Using Depth
US11043011B2 (en) Image processing method, apparatus, terminal, and storage medium for fusing images of two objects
CN109359575B (en) Face detection method, service processing method, device, terminal and medium
WO2022135574A1 (en) Skin color detection method and apparatus, and mobile terminal and storage medium
WO2017190646A1 (en) Facial image processing method and apparatus and storage medium
WO2022156640A1 (en) Gaze correction method and apparatus for image, electronic device, computer-readable storage medium, and computer program product
US8983152B2 (en) Image masks for face-related selection and processing in images
WO2020125631A1 (en) Video compression method and apparatus, and computer-readable storage medium
WO2016165060A1 (en) Skin detection based on online discriminative modeling
US11695812B2 (en) Sharing physical writing surfaces in videoconferencing
WO2022012085A1 (en) Face image processing method and apparatus, storage medium, and electronic device
CN109033935B (en) Head-up line detection method and device
CN112102154B (en) Image processing method, device, electronic equipment and storage medium
WO2019223068A1 (en) Iris image local enhancement method, device, equipment and storage medium
JP6157165B2 (en) Gaze detection device and imaging device
WO2021127916A1 (en) Facial emotion recognition method, smart device and computer-readabel storage medium
US11074676B2 (en) Correction of misaligned eyes in images
CN112597911A (en) Buffing processing method and device, mobile terminal and storage medium
WO2022111269A1 (en) Method and device for enhancing video details, mobile terminal, and storage medium
US20200250457A1 (en) Systems and methods for modifying labeled content
WO2024051289A1 (en) Image background replacement method and related device
CN113837020B (en) Cosmetic progress detection method, device, equipment and storage medium
WO2024055676A1 (en) Image compression method and apparatus, computer device, and computer readable storage medium
WO2021102928A1 (en) Image processing method and apparatus

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: 21909574

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21909574

Country of ref document: EP

Kind code of ref document: A1