[go: up one dir, main page]

CN106067167A - Image processing method and device - Google Patents

Image processing method and device Download PDF

Info

Publication number
CN106067167A
CN106067167A CN201610396947.8A CN201610396947A CN106067167A CN 106067167 A CN106067167 A CN 106067167A CN 201610396947 A CN201610396947 A CN 201610396947A CN 106067167 A CN106067167 A CN 106067167A
Authority
CN
China
Prior art keywords
image
unit
face region
processed
human face
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610396947.8A
Other languages
Chinese (zh)
Inventor
康健
孙剑波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201610396947.8A priority Critical patent/CN106067167A/en
Publication of CN106067167A publication Critical patent/CN106067167A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种图像处理方法及装置,其中,该图像处理方法包括:获取待处理的图像;识别所述图像中的人脸区域;确定所述人脸区域中的待处理位置,其中,所述待处理位置为脸部异物所在的位置;以所述人脸区域的脸部中轴线为对称轴,确定所述待处理位置的对称位置;将所述待处理位置的图像块替换为所述对称位置的图像块,得到处理后的图像;输出所述处理后的图像。本发明提供的技术方案能够有效提高图像中脸部异物的消除效果。

The present invention discloses an image processing method and device, wherein the image processing method comprises: obtaining an image to be processed; identifying a face region in the image; determining a position to be processed in the face region, wherein the position to be processed is the position where a facial foreign body is located; taking the facial central axis of the face region as the axis of symmetry, determining the symmetrical position of the position to be processed; replacing the image block of the position to be processed with the image block of the symmetrical position to obtain a processed image; and outputting the processed image. The technical solution provided by the present invention can effectively improve the effect of eliminating facial foreign bodies in an image.

Description

图像处理方法及装置Image processing method and device

技术领域technical field

本发明涉及图像处理技术领域,具体涉及一种图像处理方法及装置。The present invention relates to the technical field of image processing, in particular to an image processing method and device.

背景技术Background technique

随着智能终端(例如智能手机、平板电脑等)的快速发展,目前基本上所有智能终端都具备拍照功能,并且,智能终端的像素也越来越高,某些智能终端的拍照效果甚至不亚于卡片相机,相比于卡片相机、单反相机等专业摄像仪器,带有拍照功能的智能终端携带及使用都更为便捷,因此,大众更乐意于使用智能终端的拍照功能进行拍照。With the rapid development of smart terminals (such as smart phones, tablet computers, etc.), basically all smart terminals have a camera function, and the pixels of smart terminals are getting higher and higher, and the camera effect of some smart terminals is even as good as For card cameras, compared with professional camera equipment such as card cameras and SLR cameras, smart terminals with camera functions are more convenient to carry and use. Therefore, the public is more willing to use the camera function of smart terminals to take pictures.

