技术领域technical field
本发明涉及图像处理技术领域,尤其涉及一种防闭眼的人像拍摄处理的方法和装置。The present invention relates to the technical field of image processing, in particular to a method and device for preventing eye-closing portrait shooting and processing.
背景技术Background technique
随着移动终端,如手机的拍照技术的不断发展,越来越多的用户使用手机玩自拍或者群拍,各种美颜拍照功能也随之出现。美颜拍照功能通过对待确认的拍摄图像进行人脸识别,然后对脸部进行美白、收敛、磨皮等后处理操作,实现让确认拍出的图像显得脸部皮肤更光滑、白亮的视觉效果。美颜拍照功能现在几乎成为了女性用户拍照的必选功能。然而,当多人一起群拍时,特别是外出游玩留念时,很容易就拍出某一个人眼睛处于闭眼状态的照片,这种照片的质量不仅大大折扣,还会或多或少影响到人们的游玩心情。With the continuous development of mobile terminals, such as mobile phone camera technologies, more and more users use mobile phones to take selfies or group photos, and various beautifying camera functions also appear thereupon. The beauty camera function performs face recognition on the captured image to be confirmed, and then performs post-processing operations such as whitening, astringent, and skin smoothing on the face, so as to achieve the visual effect of making the confirmed image appear smoother and whiter. The beauty camera function has almost become a must-have function for female users to take pictures. However, when many people take pictures together, especially when going out for fun, it is easy to take a picture of a certain person with their eyes closed. The quality of this kind of picture is not only greatly reduced, but also affects the People's play mood.
发明内容Contents of the invention
本发明的目的在于提出一种防闭眼的人像拍摄处理的方法和装置,能够有效避免拍出人像的眼睛处于闭眼状态的照片,大大提高照片本身的质量,优化用户体验。The purpose of the present invention is to propose a method and device for preventing eye-closing portrait shooting, which can effectively avoid taking photos of portraits with eyes closed, greatly improve the quality of the photos themselves, and optimize user experience.
为达此目的,本发明采用以下技术方案:For reaching this purpose, the present invention adopts following technical scheme:
第一方面,提供一种防闭眼的人像拍摄处理的方法,包括:In the first aspect, a method for preventing closed-eye portrait shooting is provided, including:
获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像;Obtain a confirmation shooting instruction, and obtain an image to be confirmed through a viewfinder interface for shooting a portrait, and the image to be confirmed includes a plurality of continuously acquired images without digital image compression processing;
获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态;Obtain the first image in the image to be confirmed, and use a face detection algorithm to detect the state of the eyes of all portraits in the first image;
若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像;If the eyes of at least one portrait are closed, then save the first image, and call subsequent images after the first image;
检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。Detect whether the eyes of the portrait corresponding to the first image in the closed-eye state in the subsequent images are open; Partial processing is performed on the eyes in the closed-eye state, so that the eyes of all portraits in the first image are in the open-eye state.
第二方面,提供一种防闭眼的人像拍摄处理的装置,包括:In the second aspect, an eye-closed-proof portrait shooting processing device is provided, including:
拍摄单元,用于获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像;The shooting unit is used to obtain a confirmation shooting instruction, and obtain images to be confirmed through the viewfinder interface for shooting portraits, and the images to be confirmed include several continuously acquired images that have not undergone digital image compression processing;
检测单元,用于获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态;A detection unit, configured to acquire the first image in the images to be confirmed, and use a face detection algorithm to detect the state of the eyes of all portraits in the first image;
调取单元,用于若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像;The calling unit is used to save the first image and call subsequent images after the first image if at least one portrait has eyes closed;
处理单元,用于检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。A processing unit, configured to detect whether the eyes of the person in the eye-closed state corresponding to the first image in the subsequent images are open; if they are open, use the subsequent image corresponding to the eye-open state to perform One image is partially processed corresponding to the eyes in the closed-eye state, so that the eyes of all portraits in the first image are in the open-eye state.
本发明的有益效果在于:一种防闭眼的人像拍摄处理的方法和装置,包括拍摄单元、检测单元、调取单元和处理单元;所述拍摄单元,用于获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像;所述检测单元,用于获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态;所述调取单元,用于若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像;所述处理单元,用于检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。可见,该防闭眼的人像拍摄处理的方法和装置,能够有效避免拍出人像的眼睛处于闭眼状态的照片,大大提高照片本身的质量,优化用户体验。The beneficial effects of the present invention are: a method and device for preventing eye-closing portrait shooting, including a shooting unit, a detection unit, a calling unit, and a processing unit; The viewfinder interface obtains an image to be confirmed, and the image to be confirmed includes several continuously acquired images without digital image compression processing; the detection unit is used to acquire the first image in the image to be confirmed, using human The face detection algorithm detects the state of the eyes of all the portraits in the first image; the calling unit is used to save the first image and call if at least one of the portraits has eyes closed Subsequent images after the first image; the processing unit is used to detect whether the eyes of the portrait corresponding to the first image in the closed-eye state in the subsequent images are open; if open, use The subsequent image corresponding to the eye-open state performs local processing on the eyes corresponding to the eye-closed state of the first image, so that the eyes of all portraits in the first image are in the eye-open state. It can be seen that the method and device for preventing eye-closing portrait shooting and processing can effectively avoid taking photos of portraits with eyes closed, greatly improve the quality of the photos themselves, and optimize user experience.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对本发明实施例描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据本发明实施例的内容和这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention , for those skilled in the art, other drawings can also be obtained according to the content of the embodiment of the present invention and these drawings without any creative effort.
图1是本发明提供的防闭眼的人像拍摄处理的方法第一个实施例的方法流程图。FIG. 1 is a method flow chart of the first embodiment of the method for processing portraits with closed-eye prevention provided by the present invention.
图2是本发明提供的防闭眼的人像拍摄处理的方法第二个实施例的方法流程图。Fig. 2 is a method flow chart of the second embodiment of the method for processing a portrait shot with eyes-closed prevention provided by the present invention.
图3是本发明提供的防闭眼的人像拍摄处理的装置第一个实施例的结构方框图。Fig. 3 is a structural block diagram of the first embodiment of the device for image shooting processing with eyes-closed prevention provided by the present invention.
图4是本发明提供的防闭眼的人像拍摄处理的装置第二个实施例的结构方框图。Fig. 4 is a structural block diagram of the second embodiment of the device for image shooting processing with eyes-closed prevention provided by the present invention.
具体实施方式Detailed ways
为使本发明解决的技术问题、采用的技术方案和达到的技术效果更加清楚,下面将结合附图对本发明实施例的技术方案作进一步的详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only the technical solutions of the present invention. Some, but not all, embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of the present invention.
请参考图1,其是本发明提供的防闭眼的人像拍摄处理的方法第一个实施例的方法流程图。本发明实施例的防闭眼的人像拍摄处理的方法,可应用于各种具备拍照功能的智能终端,如手机、平板、智能手表等。Please refer to FIG. 1 , which is a flow chart of the first embodiment of the method for processing a portrait shot with eyes closed prevention provided by the present invention. The method for processing portraits with eyes-closed prevention in the embodiments of the present invention can be applied to various smart terminals with a camera function, such as mobile phones, tablets, smart watches, and the like.
该防闭眼的人像拍摄处理的方法,包括:The method for preventing closed-eyed portrait shooting includes:
步骤S101、获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像。Step S101 , obtain a confirmation shooting instruction, and obtain an image to be confirmed through the viewfinder interface of shooting a portrait, and the image to be confirmed includes several images acquired continuously without digital image compression processing.
所述拍摄人像的取景界面即为具备拍照功能的智能终端的视窗或显示屏幕。The viewfinder interface for taking portraits is the window or display screen of the smart terminal with the camera function.
图像经过数字图像压缩处理后,可以使图像信号进行高质量地传输,并便于图像的检索、分析、处理和存储。After the image is processed by digital image compression, the image signal can be transmitted with high quality, and it is convenient for image retrieval, analysis, processing and storage.
步骤S102、获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态。Step S102. Acquire the first image among the images to be confirmed, and use a face detection algorithm to detect the states of the eyes of all portraits in the first image.
当获得确认拍摄指令,即表示用户对目前取景界面的待确认图像基本满意,通过按下确认拍摄键,对待确认图像进行处理输出,形成最终人像图片。When the confirmation shooting instruction is obtained, it means that the user is basically satisfied with the image to be confirmed in the current viewfinder interface. By pressing the confirmation shooting button, the image to be confirmed is processed and output to form a final portrait picture.
利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态的过程,主要分为人脸部分检测、基于所述人脸部分检测的眼部区域检测和眼睛状态检测三个部分。The process of using the face detection algorithm to detect the state of the eyes of all portraits in the first image is mainly divided into three parts: face part detection, eye region detection based on the face part detection, and eye state detection.
人脸部分检测主要依据人脸上的特征点的检测,对人脸图像进行特征点检测之前,还需要进行特征点提取和分类。检测人脸过程中,首先将待确定的人脸图像和人脸模板进行模板匹配,如果匹配,那么将其投影到人脸子空间,由特征子脸技术判断是否为人脸。特征子脸技术从统计的角度,寻找人脸图像分布的基本元素,即人脸图像样本集协方差矩阵的特征向量,以此近似地表征人脸图像。这些特征向量称为特征脸(Eigenface)。实际上,特征脸反映了隐含在人脸样本集合内部的信息和人脸的结构关系。将眼睛、面颊、下颌的样本集协方差矩阵的特征向量称为特征眼、特征颌和特征唇,统称特征子脸。特征子脸在相应的图像空间中张成子空间,称为子脸空间。计算出测试图像窗口在子脸空间的投影距离,若窗口图像满足阈值比较条件,则判断其为人脸。该人脸对应的区域为人脸部分。Face part detection is mainly based on the detection of feature points on the face. Before performing feature point detection on the face image, feature point extraction and classification are also required. In the process of face detection, the face image to be determined is firstly matched with the face template, and if it matches, it is projected into the face subspace, and whether it is a face is judged by the feature sub-face technology. From a statistical point of view, the eigensubface technology looks for the basic elements of the face image distribution, that is, the eigenvectors of the covariance matrix of the face image sample set, so as to approximately represent the face image. These feature vectors are called Eigenfaces. In fact, the eigenface reflects the information hidden in the face sample set and the structural relationship of the face. The feature vectors of the covariance matrix of the sample set of eyes, cheeks, and jaws are called feature eyes, feature jaws, and feature lips, collectively called feature sub-faces. The feature subfaces are stretched into subspaces in the corresponding image space, called subface spaces. Calculate the projection distance of the test image window in the sub-face space, and if the window image satisfies the threshold comparison condition, it is judged to be a human face. The area corresponding to the face is a face part.
眼部区域检测主要依据上述人脸部分检测的结果,根据确定的所述人脸部分的图像,利用三庭五眼的比例估计鼻子的初始位置。定义两个初始搜索矩形,分别向左、右两眼所处的大致位置生长。根据人眼灰度明显低于人脸灰度的特点,利用搜索矩形找到眼部的边缘,并定位眼球内瞳孔的中心,最终确定人脸部分的眼部区域。The detection of the eye area is mainly based on the result of the detection of the above-mentioned face part, and according to the determined image of the face part, the initial position of the nose is estimated by using the ratio of three eyes and five eyes. Define two initial search rectangles that grow towards the approximate location of the left and right eyes. According to the characteristic that the gray scale of the human eye is obviously lower than that of the face, use the search rectangle to find the edge of the eye, and locate the center of the pupil in the eyeball, and finally determine the eye area of the face.
眼睛状态检测主要依据眼部特征值,如瞳孔中部高度、瞳距或瞳孔灰度值等的检测结果,对眼睛处于睁眼状态还是闭眼状态进行判断。Eye state detection is mainly based on eye feature values, such as the detection results of the middle pupil height, pupillary distance or pupil gray value, etc., to judge whether the eyes are in the open or closed state.
步骤S103、若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像。Step S103 , if at least one portrait has eyes closed, save the first image, and call subsequent images after the first image.
若发现至少有一个人像的眼睛处于闭眼状态,说明此时的待确认图像质量较低,达不到用户的要求,需要对待确认图像进行防闭眼的人像拍摄处理。If it is found that the eyes of at least one portrait are closed, it means that the quality of the image to be confirmed at this time is low and cannot meet the user's requirements, and the image to be confirmed needs to be processed for portrait shooting with eyes closed.
步骤S104、检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。Step S104: Detect whether the eyes of the person in the closed-eye state corresponding to the first image in the subsequent images are open; Partial processing is performed on the image corresponding to the eyes in the closed-eye state, so that the eyes of all portraits in the first image are in the open-eye state.
优选地,眼部局部处理为采用眼部处于睁眼状态的后续图像中的眼部替换掉所述第一张图像中对应人像处于闭眼状态的眼部,在人脸特征基本吻合的前提下,把睁眼状态的眼部直接覆盖于闭眼状态的眼部。Preferably, the local processing of the eyes is to replace the eyes in the first image with the eyes in the closed-eye state of the corresponding person in the subsequent image with the eyes in the open-eye state, on the premise that the facial features basically match , directly cover the eyes with eyes open on the eyes with eyes closed.
本发明实施例提供的动防闭眼的人像拍摄处理的方法,能够有效避免拍出人像的眼睛处于闭眼状态的照片,大大提高照片本身的质量,优化用户体验。The method for shooting portraits with eyes closed and motion prevention provided by the embodiments of the present invention can effectively avoid taking photos of portraits with eyes closed, greatly improve the quality of the photos themselves, and optimize user experience.
请参考图2,其是本发明提供的防闭眼的人像拍摄处理的方法第二个实施例的方法流程图。本发明实施例在防闭眼的人像拍摄处理的方法的第一个实施例的基础上,对眼部做局部处理和判断人像眼部的状态的步骤进行了具体说明。Please refer to FIG. 2 , which is a flow chart of the second embodiment of the method for processing portraits with closed-eye prevention provided by the present invention. In the embodiment of the present invention, on the basis of the first embodiment of the method for preventing eyes from being closed, the steps of performing local processing on the eyes and judging the state of the eyes of the portrait are described in detail.
该防闭眼的人像拍摄处理的方法,包括:The method for preventing closed-eyed portrait shooting includes:
步骤S201、启动拍照功能。Step S201, start the camera function.
启动拍照功能,即让终端进入拍照状态,拍摄人像的取景界面开始取景。Start the camera function, that is, let the terminal enter the camera state, and the viewfinder interface for shooting portraits starts to take pictures.
步骤S202、获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像。Step S202 , obtain a confirmation shooting instruction, and obtain an image to be confirmed through the viewfinder interface of shooting a portrait, and the image to be confirmed includes several continuously acquired images without digital image compression processing.
步骤S203、获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态。Step S203 , acquiring the first image among the images to be confirmed, and using a face detection algorithm to detect the states of the eyes of all portraits in the first image.
优选地,所述利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态,包括:Preferably, the detection of the state of the eyes of all portraits in the first image using a face detection algorithm includes:
利用人脸检测算法检测所述第一张图像中所有人像的眼部特征值,所述眼部特征值包括的瞳孔中部高度、瞳距或瞳孔灰度值;Utilize the human face detection algorithm to detect the eye feature values of all the portraits in the first image, the pupil middle height, pupil distance or pupil gray value included in the eye feature values;
当任一人像的瞳孔中部高度小于等于预设高度,则判断该人像的眼睛处于闭眼状态;当任一人像的瞳孔中部高度大于所述预设高度,则判断该人像的眼睛处于睁眼状态,或;When the middle height of the pupils of any portrait is less than or equal to the preset height, it is judged that the eyes of the portrait are in the closed state; when the middle height of the pupils of any portrait is greater than the preset height, it is judged that the eyes of the portrait are in the open state ,or;
当没有检测到任一人像的瞳距,则判断该人像的眼睛处于闭眼状态;当检测到任一人像的瞳距,则判断该人像的眼睛处于睁眼状态,或;When the interpupillary distance of any portrait is not detected, it is judged that the eyes of the portrait are in a closed state; when the interpupillary distance of any portrait is detected, it is judged that the eyes of the portrait are in an open state, or;
当任一人像的瞳孔灰度值小于等于预设瞳孔灰度值,则判断该人像的眼睛处于闭眼状态;当任一人像的瞳孔灰度值大于所述预设瞳孔灰度值,则判断该人像的眼睛处于睁眼状态。When the pupil gray value of any portrait is less than or equal to the preset pupil gray value, it is judged that the eyes of the portrait are closed; when the pupil gray value of any portrait is greater than the preset pupil gray value, it is judged The portrait's eyes are open.
眼珠是指眼球前面中间部分,这个部位是由角膜、虹膜和瞳孔组成的。瞳孔中部高度为圆形瞳孔的中心线高度、瞳距为两个瞳孔之间的距离、瞳孔灰度值为瞳孔的颜色深度。The eyeball refers to the middle part in front of the eyeball, which is composed of the cornea, iris and pupil. The middle pupil height is the height of the center line of the circular pupil, the pupil distance is the distance between the two pupils, and the pupil gray value is the color depth of the pupil.
预设高度为预先设置的、对应于图像中的人脸大小的眼睛处于正常睁眼状态时的瞳孔中部高度,预设瞳孔灰度值为预先设置的、对应于图像中的人脸大小的眼睛处于正常睁眼状态时的瞳孔灰度值。实际应用过程中,可以根据不同终端的型号和配置,对预设高度和预设瞳孔灰度值进行设置。The preset height is the middle height of the pupil when the eyes corresponding to the size of the face in the image are in the normal open state, and the gray value of the pupil is preset and corresponds to the size of the face in the image. The gray value of the pupil when the eyes are normally open. In the actual application process, the preset height and the preset pupil gray value can be set according to the models and configurations of different terminals.
步骤S204a、若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像。Step S204a, if the eyes of at least one portrait are closed, save the first image, and call subsequent images after the first image.
步骤S204b、若没有人像的眼睛处于闭眼状态,则对所述第一张图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕。Step S204b, if there is no portrait with eyes closed, perform digital image compression processing on the first image, and display the final portrait picture after the digital image compression processing on the screen.
若没有人像的眼睛处于闭眼状态,则可以直接对待拍摄的图像进行述数字图像压缩处理,以便输出。If there is no portrait whose eyes are closed, the image to be shot can be directly subjected to the above-mentioned digital image compression processing for output.
需要说明的是,步骤S204a和步骤S204b并没有先后顺序关系,两者择一实施。It should be noted that there is no sequence relationship between step S204a and step S204b, and one of them is implemented.
步骤S205、在预设时间周期内,检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开。Step S205 , within a preset time period, detect whether the eyes of the portrait in the subsequent image corresponding to the eye-closed state in the first image are open.
优选地,所述预设时间周期为2s。在2s内,人像的眼部依然没有睁开、持续处于闭眼状态的话,则可以判断这是为了营造更生动的拍摄效果的故意为之。此时可以直接对待拍摄的图像进行述数字图像压缩处理,以便输出。Preferably, the preset time period is 2s. Within 2 seconds, if the eyes of the portrait are still closed and remain closed, it can be judged that this is intentional to create a more vivid shooting effect. At this time, the digital image compression process can be directly performed on the image to be captured for output.
步骤S206a、若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态;对做所述局部处理后获得的所有人像的眼睛处于睁眼状态的图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕。Step S206a, if it is open, use the subsequent image corresponding to the eye-open state to partially process the eyes corresponding to the eyes in the closed-eye state in the first image, so that the eyes of all portraits in the first image In an eye-open state; digital image compression processing is performed on the images of all portraits obtained after the partial processing with the eyes in the eye-open state, and the final portrait picture after the digital image compression processing is displayed on the screen.
步骤S206b、若没有睁开,则对所述第一张图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕。Step S206b, if it is not opened, perform digital image compression processing on the first image, and display the final portrait image after the digital image compression processing on the screen.
步骤S206a和步骤S206b让终端的防闭眼的人像拍摄处理的过程更加智能化和人性化,提高了用户的满意度。需要说明的是,步骤S206a和步骤S206b并没有先后顺序关系,两者择一实施。Steps S206a and S206b make the process of the terminal's anti-closing-eye portrait shooting process more intelligent and humanized, which improves user satisfaction. It should be noted that there is no sequence relationship between step S206a and step S206b, and one of them is implemented.
优选地,所述数字图像压缩处理为采用JPEG编码算法的数字图像压缩处理。Preferably, the digital image compression process is a digital image compression process using a JPEG encoding algorithm.
JPEG编码算法为静态图像压缩的标准算法。JPEG编码算法必须满足以下要求:The JPEG encoding algorithm is a standard algorithm for still image compression. The JPEG encoding algorithm must meet the following requirements:
1、JPEG编码算法独立于图像的分辨率。1. The JPEG encoding algorithm is independent of the resolution of the image.
2、具有低于1bit/象素的编码率,并且能够在五秒钟内建立图像,以满足实时要求。2. It has a coding rate lower than 1 bit/pixel, and can create images within five seconds to meet real-time requirements.
3、在压缩比大约是2的情况下能够无失真地恢复原图像。3. When the compression ratio is about 2, the original image can be restored without distortion.
4、支持顺序编解码和渐进编解码。4. Support sequential codec and progressive codec.
5、对各种图像成分及数据精度的自适应能力。5. Adaptability to various image components and data precision.
6、编解码设备简单易实现。6. Codec equipment is simple and easy to implement.
本发明实施例提供的防闭眼的人像拍摄处理的方法,首先通过人脸检测算法,实时检测拍摄人像的取景界面中所有人脸的位置及对应的眼睛状态。当确认拍摄键被按下、发出确认拍摄指令后,在待确认图像做JPEG编码之前,取第一张图像,并判断该第一张图像中人像眼睛的状态,如果有人眼睛处于闭眼状态,则先将第一张图像保存下来,并不去做JPEG编码。后面每张图像持续关注闭眼人的眼睛状态。等到闭眼人的眼睛处于睁眼状态时,根据该人的眼睛与脸部的特征,对第一张图像的闭眼人,进行相应的眼部局部处理,使其眼睛处于睁眼状态。如果闭眼人持续处于闭眼状态超过2s,则不进行眼部局部处理,默认是特意想拍出闭眼的效果,而不是因为眨眼导致的拍出闭眼的照片。最后将经过眼部处理的第一张图像进行JPEG编码,输出最终的人像图片。The method for processing portraits with closed-eye prevention provided by the embodiments of the present invention first uses a face detection algorithm to detect in real time the positions of all faces and the corresponding eye states in the viewfinder interface for shooting portraits. When the confirmation shooting button is pressed and the confirmation shooting instruction is issued, before the image to be confirmed is JPEG encoded, take the first image and judge the state of the portrait’s eyes in the first image. If someone’s eyes are closed, Then save the first image first, and do not do JPEG encoding. Each subsequent image continues to focus on the eye state of the person with closed eyes. When the eyes of the closed-eyed person are in the open-eye state, according to the characteristics of the eyes and face of the person, the corresponding partial eye treatment is performed on the closed-eyed person in the first image, so that the eyes are in the open-eye state. If the eye-closed person stays closed for more than 2 seconds, no partial eye treatment will be performed, and the default is to deliberately take pictures with closed eyes, rather than taking pictures with closed eyes caused by blinking. Finally, JPEG encoding is performed on the first image processed by the eyes, and the final portrait image is output.
本发明实施例提供的防闭眼的人像拍摄处理的方法,通过人脸检测算法可以获取到人眼的状态,然后对闭眼的人像进行眼部局部处理,将人像的睁眼状态合成到第一张图像上,使闭眼人像处于睁眼状态,以便拍出更高质量的人像照片,有效避免拍出闭眼人像的照片。The method for image shooting and processing of eyes-closed prevention provided by the embodiment of the present invention can obtain the state of human eyes through the face detection algorithm, and then perform partial eye processing on the eyes-closed portrait, and synthesize the eye-opening state of the portrait into the first On one image, the closed-eyed person is in the open-eyed state, so as to take higher-quality portrait photos, and effectively avoid taking photos of closed-eyed people.
以下为本发明实施例提供的防闭眼的人像拍摄处理的装置的实施例。防闭眼的人像拍摄处理的装置的实施例与上述的防闭眼的人像拍摄处理的方法的实施例属于同一构思,防闭眼的人像拍摄处理的装置的实施例中未详尽描述的细节内容,可以参考上述防闭眼的人像拍摄处理的方法的实施例。The following is an embodiment of an apparatus for processing portraits with eyes closed to prevent eyes closing provided by an embodiment of the present invention. The embodiment of the device for preventing eye-closing portrait shooting processing and the embodiment of the above-mentioned method for preventing eye-closing portrait shooting processing belong to the same concept, and the details of the device for preventing eye-closing portrait shooting processing are not described in detail in the embodiment , reference may be made to the above-mentioned embodiment of the method for processing a portrait with eyes closed.
请参考图3,其是本发明提供的防闭眼的人像拍摄处理的装置第一个实施例的结构方框图。Please refer to FIG. 3 , which is a structural block diagram of the first embodiment of the apparatus for processing portraits with closed eyes prevented according to the present invention.
该防闭眼的人像拍摄处理的装置,包括:The device for preventing eye-closing portrait shooting includes:
拍摄单元,用于获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像;The shooting unit is used to obtain a confirmation shooting instruction, and obtain images to be confirmed through the viewfinder interface for shooting portraits, and the images to be confirmed include several continuously acquired images that have not undergone digital image compression processing;
检测单元,用于获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态;A detection unit, configured to acquire the first image in the images to be confirmed, and use a face detection algorithm to detect the state of the eyes of all portraits in the first image;
调取单元,用于若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像;The calling unit is used to save the first image and call subsequent images after the first image if at least one portrait has eyes closed;
处理单元,用于检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。A processing unit, configured to detect whether the eyes of the person in the eye-closed state corresponding to the first image in the subsequent images are open; if they are open, use the subsequent image corresponding to the eye-open state to perform One image is partially processed corresponding to the eyes in the closed-eye state, so that the eyes of all portraits in the first image are in the open-eye state.
本发明实施例提供的防闭眼的人像拍摄处理的装置,能够有效避免拍出人像的眼睛处于闭眼状态的照片,大大提高照片本身的质量,优化用户体验。The eye-closing-proof portrait shooting processing device provided by the embodiments of the present invention can effectively avoid taking pictures of portraits with eyes closed, greatly improve the quality of the pictures themselves, and optimize user experience.
请参考图4,是本发明提供的防闭眼的人像拍摄处理的装置第二个实施例的结构方框图。本发明实施例在防闭眼的人像拍摄处理的装置的第一个实施例的基础上,增加了显示单元和启动单元。Please refer to FIG. 4 , which is a structural block diagram of a second embodiment of the device for image shooting processing with eyes closed prevention provided by the present invention. The embodiment of the present invention adds a display unit and an activation unit on the basis of the first embodiment of the device for preventing eyes from being closed for portrait shooting.
该防闭眼的人像拍摄处理的装置,包括:The device for preventing eye-closing portrait shooting includes:
拍摄单元,用于获得确认拍摄指令,通过拍摄人像的取景界面获得待确认图像,所述待确认图像包括连续获取的若干张未做数字图像压缩处理的图像;The shooting unit is used to obtain a confirmation shooting instruction, and obtain images to be confirmed through the viewfinder interface for shooting portraits, and the images to be confirmed include several continuously acquired images that have not undergone digital image compression processing;
检测单元,用于获取所述待确认图像中的第一张图像,利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态;A detection unit, configured to acquire the first image in the images to be confirmed, and use a face detection algorithm to detect the state of the eyes of all portraits in the first image;
调取单元,用于若至少有一个人像的眼睛处于闭眼状态,则保存所述第一张图像,并调取所述第一张图像之后的后续图像;The calling unit is used to save the first image and call subsequent images after the first image if at least one portrait has eyes closed;
处理单元,用于检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态。A processing unit, configured to detect whether the eyes of the person in the eye-closed state corresponding to the first image in the subsequent images are open; if they are open, use the subsequent image corresponding to the eye-open state to perform One image is partially processed corresponding to the eyes in the closed-eye state, so that the eyes of all portraits in the first image are in the open-eye state.
其中,所述处理单元,具体用于:Wherein, the processing unit is specifically used for:
在预设时间周期内,检测所述后续图像中对应于所述第一张图像处于闭眼状态的人像的眼睛是否睁开;Within a preset time period, detect whether the eyes of the person in the closed-eye state corresponding to the first image in the subsequent images are open;
若睁开,则利用睁眼状态对应的该张后续图像对所述第一张图像对应处于闭眼状态的眼部做局部处理,以使所述第一张图像中所有人像的眼睛处于睁眼状态;对做所述局部处理后获得的所有人像的眼睛处于睁眼状态的图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕;If it is opened, use the subsequent image corresponding to the eye-opening state to partially process the eyes corresponding to the eyes in the closed-eye state of the first image, so that the eyes of all portraits in the first image are in the open-eye state. State: carry out digital image compression processing to the image that the eyes of all portraits obtained after the partial processing are in the open-eye state, and display the final portrait picture after the digital image compression processing on the screen;
若没有睁开,则对所述第一张图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕。If it is not opened, digital image compression processing is performed on the first image, and the final portrait picture after the digital image compression processing is displayed on the screen.
其中,所述数字图像压缩处理为采用JPEG编码算法的数字图像压缩处理。Wherein, the digital image compression process is a digital image compression process using a JPEG encoding algorithm.
其中,所述防闭眼的人像拍摄处理的装置还包括显示单元,所述显示单元,用于若没有人像的眼睛处于闭眼状态,则对所述第一张图像进行数字图像压缩处理,把经所述数字图像压缩处理后的最终人像图片显示于屏幕。Wherein, the device for anti-closing-eye portrait shooting processing also includes a display unit, and the display unit is used to perform digital image compression processing on the first image if no eyes of the portrait are in the closed-eye state, and the The final portrait picture after the digital image compression processing is displayed on the screen.
其中,所述利用人脸检测算法检测所述第一张图像中所有人像的眼睛的状态,包括:Wherein, the state of the eyes of all portraits in the first image is detected by using the face detection algorithm, including:
利用人脸检测算法检测所述第一张图像中所有人像的眼部特征值,所述眼部特征值包括的瞳孔中部高度、瞳距或瞳孔灰度值;Utilize the human face detection algorithm to detect the eye feature values of all the portraits in the first image, the pupil middle height, pupil distance or pupil gray value included in the eye feature values;
当任一人像的瞳孔中部高度小于等于预设高度,则判断该人像的眼睛处于闭眼状态;当任一人像的瞳孔中部高度大于所述预设高度,则判断该人像的眼睛处于睁眼状态,或;When the middle height of the pupils of any portrait is less than or equal to the preset height, it is judged that the eyes of the portrait are in the closed state; when the middle height of the pupils of any portrait is greater than the preset height, it is judged that the eyes of the portrait are in the open state ,or;
当没有检测到任一人像的瞳距,则判断该人像的眼睛处于闭眼状态;当检测到任一人像的瞳距,则判断该人像的眼睛处于睁眼状态,或;When the interpupillary distance of any portrait is not detected, it is judged that the eyes of the portrait are in a closed state; when the interpupillary distance of any portrait is detected, it is judged that the eyes of the portrait are in an open state, or;
当任一人像的瞳孔灰度值小于等于预设瞳孔灰度值,则判断该人像的眼睛处于闭眼状态;当任一人像的瞳孔灰度值大于所述预设瞳孔灰度值,则判断该人像的眼睛处于睁眼状态。When the pupil gray value of any portrait is less than or equal to the preset pupil gray value, it is judged that the eyes of the portrait are closed; when the pupil gray value of any portrait is greater than the preset pupil gray value, it is judged The portrait's eyes are open.
其中,所述防闭眼的人像拍摄处理的装置还包括启动单元,所述启动单元,用于启动拍照功能。Wherein, the device for preventing eye-closing portrait shooting processing further includes a starting unit, and the starting unit is configured to start a photographing function.
本发明实施例提供的防闭眼的人像拍摄处理的装置,过人脸检测算法可以获取到人眼的状态,然后对闭眼的人像进行眼部局部处理,将人像的睁眼状态合成到第一张图像上,使闭眼人像处于睁眼状态,以便拍出更高质量的人像照片,有效避免拍出闭眼人像的照片。The embodiment of the present invention provides an anti-closed-eyed portrait shooting and processing device, which can obtain the state of human eyes through the face detection algorithm, and then perform partial eye processing on the closed-eyed portrait, and synthesize the open-eyed state of the portrait into the first On one image, the closed-eyed person is in the open-eyed state, so as to take higher-quality portrait photos, and effectively avoid taking photos of closed-eyed people.
一种防闭眼的人像拍摄处理的方法和装置,能够有效避免拍出人像的眼睛处于闭眼状态的照片,大大提高照片本身的质量,优化用户体验。A method and device for preventing eye-closing portrait shooting and processing, which can effectively avoid taking photos of portraits with eyes closed, greatly improve the quality of the photos themselves, and optimize user experience.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括存储器、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps for realizing the above-mentioned embodiments can be completed by hardware, and can also be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium, and the storage medium can include memory, disk or CD, etc.
以上内容仅为本发明的较佳实施例,对于本领域的普通技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,本说明书内容不应理解为对本发明的限制。The above content is only a preferred embodiment of the present invention. For those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. limits.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510416911.7ACN105072327B (en) | 2015-07-15 | 2015-07-15 | A kind of method and apparatus of the portrait processing of anti-eye closing |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510416911.7ACN105072327B (en) | 2015-07-15 | 2015-07-15 | A kind of method and apparatus of the portrait processing of anti-eye closing |
| Publication Number | Publication Date |
|---|---|
| CN105072327A CN105072327A (en) | 2015-11-18 |
| CN105072327Btrue CN105072327B (en) | 2018-05-25 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510416911.7AExpired - Fee RelatedCN105072327B (en) | 2015-07-15 | 2015-07-15 | A kind of method and apparatus of the portrait processing of anti-eye closing |
| Country | Link |
|---|---|
| CN (1) | CN105072327B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105592249B (en)* | 2015-12-23 | 2018-12-21 | 努比亚技术有限公司 | The terminal and method of eyelid reconstruction are carried out to personage in photo based on eyeprint identification |
| CN105827969A (en)* | 2016-03-29 | 2016-08-03 | 乐视控股(北京)有限公司 | Intelligent camera method and device, and mobile device |
| CN106250426A (en)* | 2016-07-25 | 2016-12-21 | 深圳天珑无线科技有限公司 | A kind of photo processing method and terminal |
| US10148884B2 (en)* | 2016-07-29 | 2018-12-04 | Microsoft Technology Licensing, Llc | Facilitating capturing a digital image |
| CN107292261B (en)* | 2017-06-16 | 2021-07-13 | 深圳天珑无线科技有限公司 | Photographing method and mobile terminal thereof |
| CN107622483A (en)* | 2017-09-15 | 2018-01-23 | 深圳市金立通信设备有限公司 | A kind of image combining method and terminal |
| CN107743195A (en)* | 2017-10-09 | 2018-02-27 | 惠州Tcl移动通信有限公司 | A kind of photographic method, mobile terminal and storage medium |
| CN107833197B (en)* | 2017-10-31 | 2021-03-02 | Oppo广东移动通信有限公司 | Image processing method and device, computer readable storage medium and electronic equipment |
| CN107911608A (en)* | 2017-11-30 | 2018-04-13 | 西安科锐盛创新科技有限公司 | The method of anti-shooting of closing one's eyes |
| CN108022206A (en)* | 2017-11-30 | 2018-05-11 | 广东欧珀移动通信有限公司 | Image processing method, image processing device, electronic equipment and computer readable storage medium |
| CN108234878A (en)* | 2018-01-31 | 2018-06-29 | 广东欧珀移动通信有限公司 | Image processing method and device and terminal |
| CN108229443A (en)* | 2018-02-08 | 2018-06-29 | 三星电子(中国)研发中心 | A kind of photographic method and device of anti-eye closing |
| CN108462831B (en)* | 2018-03-18 | 2020-09-08 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and electronic device |
| CN108259766B (en)* | 2018-03-29 | 2020-05-19 | 宁波大学 | A kind of mobile intelligent terminal photographing camera processing method |
| CN108259769B (en)* | 2018-03-30 | 2020-08-14 | Oppo广东移动通信有限公司 | Image processing method, device, storage medium and electronic device |
| CN110717349A (en)* | 2018-07-11 | 2020-01-21 | 深圳纬目信息技术有限公司 | Table mat and state monitoring method |
| CN114170069A (en)* | 2021-11-25 | 2022-03-11 | 杭州电子科技大学上虞科学与工程研究院有限公司 | An automatic processing method of closed eyes based on continuous multiple photos |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101617339A (en)* | 2007-02-15 | 2009-12-30 | 索尼株式会社 | Image processing apparatus and image processing method |
| WO2010029922A1 (en)* | 2008-09-12 | 2010-03-18 | アイシン精機株式会社 | Open/closed-eye judgment device, device for estimating degree of eye openness, and program |
| CN103369248A (en)* | 2013-07-20 | 2013-10-23 | 厦门美图移动科技有限公司 | Method for photographing allowing closed eyes to be opened |
| CN103716539A (en)* | 2013-12-16 | 2014-04-09 | 乐视致新电子科技(天津)有限公司 | Photographing method and apparatus |
| CN104052908A (en)* | 2013-03-15 | 2014-09-17 | 卡西欧计算机株式会社 | Display device, and display method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8102417B2 (en)* | 2006-10-25 | 2012-01-24 | Delphi Technologies, Inc. | Eye closure recognition system and method |
| CN100463000C (en)* | 2007-09-27 | 2009-02-18 | 上海交通大学 | Human Eye State Detection Method Based on Cascade Classification and Hough Circle Transformation |
| JP5169139B2 (en)* | 2007-10-25 | 2013-03-27 | 株式会社ニコン | Camera and image recording program |
| CN102193621A (en)* | 2010-03-17 | 2011-09-21 | 三星电子(中国)研发中心 | Vision-based interactive electronic equipment control system and control method thereof |
| JP6304999B2 (en)* | 2013-10-09 | 2018-04-04 | アイシン精機株式会社 | Face detection apparatus, method and program |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101617339A (en)* | 2007-02-15 | 2009-12-30 | 索尼株式会社 | Image processing apparatus and image processing method |
| WO2010029922A1 (en)* | 2008-09-12 | 2010-03-18 | アイシン精機株式会社 | Open/closed-eye judgment device, device for estimating degree of eye openness, and program |
| CN102150189A (en)* | 2008-09-12 | 2011-08-10 | 爱信精机株式会社 | Open-eye or closed-eye determination apparatus, degree of eye openness estimation apparatus and program |
| CN104052908A (en)* | 2013-03-15 | 2014-09-17 | 卡西欧计算机株式会社 | Display device, and display method |
| CN103369248A (en)* | 2013-07-20 | 2013-10-23 | 厦门美图移动科技有限公司 | Method for photographing allowing closed eyes to be opened |
| CN103716539A (en)* | 2013-12-16 | 2014-04-09 | 乐视致新电子科技(天津)有限公司 | Photographing method and apparatus |
| Publication number | Publication date |
|---|---|
| CN105072327A (en) | 2015-11-18 |
| Publication | Publication Date | Title |
|---|---|---|
| CN105072327B (en) | A kind of method and apparatus of the portrait processing of anti-eye closing | |
| CN107730444B (en) | Image processing method, image processing device, readable storage medium and computer equipment | |
| CN105243371B (en) | A kind of detection method, system and the camera terminal of face U.S. face degree | |
| CN107820017B (en) | Image shooting method and device, computer readable storage medium and electronic equipment | |
| CN102946516A (en) | Method and mobile terminal for realizing self-portrait by detecting blinking action of mobile terminal | |
| US20170161553A1 (en) | Method and electronic device for capturing photo | |
| KR20190038594A (en) | Face recognition-based authentication | |
| CN107862653B (en) | Image display method, device, storage medium and electronic device | |
| CN113642364B (en) | Face image processing method, device, equipment and computer readable storage medium | |
| CN109919866B (en) | Image processing methods, devices, media and electronic equipment | |
| CN110602379A (en) | Method, device and equipment for shooting certificate photo and storage medium | |
| CN105357425B (en) | Image capturing method and device | |
| CN107862274A (en) | Beautifying method, device, electronic device and computer-readable storage medium | |
| CN103716539A (en) | Photographing method and apparatus | |
| KR20100055946A (en) | Method and apparatus for generating thumbnail of moving picture | |
| CN101472133B (en) | Image correction device and image correction method | |
| CN107465885A (en) | A kind of method and apparatus for realizing video communication | |
| CN111161131A (en) | Image processing method, terminal and computer storage medium | |
| CN107330370A (en) | Forehead wrinkle action detection method and device and living body identification method and system | |
| CN107730448A (en) | U.S. face method and device based on image procossing | |
| CN114187166A (en) | Image processing method, intelligent terminal and storage medium | |
| CN108961156B (en) | Method and device for processing face image | |
| CN114219868A (en) | Skin care scheme recommendation method and system | |
| CN108846321B (en) | Method and device for identifying human face prosthesis and electronic equipment | |
| CN101499131A (en) | Apparatus and method for correcting image |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP01 | Change in the name or title of a patent holder | Address after:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Patentee after:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. Address before:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Patentee before:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. | |
| CP01 | Change in the name or title of a patent holder | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20180525 | |
| CF01 | Termination of patent right due to non-payment of annual fee |