目前,当用户使用智能终端拍摄人物之后,通常会对拍摄所得的照片中的人物进行美颜处理,以便将美颜处理后的照片发送至社交网络平台与好友、家人分享。现有的美颜处理过程中,仅能通过磨皮的方式对人物脸部的异物(例如斑点、痘或者痣)进行处理,由于磨皮不能过度(磨皮过度会导致人物脸部的细节都无法看清),因此,通过磨皮的方式仅能实现对人物脸部的异物的淡化,而无法完全消除人物脸部的异物。At present, after a user uses a smart terminal to take a picture of a person, he usually performs a beautification process on the person in the captured photo, so that the photo after the beautification process is sent to a social network platform to share with friends and family members. In the existing beauty treatment process, foreign bodies (such as spots, acne or moles) on the face of the character can only be treated by means of dermabrasion, because the dermabrasion cannot be excessive (excessive dermabrasion will cause the details of the character's face to be blurred). cannot be seen clearly), therefore, the foreign matter on the face of the character can only be lightened by means of skin resurfacing, but the foreign matter on the face of the character cannot be completely eliminated.

发明内容Contents of the invention

本发明提供一种图像处理方法及装置,用于提高图像中脸部异物的消除效果。The invention provides an image processing method and device, which are used to improve the effect of eliminating facial foreign objects in images.

本发明第一方面涉及一种图像处理方法,包括:The first aspect of the present invention relates to an image processing method, comprising:

获取待处理的图像;Get the image to be processed;

识别上述图像中的人脸区域;Identify the face area in the above image;

确定上述人脸区域中的待处理位置,其中,上述待处理位置为脸部异物所在的位置;Determining the position to be processed in the above-mentioned human face area, wherein the above-mentioned position to be processed is the position where the foreign body on the face is located;

以上述人脸区域的脸部中轴线为对称轴,确定上述待处理位置的对称位置;Determining the symmetrical position of the above-mentioned position to be processed by taking the central axis of the face of the above-mentioned human face area as the axis of symmetry;

将上述待处理位置的图像块替换为上述对称位置的图像块,得到处理后的图像;replacing the image block at the position to be processed with the image block at the symmetrical position above to obtain a processed image;

输出上述处理后的图像。Output the above processed image.

基于本发明第一方面,在第一种可能的实现方式中,上述确定上述人脸区域中的待处理位置,包括:Based on the first aspect of the present invention, in a first possible implementation manner, the determination of the position to be processed in the above-mentioned face area includes:

接收在上述人脸区域中输入的位置选择操作;Receive a position selection operation input in the above-mentioned face area;

将上述位置选择操作所选择的位置确定为上述人脸区域中的待处理位置。The position selected by the above position selection operation is determined as the position to be processed in the above human face area.

基于本发明第一方面,在第二种可能的实现方式中,上述确定上述人脸区域中的待处理位置,包括:Based on the first aspect of the present invention, in a second possible implementation manner, the above-mentioned determination of the position to be processed in the above-mentioned face area includes:

确定上述人脸区域中的非五官区域;Determining the non-facial features area in the above-mentioned face area;

将上述非五官区域中满足异物条件的图像区域所在的位置确定为上述人脸区域中的待处理位置;Determining the location of the image region that satisfies the foreign object condition in the above-mentioned non-facial features region as the location to be processed in the above-mentioned face region;

其中,上述异物条件为:图像区域的像素平均值在预设的阈值范围内。Wherein, the above-mentioned foreign matter condition is: the average value of pixels in the image area is within a preset threshold range.

基于本发明第一方面,或者本发明第一方面的第一种可能的实现方式,或者本发明第一方面的第二种可能的实现方式,在第三种可能的实现方式中,上述将上述待处理位置的图像块替换为上述对称位置的图像块,得到处理后的图像,包括:Based on the first aspect of the present invention, or the first possible implementation of the first aspect of the present invention, or the second possible implementation of the first aspect of the present invention, in the third possible implementation, the above-mentioned The image block at the position to be processed is replaced with the image block at the symmetrical position above, and the processed image is obtained, including:

拷贝上述对称位置的图像块;Copy the image block at the symmetrical position above;

将上述对称位置的图像块粘贴至上述待处理位置上后合成图像,得到处理后的图像。Paste the image blocks at the above-mentioned symmetrical positions to the above-mentioned to-be-processed positions and then synthesize the image to obtain a processed image.

基于本发明第一方面,或者本发明第一方面的第一种可能的实现方式,或者本发明第一方面的第二种可能的实现方式,在第四种可能的实现方式中,上述识别上述图像中的人脸区域,具体为:Based on the first aspect of the present invention, or the first possible implementation of the first aspect of the present invention, or the second possible implementation of the first aspect of the present invention, in the fourth possible implementation, the above-mentioned identification The face area in the image, specifically:

当接收到输入的脸部异物消除指令时,识别上述图像中的人脸区域。When an input facial foreign object removal instruction is received, the human face area in the above image is identified.

本发明第二方面涉及一种图像处理装置,包括:A second aspect of the present invention relates to an image processing device, comprising:

图像获取单元,用于获取待处理的图像;An image acquisition unit, configured to acquire an image to be processed;

识别单元,用于识别上述图像获取单元获取的图像中的人脸区域;An identification unit, configured to identify the human face area in the image acquired by the above image acquisition unit;

第一确定单元,用于确定上述人脸区域中的待处理位置,其中,上述待处理位置为脸部异物所在的位置;The first determining unit is configured to determine the position to be processed in the above-mentioned human face area, wherein the above-mentioned position to be processed is the position where the foreign object on the face is located;

第二确定单元,用于以上述人脸区域的脸部中轴线为对称轴,确定上述第一确定单元所确定的待处理位置的对称位置;The second determination unit is used to determine the symmetrical position of the position to be processed determined by the first determination unit with the central axis of the face area as the axis of symmetry;

图像块替换单元,用于将上述第一确定单元所确定的待处理位置的图像块替换为上述第二确定单元所确定的对称位置的图像块,得到处理后的图像;An image block replacement unit, configured to replace the image block at the position to be processed determined by the first determination unit with the image block at the symmetrical position determined by the second determination unit, to obtain a processed image;

图像输出单元,用于输出上述处理后的图像。An image output unit, configured to output the above-mentioned processed image.

基于本发明第二方面,在第一种可能的实现方式中,上述第一确定单元包括:Based on the second aspect of the present invention, in a first possible implementation manner, the above-mentioned first determination unit includes:

子接收单元,用于接收在上述人脸区域中输入的位置选择操作;A sub-receiving unit, configured to receive a position selection operation input in the above-mentioned face area;

第一子确定单元,用于将上述位置选择操作所选择的位置确定为上述人脸区域中的待处理位置。The first sub-determining unit is configured to determine the position selected by the position selection operation as the position to be processed in the human face area.

基于本发明第二方面,在第二种可能的实现方式中,上述第一确定单元包括:Based on the second aspect of the present invention, in a second possible implementation manner, the above-mentioned first determination unit includes:

第二子确定单元,用于确定上述人脸区域中的非五官区域;The second sub-determining unit is used to determine the non-facial sense area in the above-mentioned human face area;

第三子确定单元,用于将上述第二子确定单元确定的非五官区域中满足异物条件的图像区域所在的位置确定为上述人脸区域中的待处理位置;The third sub-determining unit is configured to determine the position of the image area that satisfies the foreign object condition in the non-features area determined by the second sub-determining unit as the position to be processed in the above-mentioned human face area;

其中,上述异物条件为:图像区域的像素平均值在预设的阈值范围内。Wherein, the above-mentioned foreign matter condition is: the average value of pixels in the image area is within a preset threshold range.

基于本发明第二方面,或者本发明第二方面的第一种可能的实现方式,或者本发明第二方面的第二种可能的实现方式,在第三种可能的实现方式中,上述图像块替换单元包括:Based on the second aspect of the present invention, or the first possible implementation of the second aspect of the present invention, or the second possible implementation of the second aspect of the present invention, in the third possible implementation, the above image block Replacement units include:

拷贝单元,用于拷贝上述第二确定单元所确定的对称位置的图像块;A copying unit, configured to copy the image block at the symmetrical position determined by the second determining unit;

粘贴合成单元,用于将上述拷贝单元拷贝的上述对称位置的图像块粘贴至上述第一确定单元所确定的待处理位置上后合成图像,得到处理后的图像。The pasting and combining unit is used to paste the image block at the symmetrical position copied by the copying unit to the position to be processed determined by the first determining unit, and then synthesize the image to obtain a processed image.

基于本发明第二方面,或者本发明第二方面的第一种可能的实现方式,或者本发明第二方面的第二种可能的实现方式,在第四种可能的实现方式中,上述图像处理装置还包括:美颜指令接收单元,用于接收输入的脸部异物消除指令;Based on the second aspect of the present invention, or the first possible implementation of the second aspect of the present invention, or the second possible implementation of the second aspect of the present invention, in a fourth possible implementation, the above image processing The device also includes: a beautification instruction receiving unit, configured to receive an input instruction for removing foreign objects on the face;

上述识别单元具体用于:当上述美颜指令接收单元接收到上述脸部异物消除指令时,识别上述图像获取单元获取的图像中的人脸区域。The recognition unit is specifically configured to: when the beautification instruction receiving unit receives the facial foreign object removal instruction, recognize the face area in the image acquired by the image acquisition unit.

由上可见,本发明实施例中通过识别待处理图像中的人脸区域,并在确定待处理位置(即脸部异物所在的位置)之后,以该人脸区域的脸部中轴线为对称轴,确定该待处理位置的对称位置,将该待处理位置的图像块替换为该对称位置的图像块,以此消除待处理位置的脸部异物,一方面,由于待处理位置的对称位置的图像块与待处理位置的图像块有一定的相似度,因此,将待处理位置的图像块替换为其对称位置的图像块,能够提高图像的契合度,另一方面,采用替换的方式而非淡化的方式处理待处理位置的脸部异物,能够有效消除脸部异物,提高图像中脸部异物的消除效果。It can be seen from the above that in the embodiment of the present invention, by identifying the face area in the image to be processed, and after determining the position to be processed (that is, the position of the foreign body on the face), the central axis of the face area is used as the axis of symmetry , determine the symmetrical position of the position to be processed, and replace the image block at the position to be processed with the image block at the symmetrical position, so as to eliminate the facial foreign body at the position to be processed. There is a certain degree of similarity between the block and the image block at the position to be processed. Therefore, replacing the image block at the position to be processed with an image block at a symmetrical position can improve the fit of the image. The method of processing the facial foreign objects at the position to be processed can effectively eliminate the facial foreign objects and improve the elimination effect of the facial foreign objects in the image.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明提供的图像处理方法一个实施例流程示意图;Fig. 1 is a schematic flow chart of an embodiment of the image processing method provided by the present invention;

图2为本发明提供的图像处理装置一个实施例结构示意图。FIG. 2 is a schematic structural diagram of an embodiment of an image processing device provided by the present invention.

具体实施方式detailed description

为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而非全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明实施例提供一种图像处理方法,请参阅图1,本发明实施例中的图像处理方法包括:The embodiment of the present invention provides an image processing method, please refer to FIG. 1, the image processing method in the embodiment of the present invention includes:

步骤101、获取待处理的图像;Step 101, acquiring an image to be processed;

本发明实施例中,可以从照片库中获取待处理的图像,或者,也可以获取实时拍摄得到的图像作为待处理的图像,此处不作限定。In the embodiment of the present invention, the image to be processed may be obtained from a photo library, or an image captured in real time may also be obtained as the image to be processed, which is not limited herein.

步骤102、识别上述图像中的人脸区域;Step 102, identifying the face area in the above image;

本发明实施例中,对步骤101获取的图像进行人脸识别,以识别出上述图像中的人脸区域。具体地,通过对图像进行人脸识别并识别出图像中的人脸区域的过程可以参照已有技术实现,此处不再赘述。In the embodiment of the present invention, face recognition is performed on the image acquired in step 101 to identify the face area in the above image. Specifically, the process of performing face recognition on an image and identifying a face area in the image can be implemented with reference to existing technologies, and will not be repeated here.

可选的,在步骤101获取待处理的图像之后,等待用户输入指令,在接收到用户输入的指令之后,再根据用户输入的指令对步骤101获取的图像进行处理。步骤102具体为:当接收到输入的脸部异物消除指令时,识别步骤101获取的图像中的人脸区域。具体地,可以提供人脸异物消除控件,以便用户通过触发该人脸异物消除控件输入上述脸部异物消除指令。当然,也可以在步骤101获取待处理的图像之后,即执行步骤102,此处不作限定。Optionally, after acquiring the image to be processed in step 101, wait for the user to input an instruction, and then process the image acquired in step 101 according to the instruction input by the user after receiving the instruction input by the user. Step 102 is specifically: when an input facial foreign body removal instruction is received, identify the face area in the image acquired in step 101 . Specifically, a face foreign object removal control may be provided, so that the user inputs the above-mentioned face foreign object removal instruction by triggering the face foreign object removal control. Of course, step 102 may also be executed after the image to be processed is acquired in step 101, which is not limited here.

步骤103、确定上述人脸区域中的待处理位置;Step 103, determining the position to be processed in the above-mentioned face area;

其中,上述待处理位置为脸部异物所在的位置。Wherein, the above-mentioned position to be processed is the position where the foreign body on the face is located.

本发明实施例中,脸部异物包括但不限于:斑点、痘和痣。In the embodiment of the present invention, foreign bodies on the face include but are not limited to: spots, acne and moles.

在一种应用场景中,接收在上述人脸区域中输入的位置选择操作;将上述位置选择操作所选择的位置确定为上述人脸区域中的待处理位置。可选的,上述位置选择操作具体为点击操作,即,用户可以通过点击上述人脸区域中的脸部异物所在的位置的方式选择待处理位置,以便在步骤103中将用户点击的位置确定为上述人脸区域中的待处理位置。当然,也可以通过其它方式输入上述位置选择操作,例如可通过触发实体按键来移动选择框,将选择框移动至上述人脸区域中的脸部异物所在的位置后输入“确定”指令,将此时该选择框所选定的位置确定为上述人脸区域中的待处理位置。In an application scenario, a position selection operation input in the human face area is received; and the position selected by the position selection operation is determined as a position to be processed in the human face area. Optionally, the above position selection operation is specifically a click operation, that is, the user can select the position to be processed by clicking the position of the foreign body in the face area above, so that in step 103, the position clicked by the user is determined as The position to be processed in the above face region. Of course, the above-mentioned position selection operation can also be input in other ways, for example, the selection box can be moved by triggering a physical button, and the selection box can be moved to the position of the facial foreign object in the above-mentioned face area, and then input the "OK" command, and this At this time, the position selected by the selection box is determined as the position to be processed in the above-mentioned face area.

在另一种应用场景中,由于在上述图像的人脸区域中,脸部异物的亮度相对于非脸部异物的亮度会偏暗,因此,本应用场景中可以依据该原理采用自动识别脸部异物的方式确定上述人脸区域中的待处理位置。具体地,步骤103包括:确定上述人脸区域中的非五官区域;将上述非五官区域中满足异物条件的图像区域所在的位置确定为所述人脸区域中的待处理位置;其中,上述异物条件为:图像区域的像素平均值在预设的阈值范围内。需要说明的是,上述人脸区域中的非五官区域是指上述人脸区域中除眼、耳、鼻、舌、口以外的区域,通过已有的人脸识别技术可确定上述人脸区域中的五官区域,进而可将上述人脸区域中除上述五官区域以外的区域确定为上述人脸区域的非五官区域。上述阈值范围可以通过大量实验数据统计得到,本发明实施例不对上述阈值范围进行具体限定。In another application scenario, since in the face area of the above image, the brightness of foreign objects on the face will be darker than the brightness of foreign objects on the face, therefore, in this application scenario, automatic face recognition can be adopted based on this principle. The way of foreign objects determines the position to be processed in the above-mentioned face area. Specifically, step 103 includes: determining the non-featured sense area in the above-mentioned human face area; determining the position of the image area satisfying the foreign object condition in the above-mentioned non-five sense area area as the position to be processed in the human face area; wherein, the above-mentioned foreign object The condition is: the average value of pixels in the image area is within a preset threshold range. It should be noted that the non-featured sense area in the above-mentioned face area refers to the area other than the eyes, ears, nose, tongue, and mouth in the above-mentioned face area. The facial features area of the above-mentioned human face area, and then the areas other than the aforementioned facial features area in the aforementioned human face area may be determined as non-facial features areas of the aforementioned human face area. The foregoing threshold range can be obtained through statistics of a large amount of experimental data, and the embodiment of the present invention does not specifically limit the foregoing threshold range.

步骤104、以上述人脸区域的脸部中轴线为对称轴,确定上述待处理位置的对称位置;Step 104, taking the central axis of the face of the above-mentioned face area as the axis of symmetry, determining the symmetrical position of the above-mentioned position to be processed;

本发明实施例中,脸部中轴线是指将人脸区域平均分割为左半区域和由半区域的直线,人脸的鼻子和嘴巴位于该脸部中轴线上,且人脸的左眼和右眼分别位于该脸部中轴线的两侧。In the embodiment of the present invention, the central axis of the face refers to the straight line that divides the human face area into the left half area and the second half area on average. The nose and mouth of the human face are located on the central axis of the face, and the left eye and The right eyes are located on both sides of the central axis of the face.

在步骤104中,以上述人脸区域的脸部中轴线为对称轴,确定步骤103所确定的待处理位置的对称位置。应理解,该待处理位置的中心点到上述脸部中轴线的距离等于其对称位置的中心点到上述脸部中轴线的距离,且该待处理位置的形状和大小与其对称位置的形状和大小一致。In step 104, the symmetric position of the position to be processed determined in step 103 is determined by taking the central axis of the face of the above-mentioned human face region as the axis of symmetry. It should be understood that the distance from the central point of the position to be treated to the central axis of the face is equal to the distance from the central point of the symmetrical position to the central axis of the face, and the shape and size of the position to be treated are equal to the shape and size of the symmetrical position unanimous.

步骤105、将上述待处理位置的图像块替换为上述对称位置的图像块,得到处理后的图像;Step 105, replacing the image block at the position to be processed with the image block at the symmetrical position above to obtain a processed image;

可选的,在步骤105中,拷贝上述对称位置的图像块,并将上述对称位置的图像块粘贴至上述待处理位置上后合成图像,得到处理后的图像。或者,也可以遍历上述对称位置中各个像素点的像素值,并将上述待处理位置的各个像素点的像素值逐一修改为上述对称位置中相应像素点的像素值,以此实现将上述待处理位置的图像块替换为上述对称位置的图像块。当然,本发明实施例中,也可以通过其它方式将上述待处理位置的图像块替换为上述对称位置的图像块,此处不作限定。Optionally, in step 105, copy the above-mentioned image block at the symmetrical position, paste the above-mentioned image block at the above-mentioned symmetrical position on the above-mentioned position to be processed, and then synthesize an image to obtain a processed image. Alternatively, it is also possible to traverse the pixel values of each pixel point in the above-mentioned symmetrical position, and modify the pixel value of each pixel point in the above-mentioned to-be-processed position to the pixel value of the corresponding pixel point in the above-mentioned symmetrical position, so as to realize the processing of the above-mentioned to-be-processed The image block at the position is replaced by the image block at the above-mentioned symmetrical position. Of course, in the embodiment of the present invention, the image block at the position to be processed may also be replaced with the image block at the symmetrical position in other ways, which is not limited here.

步骤106、输出上述处理后的图像;Step 106, outputting the above-mentioned processed image;

本发明实施例中,输出步骤105处理得到的图像。In the embodiment of the present invention, the processed image obtained in step 105 is output.

具体地,步骤106包括但不限于:输出显示上述处理后的图像和输出存储上述处理后的图像。Specifically, step 106 includes but is not limited to: outputting and displaying the above-mentioned processed image and outputting and storing the above-mentioned processed image.

需要说明的是,本发明实施例中的图像处理方法具体可以由图像处理装置实现,该图像处理装置可以集成在智能终端中。上述智能终端具体为智能手机、平板电脑或其它具备图像处理能力的终端,此处不作限定。It should be noted that the image processing method in the embodiment of the present invention may be specifically implemented by an image processing device, and the image processing device may be integrated in a smart terminal. The above-mentioned smart terminal is specifically a smart phone, a tablet computer or other terminals with image processing capability, which is not limited here.

由上可见,本发明实施例中通过识别待处理图像中的人脸区域,并在确定待处理位置(即脸部异物所在的位置)之后,以该人脸区域的脸部中轴线为对称轴,确定该待处理位置的对称位置,将该待处理位置的图像块替换为该对称位置的图像块,以此消除待处理位置的脸部异物,一方面,由于待处理位置的对称位置的图像块与待处理位置的图像块有一定的相似度,因此,将待处理位置的图像块替换为其对称位置的图像块,能够提高图像的契合度,另一方面,采用替换的方式而非淡化的方式处理待处理位置的脸部异物,能够有效消除脸部异物,提高图像中脸部异物的消除效果。It can be seen from the above that in the embodiment of the present invention, by identifying the face area in the image to be processed, and after determining the position to be processed (that is, the position of the foreign body on the face), the central axis of the face area is used as the axis of symmetry , determine the symmetrical position of the position to be processed, and replace the image block at the position to be processed with the image block at the symmetrical position, so as to eliminate the facial foreign body at the position to be processed. There is a certain degree of similarity between the block and the image block at the position to be processed. Therefore, replacing the image block at the position to be processed with an image block at a symmetrical position can improve the fit of the image. The method of processing the facial foreign objects at the position to be processed can effectively eliminate the facial foreign objects and improve the elimination effect of the facial foreign objects in the image.

实施例二Embodiment two

本发明实施例还提供一种图像处理装置,请参阅图2,本发明实施例中的图像处理装置200包括:The embodiment of the present invention also provides an image processing device, please refer to FIG. 2, the image processing device 200 in the embodiment of the present invention includes:

图像获取单元201,用于获取待处理的图像;An image acquisition unit 201, configured to acquire an image to be processed;

识别单元202,用于识别图像获取单元201获取的图像中的人脸区域;An identification unit 202, configured to identify the face area in the image acquired by the image acquisition unit 201;

第一确定单元203,用于确定所述人脸区域中的待处理位置,其中,所述待处理位置为脸部异物所在的位置;The first determining unit 203 is configured to determine a position to be processed in the face area, wherein the position to be processed is a position where a foreign object on the face is located;

第二确定单元204,用于以所述人脸区域的脸部中轴线为对称轴,确定所述第一确定单元所确定的待处理位置的对称位置;The second determination unit 204 is configured to determine the symmetric position of the position to be processed determined by the first determination unit, taking the central axis of the face region as the axis of symmetry;

图像块替换单元205,用于将第一确定单元203所确定的待处理位置的图像块替换为第二确定单元204所确定的对称位置的图像块,得到处理后的图像;An image block replacement unit 205, configured to replace the image block at the position to be processed determined by the first determining unit 203 with the image block at the symmetrical position determined by the second determining unit 204, to obtain a processed image;

图像输出单元206,用于输出所述处理后的图像。An image output unit 206, configured to output the processed image.

可选的,第一确定单元203包括:子接收单元,用于接收在所述人脸区域中输入的位置选择操作;第一子确定单元,用于将所述位置选择操作所选择的位置确定为所述人脸区域中的待处理位置。Optionally, the first determining unit 203 includes: a sub-receiving unit, configured to receive a position selection operation input in the face area; a first sub-determining unit, configured to determine the position selected by the position selection operation is the position to be processed in the face area.

可选的,第一确定单元203包括:第二子确定单元,用于确定所述人脸区域中的非五官区域;第三子确定单元,用于将所述第二子确定单元确定的非五官区域中满足异物条件的图像区域所在的位置确定为所述人脸区域中的待处理位置;其中,所述异物条件为:图像区域的像素平均值在预设的阈值范围内。Optionally, the first determining unit 203 includes: a second sub-determining unit, configured to determine the non-facial features area in the face area; a third sub-determining unit, configured to determine the non-facial features determined by the second sub-determining unit The position of the image area satisfying the foreign matter condition in the facial features area is determined as the position to be processed in the face area; wherein, the foreign matter condition is: the average value of pixels in the image area is within a preset threshold range.

可选的,本发明实施例中的图像块替换单元包括:拷贝单元,用于拷贝第二确定单元204所确定的对称位置的图像块;粘贴合成单元,用于将所述拷贝单元拷贝的所述对称位置的图像块粘贴至第一确定单元203所确定的待处理位置上后合成图像,得到处理后的图像。Optionally, the image block replacing unit in the embodiment of the present invention includes: a copying unit, configured to copy the image block at the symmetrical position determined by the second determining unit 204; Paste the image block at the symmetrical position to the position to be processed determined by the first determination unit 203 and then synthesize the image to obtain a processed image.

可选是,本发明实施例中的图像处理装置还包括:美颜指令接收单元,用于接收输入的脸部异物消除指令;所述识别单元具体用于:当所述美颜指令接收单元接收到所述脸部异物消除指令时,识别图像获取单元201获取的图像中的人脸区域。Optionally, the image processing device in the embodiment of the present invention further includes: a beautification instruction receiving unit, configured to receive an input facial foreign body removal instruction; the identification unit is specifically configured to: when the beautification instruction receiving unit receives When the face foreign object removal instruction is reached, the face area in the image acquired by the image acquisition unit 201 is recognized.

需要说明的是,本发明实施例中的图像处理装置可以集成在智能终端中。上述智能终端具体为智能手机、平板电脑或其它具备图像处理能力的终端,此处不作限定。It should be noted that the image processing apparatus in the embodiment of the present invention may be integrated in a smart terminal. The above-mentioned smart terminal is specifically a smart phone, a tablet computer or other terminals with image processing capability, which is not limited here.

应理解,本发明实施例中的图像处理方法及装置的各个功能模块的功能可以根据上述方法实施例中的方法具体实现,其具体实现过程可参照上述方法实施例中的相关描述,此处不再赘述。It should be understood that the functions of each functional module of the image processing method and device in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment, and the specific implementation process can refer to the relevant description in the above method embodiment, which is not described here. Let me repeat.

由上可见,本发明实施例中的图像处理装置通过识别待处理图像中的人脸区域,并在确定待处理位置(即脸部异物所在的位置)之后,以该人脸区域的脸部中轴线为对称轴,确定该待处理位置的对称位置,将该待处理位置的图像块替换为该对称位置的图像块,以此消除待处理位置的脸部异物,一方面,由于待处理位置的对称位置的图像块与待处理位置的图像块有一定的相似度,因此,将待处理位置的图像块替换为其对称位置的图像块,能够提高图像的契合度,另一方面,采用替换的方式而非淡化的方式处理待处理位置的脸部异物,能够有效消除脸部异物,提高图像中脸部异物的消除效果。As can be seen from the above, the image processing device in the embodiment of the present invention recognizes the face area in the image to be processed, and after determining the position to be processed (that is, the position where the foreign object on the face is located), uses the facial center of the face area The axis is the axis of symmetry, determine the symmetrical position of the position to be processed, and replace the image block at the position to be processed with the image block at the symmetrical position, so as to eliminate the foreign body on the face at the position to be processed. On the one hand, due to the The image block at the symmetrical position has a certain degree of similarity with the image block at the position to be processed. Therefore, replacing the image block at the position to be processed with the image block at the symmetrical position can improve the fit of the image. On the other hand, using the replaced It can effectively eliminate facial foreign objects and improve the effect of removing facial foreign objects in images by using the method of processing instead of lightening.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统和方法,可以通过其它的方式实现。In the several embodiments provided in this application, it should be understood that the disclosed system and method can be implemented in other ways.

需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本发明所必须的。It should be noted that, for the sake of simplicity of description, the aforementioned method embodiments are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. Because of the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

以上为对本发明所提供的一种图像处理方法及装置的描述,对于本领域的一般技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本发明的限制。The above is a description of an image processing method and device provided by the present invention. For those of ordinary skill in the art, according to the idea of the embodiment of the present invention, there will be changes in the specific implementation and application range. In summary , the contents of this specification should not be construed as limiting the present invention.

Claims (10)

1. an image processing method, it is characterised in that including:
Obtain pending image;
Identify the human face region in described image;
Determining the pending position in described human face region, wherein, described pending position is the position at face's foreign body place;
With the face axis of described human face region as axis of symmetry, determine the symmetric position of described pending position;
The image block of described pending position is replaced with the image block of described symmetric position, the image after being processed;
Export the image after described process.
Image processing method the most according to claim 1, it is characterised in that described determine in described human face region wait locate Reason position, including:
Receive the position of input in described human face region and select operation;
Described position is selected the pending position that the position selected by operation is defined as in described human face region.
Image processing method the most according to claim 1, it is characterised in that described determine in described human face region wait locate Reason position, including:
Determine the non-face region in described human face region;
The position at the image-region place meeting foreign body condition in described non-face region is defined as in described human face region Pending position;
Wherein, described foreign body condition is: the pixel average of image-region is in default threshold range.
4. according to the image processing method described in any one of claims 1 to 3, it is characterised in that described by described pending position The image block put replaces with the image block of described symmetric position, the image after being processed, including:
Copy the image block of described symmetric position;
The image block of described symmetric position is affixed to composograph after on described pending position, the image after being processed.
5. according to the image processing method described in any one of claims 1 to 3, it is characterised in that in the described image of described identification Human face region, particularly as follows:
When the face's foreign body receiving input eliminates instruction, identify the human face region in described image.
6. an image processing apparatus, it is characterised in that including:
Image acquisition unit, for obtaining pending image;
Recognition unit, for identifying the human face region in the image that described image acquisition unit obtains;
First determines unit, and for determining the pending position in described human face region, wherein, described pending position is face The position at foreign body place;
Second determines unit, for the face axis of described human face region as axis of symmetry, determining that described first determines unit Determined by the symmetric position of pending position;
Image block replacement unit, described for determining that by described first the image block of pending position determined by unit replaces with Second image block determining symmetric position determined by unit, the image after being processed;
Image output unit, the image after exporting described process.
Image processing apparatus the most according to claim 6, it is characterised in that described first determines that unit includes:
Son receives unit, selects operation for receiving the position of input in described human face region;
First son determines unit, for described position selects the position selected by operation be defined as treating in described human face region Processing position.
Image processing apparatus the most according to claim 6, it is characterised in that described first determines that unit includes:
Second son determines unit, for determining the non-face region in described human face region;
3rd son determines unit, for described second son determines the figure meeting foreign body condition in the non-face region that unit determines The pending position being defined as in described human face region as the position at place, region;
Wherein, described foreign body condition is: the pixel average of image-region is in default threshold range.
9. according to the image processing apparatus described in any one of claim 6 to 8, it is characterised in that described image block replacement unit Including:
Copy cell, for copying the described second image block determining symmetric position determined by unit;
Pasting synthesis unit, the image block of described symmetric position for described copy cell being copied affixes to described first true Composograph after on pending position determined by cell, the image after being processed.
10. according to the image processing apparatus described in any one of claim 6 to 8, it is characterised in that described image processing apparatus is also Including: U.S. face instruction reception unit, eliminate instruction for receiving face's foreign body of input;
Described recognition unit specifically for: when described U.S. face instruction reception unit receive described face foreign body eliminate instruction time, Identify the human face region in the image that described image acquisition unit obtains.
CN201610396947.8A 2016-06-06 2016-06-06 Image processing method and device Pending CN106067167A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610396947.8A CN106067167A (en) 2016-06-06 2016-06-06 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610396947.8A CN106067167A (en) 2016-06-06 2016-06-06 Image processing method and device

Publications (1)

Publication Number Publication Date
CN106067167A true CN106067167A (en) 2016-11-02

Family

ID=57420284

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610396947.8A Pending CN106067167A (en) 2016-06-06 2016-06-06 Image processing method and device

Country Status (1)

Country Link
CN (1) CN106067167A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107395958A (en) * 2017-06-30 2017-11-24 北京金山安全软件有限公司 Image processing method and device, electronic equipment and storage medium
CN107862663A (en) * 2017-11-09 2018-03-30 广东欧珀移动通信有限公司 Image processing method, device, readable storage medium and computer equipment
CN108520493A (en) * 2018-03-30 2018-09-11 广东欧珀移动通信有限公司 Image replacement processing method, device, storage medium and electronic equipment
CN111696041A (en) * 2020-06-04 2020-09-22 北京字节跳动网络技术有限公司 Image processing method and device and electronic equipment
CN113343906A (en) * 2021-06-28 2021-09-03 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620667A (en) * 2008-07-03 2010-01-06 深圳市康贝尔智能技术有限公司 Processing method for eliminating illumination unevenness of face image
US7697734B2 (en) * 2005-11-19 2010-04-13 Electronics And Telecommunications Research Institute Method and apparatus of detecting eye using symmetry and moment characteristics of object
CN102479322A (en) * 2010-11-30 2012-05-30 财团法人资讯工业策进会 System, device and method for analyzing facial defects by using facial image with angle
CN104200444A (en) * 2014-09-25 2014-12-10 西北民族大学 Image restoring method based on symmetric sample pieces
CN104318262A (en) * 2014-09-12 2015-01-28 上海明穆电子科技有限公司 Method and system for replacing skin through human face photos
CN104331692A (en) * 2014-11-28 2015-02-04 广东欧珀移动通信有限公司 Method and terminal for face recognition based on dual features

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7697734B2 (en) * 2005-11-19 2010-04-13 Electronics And Telecommunications Research Institute Method and apparatus of detecting eye using symmetry and moment characteristics of object
CN101620667A (en) * 2008-07-03 2010-01-06 深圳市康贝尔智能技术有限公司 Processing method for eliminating illumination unevenness of face image
CN102479322A (en) * 2010-11-30 2012-05-30 财团法人资讯工业策进会 System, device and method for analyzing facial defects by using facial image with angle
CN104318262A (en) * 2014-09-12 2015-01-28 上海明穆电子科技有限公司 Method and system for replacing skin through human face photos
CN104200444A (en) * 2014-09-25 2014-12-10 西北民族大学 Image restoring method based on symmetric sample pieces
CN104331692A (en) * 2014-11-28 2015-02-04 广东欧珀移动通信有限公司 Method and terminal for face recognition based on dual features

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107395958A (en) * 2017-06-30 2017-11-24 北京金山安全软件有限公司 Image processing method and device, electronic equipment and storage medium
CN107395958B (en) * 2017-06-30 2019-11-15 北京金山安全软件有限公司 Image processing method and device, electronic equipment and storage medium
CN107862663A (en) * 2017-11-09 2018-03-30 广东欧珀移动通信有限公司 Image processing method, device, readable storage medium and computer equipment
CN108520493A (en) * 2018-03-30 2018-09-11 广东欧珀移动通信有限公司 Image replacement processing method, device, storage medium and electronic equipment
CN111696041A (en) * 2020-06-04 2020-09-22 北京字节跳动网络技术有限公司 Image processing method and device and electronic equipment
CN111696041B (en) * 2020-06-04 2023-06-30 北京字节跳动网络技术有限公司 Image processing method and device and electronic equipment
CN113343906A (en) * 2021-06-28 2021-09-03 北京达佳互联信息技术有限公司 Image processing method, image processing device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2016101883A1 (en) Method for face beautification in real-time video and electronic equipment
CN104503749B (en) Photo processing method and electronic equipment
WO2016180224A1 (en) Method and device for processing image of person
CN107730444B (en) Image processing method, image processing device, readable storage medium and computer equipment
WO2016145830A1 (en) Image processing method, terminal and computer storage medium
CN105956576A (en) Image beautifying method and device and mobile terminal
WO2019237745A1 (en) Facial image processing method and apparatus, electronic device and computer readable storage medium
CN107862663A (en) Image processing method, device, readable storage medium and computer equipment
CN104811684B (en) A kind of three-dimensional U.S. face method and device of image
CN106067167A (en) Image processing method and device
CN107742274A (en) Image processing method, device, computer-readable storage medium, and electronic device
CN107886484A (en) Beautifying method, device, computer readable storage medium and electronic device
CN110781770B (en) Living body detection method, device and equipment based on face recognition
CN104754221B (en) A kind of photographic method and mobile terminal
CN110263737A (en) Image processing method, image processing apparatus, terminal device and readable storage medium storing program for executing
CN103716539A (en) Photographing method and apparatus
US20230036338A1 (en) Method and apparatus for generating image restoration model, medium and program product
CN107578372B (en) Image processing method, image processing device, computer-readable storage medium and electronic equipment
WO2020125217A1 (en) Expression recognition method and apparatus and recommendation method and apparatus
CN113240598B (en) Face image deblurring method, face image deblurring device, medium and equipment
EP3699865B1 (en) Three-dimensional face shape derivation device, three-dimensional face shape deriving method, and non-transitory computer readable medium
KR20210145781A (en) Facial softening system and method to improve the texture of fine-condensed skin
CN105430269A (en) A photographing method and device applied to a mobile terminal
CN108805838A (en) A kind of image processing method, mobile terminal and computer readable storage medium
CN112597911B (en) Skin grinding processing method and device, mobile terminal and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161102