WO2015154516A1 - 基于人脸识别的图片裁剪方法、装置、设备和存储介质 - Google Patents

基于人脸识别的图片裁剪方法、装置、设备和存储介质 Download PDF

Info

Publication number
WO2015154516A1
WO2015154516A1 PCT/CN2014/094231 CN2014094231W WO2015154516A1 WO 2015154516 A1 WO2015154516 A1 WO 2015154516A1 CN 2014094231 W CN2014094231 W CN 2014094231W WO 2015154516 A1 WO2015154516 A1 WO 2015154516A1
Authority
WO
WIPO (PCT)
Prior art keywords
cropping
picture
face
crop
frame
Prior art date
Application number
PCT/CN2014/094231
Other languages
English (en)
French (fr)
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 WO2015154516A1 publication Critical patent/WO2015154516A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/179Human faces, e.g. facial parts, sketches or expressions metadata assisted face recognition

Definitions

  • Embodiments of the present invention relate to the field of image processing technologies, and in particular, to a picture clipping method, apparatus, device, and storage medium based on face recognition.
  • Inserting images into web pages (such as search results pages or product browsing pages), showing the web resources to users in an illustrated way, reflects the product development trend in the era of Internet reading.
  • the shape and size of the images will usually be different. If you do not directly display the images, they will make the whole webpage look particularly messy, affecting the user's reading experience, and sometimes even Brought very bad visual effects. Therefore, in order to make the images in the webpage consistent in the presentation style, it is necessary to properly crop the image so that the best presentation experience can be achieved.
  • the conventional image cropping technique is generally: for a graph whose height is larger than the width, the bottom portion of the graph is cropped; for a graph having a width greater than the height, the two sides of the graph are cropped, or the image is cropped to Keep the center of the image.
  • these traditional methods of cropping often cause the main part of the image to be truncated, making the image presented in the web page look unsightly.
  • the prior art proposes a picture cropping technique, which firstly performs subject recognition on a picture, and then performs picture cropping according to the location of the subject.
  • the algorithm of subject recognition is complex, the accuracy of subject recognition is not very high, and sometimes the position of the subject in the picture does not match the position of the person, so the cropping effect is still not good.
  • the embodiment of the invention provides a method, a device, a device and a storage medium for image clipping based on face recognition, so as to improve the cropping effect of the image, and overcome the problem of image cropping caused by improper recognition of the image or improper recognition algorithm in the prior art.
  • the good drawbacks are to improve the user's reading experience on the pictures in the webpage.
  • an embodiment of the present invention provides a method for cropping a picture based on face recognition, the method comprising:
  • the picture is cropped according to the face recognition result and the target crop size
  • the subject is subjected to subject distinctive recognition, and the picture is cropped according to the subject significant recognition result and the target crop size.
  • an embodiment of the present invention further provides a picture clipping device based on face recognition, the device comprising:
  • a face recognition module for performing face recognition on a picture
  • a first cropping module configured to: if the face recognition module recognizes a face, crop the image according to the face recognition result and the target crop size;
  • the second cropping module is configured to perform subject distinctive recognition on the image if the face recognition module does not recognize the face, and crop the image according to the subject distinctive recognition result and the target crop size.
  • an embodiment of the present invention further provides a face clipping-based image cropping device, including: one or more processors, a memory, and one or more programs; the one or more programs are stored in the In memory, when executed by the one or more processors:
  • the picture is cropped according to the face recognition result and the target crop size
  • the subject is subjected to subject distinctive recognition, and the picture is cropped according to the subject significant recognition result and the target crop size.
  • embodiments of the present invention further provide one or more storage media including computer executable instructions for performing a face recognition based image cropping method when executed by a computer processor, The method includes the following steps:
  • the picture is cropped according to the face recognition result and the target crop size
  • the subject is subjected to subject distinctive recognition, and the picture is cropped according to the subject significant recognition result and the target crop size.
  • the technical solution proposed by the embodiment of the present invention firstly performs face recognition on a picture, performs subject recognition without recognizing a face, and then performs image cropping according to a face or subject recognition result, so that the search result page or The size of the images on the product browsing page remains neat, and the core information such as key faces, heads or main objects can be displayed as completely as possible without causing bad visual effects.
  • the reading experience of the images is greatly improved and helped. .
  • the embodiment of the present invention can avoid displaying the indecent image.
  • FIG. 1 is a schematic flowchart of a method for cropping a picture based on face recognition according to Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram showing display of a picture to be cropped according to Embodiment 1 of the present invention
  • FIG. 3 is a schematic flowchart of a method for cropping a picture based on face recognition according to Embodiment 2 of the present invention
  • FIG. 4A is a schematic diagram showing display of a picture to be displayed on a webpage according to Embodiment 2 of the present invention.
  • FIG. 4B is a schematic diagram showing display of a picture to be displayed on a webpage and a corresponding initial cropping frame according to Embodiment 2 of the present invention
  • 4C is a schematic diagram of displaying a picture to be displayed on a webpage, a corresponding initial cropping frame, and a face recognition area according to Embodiment 2 of the present invention
  • 4D is a schematic diagram showing display of a picture to be displayed on a webpage, a corresponding adjusted cropping frame, and a face recognition area according to Embodiment 2 of the present invention
  • FIG. 5 is a schematic structural diagram of a picture cropping apparatus based on face recognition according to Embodiment 3 of the present invention.
  • FIG. 1 is a schematic flowchart of a method for cropping a picture based on face recognition according to Embodiment 1 of the present invention.
  • This embodiment is applicable to the case where the picture is cropped when the picture size is large, and is particularly suitable for cutting the pictures when the size of each picture to be displayed in the search result page or the product browsing page is not uniform and large.
  • the method can be performed by a face recognition based picture cropping device implemented by software and/or hardware that can be built into an electronic device such as a smartphone, tablet, laptop, desktop or personal digital assistant.
  • a method for cropping a picture based on face recognition specifically includes the following operations:
  • Operation 110 performing face recognition on the picture.
  • the picture may be a set or user-entered picture to be cropped.
  • the face recognition process can detect the face by measuring the distance between the eyes, the cheekbones, the chin, etc. by using 80 nodes or punctuation distributed from the low to the high on the human face.
  • the face recognition algorithm includes, but is not limited to, a template matching method, a singular value feature method, a subspace analysis method, a partial hold projection, or a principal component analysis method.
  • performing face recognition on the image may include: training a facial feature model according to the preset corpus data, wherein the corpus data is a facial feature of a plurality of people; The face feature model detects the faces contained in the picture.
  • Operation 120 If a face is recognized, the picture is cropped according to the face recognition result and the target crop size.
  • the number, position and area of the face included in the picture may be further determined according to the face recognition result, and then according to the number, position and area of the face, and the target clipping size. , crop the image. Specifically, the position of the cropping frame is determined according to the number, position and area of the face included in the image, and the size of the cropping, and the target cropping size is used as the size of the cropping frame, and finally according to the determined cropping frame pair.
  • the picture is cropped. Need to explain In the embodiment of the present invention, the position of the crop frame refers to the position of the crop frame corresponding to the picture.
  • the face area is the area of the face contour area determined when the face is recognized for the picture.
  • the contour area may be an irregular shape area that can surround the facial features of the face, or other regular shape areas such as a circle or a rectangle that can surround the facial features of the face.
  • determining the area of the face included in the picture may specifically include: determining a minimum rectangular area that can surround the facial features of the face; calculating an area of the rectangular area, and using the calculation result as the area of the face.
  • the target crop size (ie, the size of the crop frame) may be set in advance, or may be determined in real time according to the size of the set standard picture and the original size of the picture.
  • the size of the standard picture can determine the size of the picture to be cropped, so that the size of the cropped picture is consistent with the size of the standard picture, or the size of the cropped picture after equal compression is compared with the standard picture.
  • the dimensions are the same.
  • This embodiment can be described in terms of width * height.
  • the size of the set standard picture is 80*100
  • the original size of the picture is 100*120.
  • the target cut size can be 96*120, 88*110 or 84*105.
  • the ratio of the size of the set standard picture to the target cut size is 0.8.
  • the position of the crop frame when the position of the crop frame is determined according to the number, position and area of the face included in the picture and the target crop size, the position of the crop frame may be positioned: the crop frame satisfies the target crop size.
  • the position of all faces in the picture can be delimited, or the position of the face with the largest area in the picture can be delimited, or the position of some people in the picture can be delineated while the faces of other people are not truncated.
  • the position of the crop frame can also be determined by other means, such as setting the position of the crop frame to be at the center of the face with the largest area in the picture.
  • Operation 130 If the face is not recognized, the subject is distinctively recognized, and the picture is cropped according to the subject distinctive recognition result and the target crop size.
  • the subjective saliency identification refers to the recognition of the saliency features of the subject other than the face.
  • the main body can be tables, chairs, flowers, food or people.
  • the setting algorithm can be used to identify the subject significantly, for example, first, the LAB color space transformation is performed on the image; and the DCT (Discrete Cosine Transform) is performed on the image after the color space transformation.
  • the cosine transform is processed to remove the low-frequency components; the DCT processing result filtered by the low-frequency components is inversely transformed by DCT, and the retained subject region is obtained according to the inverse transform result, that is, the result of the subject significant recognition.
  • the position of the crop frame may be determined according to the subject significant recognition result and the target crop size, and the target crop size is used as the size of the crop frame, and finally the image is cropped according to the determined crop frame.
  • the process of determining the position of the cropping frame refer to the above process of determining the position of the cropping frame according to the face recognition result and the target cropping size, as long as the face in the above is replaced by the subject. I will not repeat them here.
  • the center position of the picture may be directly used as the position of the cropping frame.
  • the image is cropped according to the determined cropping frame, thereby obtaining a picture having the same size ratio as the standard image, and then the obtained cropped image is obtained.
  • the image is compressed in proportion to obtain a standard picture of uniform size suitable for web page display.
  • the size of the set standard picture is 80*100
  • the size of the picture to be cropped is 100*120
  • the size of the clipped picture is 96*120, so it is necessary to crop the picture pixels of 96*120 size.
  • the ratio of 96/86 is compressed to obtain a standard picture of 80*100 size.
  • the content of the picture is first identified, and then the picture is cropped according to the content recognition result.
  • the granularity of the subject's saliency recognition is relatively coarser than that of the face recognition. Therefore, when the content is recognized for the image, the face recognition scheme is first adopted, and the person exists in the unrecognized picture. In the case of the face, the subject is significantly recognized again.
  • the technical solution proposed in this embodiment can ensure that the size of the picture in the search result page or the product browsing page is kept neat, and the core information such as the key face, the head or the main object can be displayed as completely as possible without causing bad
  • the visual effect has greatly improved and helped the picture reading experience.
  • the embodiment can avoid displaying the indecent image.
  • FIG. 2 is a schematic diagram of display of a picture to be cropped according to Embodiment 1 of the present invention.
  • the picture to be cropped is a vertical picture (that is, a picture whose height is greater than the width), and the main character corresponds to the vertical rectangular area 210 in the vertical picture.
  • the picture is not first recognized by the face, only the main body is prominent. Sexual recognition, then only the body of the figure is a vertical rectangular area, and the core part of the body is not clear (ie The location of the face).
  • the face may be cropped off. If face recognition is performed on the picture first, the position of the face is determined, and then the position of the crop frame can be set at a position where the face can be circled, thereby ensuring the integrity of the face after cropping.
  • FIG. 3 is a schematic flowchart of a method for cropping a picture based on face recognition according to Embodiment 2 of the present invention.
  • the present embodiment preferably further optimizes the determining operation of the target cropping size and the determining operation of the cropping frame, so that the face and the subject in the cropped image are not truncated as much as possible. User's reading experience with pictures.
  • the face recognition based image cropping method includes:
  • Operation 310 determining, according to the size of the set standard picture and the original size of the picture, whether the cutting mode of the picture is horizontal cutting or vertical cutting;
  • Operation 320 Calculate, according to the determined cutting manner, a minimum length that needs to be cropped on a height or a width of the image, and determine a target cropping size of the image;
  • Operation 330 performing face recognition on the picture, determining whether the face is recognized, if the face is recognized, performing operations 340-360, otherwise performing operations 370-380;
  • Operation 340 determining the number, location, and area of the faces included in the picture
  • Operation 350 Locating the center position of the first crop frame according to the number, location and area of the face and the target crop size, to determine a crop frame, wherein the crop frame satisfies the following condition: the crop frame can circle all the faces in the image, first The center of the crop frame is the center of all faces in the picture;
  • the at least one second cropping frame center position is repositioned according to the number of faces, the position and the area, and the target cropping size to determine a cropping frame, wherein the cropping box satisfies the following condition: the cropping frame can be used to circle the image Some people's faces, and will not cut off the faces of the picture that are not delimited; continue to perform operation 390;
  • Operation 370 performing subject distinctive recognition on the image
  • Operation 380 Locating the center position of the crop frame according to the body area included in the subject saliency recognition result and the target crop size, and determining a crop frame, wherein the crop frame satisfies the following condition: the area enclosed by the crop frame in the picture and the body area The intersection area reaches the set threshold, and the center position of the crop frame is the center position of the intersection area; continue to perform operation 390;
  • Operation 390 cropping the picture according to the determined crop frame.
  • the above operations 310-320 for determining the target cropping size can minimize the cropped portion of the image, and ensure that the face or the body contained in the image is not truncated as much as possible when the image is cropped.
  • the process of determining the target crop size may be: determining whether the cropping mode of the image is horizontal cropping or vertical cropping according to the size of the set standard image and the original size of the image; calculating the image in accordance with the determined cropping mode The minimum length to be trimmed in height or width; the target crop size of the image is determined according to the calculated minimum length; wherein the target crop size ratio is the same as the standard image size ratio.
  • the width and height of the standard picture are W1 and H1, respectively, and the original width and height of the picture are W2 and H2, respectively.
  • the aspect ratio K1 (ie, W1/H1) of the standard picture and the original aspect ratio K2 of the picture (ie, W2/H2) may be first calculated;
  • K1>K2 it is judged to adopt the horizontal cropping mode, and the minimum length to be cropped on the original high H2 of the picture is: H2-W2/K1, and the target cropping size of the image is: the width W of the cropped image and the original The width W2 is the same, and the height H of the cropped picture is W2*H1/W1;
  • 4A is a schematic diagram showing display of a picture to be displayed on a webpage according to Embodiment 2 of the present invention.
  • 4B is a schematic diagram showing display of a picture to be displayed on a webpage and a corresponding initial cropping frame according to Embodiment 2 of the present invention.
  • 4C is a schematic diagram of display of a picture to be displayed on a webpage, a corresponding initial cropping frame, and a face recognition area according to Embodiment 2 of the present invention.
  • 4D is a schematic diagram showing display of a picture to be displayed on a webpage, a corresponding adjusted cropping frame, and a face recognition area according to Embodiment 2 of the present invention.
  • the target crop size ratio should be 121:75, as shown in the initial cropping frame 410 in FIG. 4B.
  • the initial crop frame 410 shows that the crop mode is landscape crop and the target crop size ratio is 121:75.
  • the area enclosed by the rectangular frame 420 shown in FIG. 4C is the recognized face area. After the face is recognized, the initial crop frame 410 is slid according to the face recognition result and the target crop size. It is possible to circle the position of the face region surrounded by the rectangular frame 420 as shown in FIG. 4D.
  • the technical solution provided in this embodiment detects the number, location, and area of the face by performing face recognition on the image content, and then determines a reasonable cropping position based on the detection result and the target cropping size, and crops the image to ensure the face. Integrity; if the image does not contain a human face, then the subject is significantly identified, and a reasonable cropping position is determined for the body area and the target cropping size included in the image, and the image is cropped to ensure the final image cropping effect.
  • Elegant if the image does not contain a human face, then the subject is significantly identified, and a reasonable cropping position is determined for the body area and the target cropping size included in the image, and the image is cropped to ensure the final image cropping effect.
  • the method further includes: if the determined number of the cropping frames is greater than one, filtering the determined cropping frame according to the setting rule; The center position of all the cropped frames filtered out is weighted to obtain the new crop frame center position to determine the new crop frame;
  • the setting rule includes at least one of: satisfying a first threshold that the distance between the center position and the top of the picture is less than or equal to a set; the number of faces that can be circled is greater than or equal to the set second threshold; and the person with the largest area can be delimited face.
  • the core information of the face with a larger area in the search result page or the product browsing page can be more fully displayed.
  • FIG. 5 is a schematic structural diagram of a picture cropping apparatus based on face recognition according to Embodiment 3 of the present invention. This embodiment is applicable to the case where the picture is cropped when the picture size is large, and is particularly applicable to an application scenario in which the picture size to be displayed in the web page is not uniform and the picture is cropped.
  • the specific structure of the device includes:
  • a face recognition module 510 configured to perform face recognition on a picture
  • the first cropping module 520 is configured to: if the face recognition module 510 recognizes a human face, crop the image according to the face recognition result and the target crop size;
  • the second cropping module 530 is configured to perform subject saliency recognition on the image if the face recognition module does not recognize the face, and crop the image according to the subject saliency recognition result and the target crop size.
  • the apparatus further includes a target crop size determining module 500 for using the first cropping module 520 or the second cropping module 530 before cropping the picture:
  • the target crop size ratio is the same as the size ratio of the standard picture.
  • the first cropping module 520 includes:
  • a face information determining sub-module 521 configured to determine a number, a location, and an area of a face included in the picture
  • the first picture cropping sub-module 522 is configured to crop the picture according to the number, location and area of the face, and the target clipping size.
  • the face information determining sub-module 521 is specifically configured to: determine a minimum rectangular area that can surround the facial features of the face; calculate an area of the rectangular area, and use the calculation result as the area of the face.
  • the first picture cropping submodule 522 includes:
  • the first cropping frame determining unit 5220 is configured to locate a first cropping frame center position according to the number, position and area of the human face, and the target cropping size, to determine a cropping frame; wherein the cropping frame satisfies the following conditions:
  • the cropping frame can circle all the faces in the picture;
  • the center position of the first crop frame is the center position of all faces in the picture;
  • the second cropping frame determining unit 5222 is configured to reposition the at least one second cropping frame center according to the number, position and area of the human face, and the target cropping size if the first cropping frame determining unit 4221 fails to locate Positioning to determine a cropping frame; wherein the cropping frame satisfies a condition that the cropping box is capable of delineating a face of a portion of the person in the picture, and does not intercept a face that is not delimited in the picture;
  • the picture cropping unit 5224 is configured to crop the picture according to the determined crop frame.
  • the first picture cropping sub-module 522 further includes a cropping frame filtering unit 5223, after the first cropping frame determining unit 5220 or the second cropping frame determining unit 5222 determines that the cropping frame is completed:
  • the determined cropping frame is filtered according to the setting rule; the center position of all the cropping frames that are filtered is weighted to obtain a new cropping frame center position, Determine a new crop box;
  • the setting rule includes at least one of the following:
  • the number of faces that can be delimited is greater than or equal to a set second threshold
  • the second cutting module 530 includes:
  • the main body saliency recognition unit 5300 is configured to perform subject saliency recognition on the picture if the face recognition module does not recognize the face;
  • the cropping frame determining unit 5302 is configured to: according to the body region included in the body saliency recognition result, and the target cropping size, locate the center of the cropping frame to determine a cropping frame; wherein the cropping frame satisfies the following condition: the cropping frame The area of the intersection area of the area enclosed in the picture and the body area reaches a set threshold; the center position of the crop frame is the center position of the intersection area;
  • the picture cropping unit 5304 is configured to crop the picture according to the determined crop frame.
  • the above product can perform the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
  • An embodiment of the present invention further provides a face clipping device based on face recognition, the device comprising: one or more processors, a memory, and one or more programs; the one or more programs are stored in the memory When executed by the one or more processors:
  • the picture is cropped according to the face recognition result and the target crop size
  • the subject is subjected to subject distinctive recognition, and the picture is cropped according to the subject significant recognition result and the target crop size.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
  • Embodiments of the present invention also provide one or more storage media including computer executable instructions,
  • the computer executable instructions when executed by a computer processor, are for performing a face recognition based image cropping method, the method comprising the steps of: performing face recognition on the image; and if the face is recognized, based on the face recognition result And correcting the picture with the target clipping size; if the face is not recognized, the subject is subjected to subject distinctive recognition, and the picture is cropped according to the subject significant recognition result and the target crop size.
  • the method may specifically include a face recognition based image cropping method applied to a face recognition based image cropping device provided by any embodiment of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Library & Information Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明公开了一种基于人脸识别的图片裁剪方法、装置、设备和存储介质。该方法包括:对图片进行人脸识别;如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;如果未识别到人脸,对所述图片进行主体显著性识别,以及根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。本发明实施例的技术方案,能够提高图片的裁剪效果,克服现有技术中因不对图片进行内容识别或识别算法不当所引起的图片裁剪效果不佳的弊端,提升用户对网页图片的阅读体验。

Description

基于人脸识别的图片裁剪方法、装置、设备和存储介质
本专利申请要求于2014年04月09日提交的,申请号为201410140768.9,申请人为百度在线网络技术(北京)有限公司,发明名称为“基于人脸识别的图片裁剪方法及装置”的中国专利申请的优先权,该申请的全文以引用的方式并入本申请中。
技术领域
本发明实施例涉及图像处理技术领域,尤其涉及基于人脸识别的图片裁剪方法、装置、设备和存储介质。
背景技术
在网页(例如搜索结果页或产品浏览页)中***图片,以图文并茂的方式为用户展示网页资源,体现了互联网读图时代的产品发展趋势。
考虑到网页中待显示的各图片,其形状和大小通常会有所差异,如果不对这些图片经过尺寸处理而直接进行显示,会使得整个网页看上去特别杂乱,影响用户的阅读体验,有时甚至会带来十分恶劣的视觉效果。因此,为了使得网页中的各图片在展现样式上保持统一,需要对图片进行合理的裁剪,这样才能发挥出最佳的展现体验效果。
目前,传统的图片裁剪技术通常是:对于高度大于宽度的图而言,裁剪掉该图的底部部分;对于宽度大于高度的图而言,裁剪掉该图的两侧部分,或者裁剪图片,以保留图片的中心部分。但是,这些传统的裁剪方式经常会导致图片中的主体部分被截断,从而使得网页中所呈现的图片看上去很不雅观。为此,现有技术提出了一种图片裁剪技术,该技术是首先对图片进行主体识别,然后根据主体所在位置进行图片剪裁。但是主体识别的算法复杂,主体识别的精度也不是很高,且有时候图片中主体所在位置与人物位置并不匹配,因此裁剪效果依然不佳。
发明内容
本发明实施例提供基于人脸识别的图片裁剪方法、装置、设备和存储介质,以改善图片的裁剪效果,克服现有技术中因不对图片进行内容识别或识别算法不当所引起的图片裁剪效果不佳的弊端,提升用户对网页中的图片的阅读体验。
第一方面,本发明实施例提供了一种基于人脸识别的图片裁剪方法,该方法包括:
对图片进行人脸识别;
如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
第二方面,本发明实施例还提供了一种基于人脸识别的图片裁剪装置,该装置包括:
人脸识别模块,用于对图片进行人脸识别;
第一裁剪模块,用于如果所述人脸识别模块识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
第二裁剪模块,用于如果所述人脸识别模块未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
第三方面,本发明实施例还提供一种基于人脸识别的图片裁剪设备,包括:一个或者多个处理器,存储器,以及一个或者多个程序;所述一个或者多个程序存储在所述存储器中,当被所述一个或者多个处理器执行时:
对图片进行人脸识别;
如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
第四方面,本发明实施例还提供一个或多个包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种基于人脸识别的图片裁剪方法,所述方法包括以下步骤:
对图片进行人脸识别;
如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
本发明实施例提出的技术方案,首先对图片进行人脸识别,在未识别到人脸的情况下进行主体识别,然后根据人脸或主体识别结果进行图片裁剪,这样可以保证在搜索结果页或产品浏览页中的图片尺寸保持齐整,并且关键的人脸、人头或主要物体等核心信息能够尽量得以完整的展示,不会带来恶劣的视觉效果,对图片的阅读体验有很大提升和帮助。相比现有技术中不对图片进行内容识别或识别算法不当的图片裁剪方案,本发明实施例更能避免展示不雅的图片。
附图说明
图1是本发明实施例一提供的一种基于人脸识别的图片裁剪方法的流程示意图;
图2是本发明实施例一提供的一种待裁剪图片的显示示意图;
图3是本发明实施例二提供的一种基于人脸识别的图片裁剪方法的流程示意图;
图4A是本发明实施例二提供的一种网页上待展示图片的显示示意图;
图4B是本发明实施例二提供的一种网页上待展示图片以及对应的初始裁剪框的显示示意图;
图4C是本发明实施例二提供的一种网页上待展示图片、对应的初始裁剪框以及人脸识别区域的显示示意图;
图4D是本发明实施例二提供的一种网页上待展示图片、对应的调整后的裁剪框以及人脸识别区域的显示示意图;
图5为本发明实施例三提供的一种基于人脸识别的图片裁剪装置的结构示意图。
具体实施方式
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。
实施例一
图1是本发明实施例一提供的一种基于人脸识别的图片裁剪方法的流程示意图。本实施例可适用于图片尺寸较大时对图片进行裁剪的情况,特别是适用于当搜索结果页或产品浏览页中待显示的各图片尺寸不统一且较大时,对这些图片进行裁剪这样一个应用场景。该方法可以由基于人脸识别的图片裁剪装置来执行,所述装置由软件和/或硬件实现,可内置在智能手机、平板电脑、笔记本电脑、台式电脑或个人数字助理等电子设备中。参见图1,基于人脸识别的图片裁剪方法具体包括如下操作:
操作110、对图片进行人脸识别。
在本实施例中,图片可以是设定的或用户输入的待裁剪图片。人脸识别过程可利用分布在人脸上从低到高80个节点或标点,通过测量眼睛、颧骨、下巴等之间的间距来进行人脸的检测。其中,人脸识别算法包括但不限于是:基于模板匹配的方法、基于奇异值特征方法、子空间分析法、局部保持投影或主成分分析法等。在本实施例的一个具体的实施方式中,对图片进行人脸识别可具体包括:根据预先设定的语料数据训练得到人脸特征模型,其中该语料数据为大量人的脸部特征;根据得到的人脸特征模型检测图片中所包含的人脸。
操作120、如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对图片进行裁剪。
在识别到图片中存在人脸的情况下,可首先根据人脸识别结果进一步确定图片中所包含的人脸的数目、位置和面积,然后根据人脸的数目、位置和面积,以及目标剪裁尺寸,对图片进行裁剪。具体的,可根据图片中所包含的人脸的数目、位置和面积,以及标剪裁尺寸,来确定裁剪框的位置,并将目标剪裁尺寸作为裁剪框的尺寸,最后根据所确定的裁剪框对图片进行裁剪。需要说明的 是,在本发明实施例中,裁剪框的位置均指的是裁剪框对应于图片中的位置。
其中,人脸面积为在对图片进行人脸识别时所确定的人脸轮廓区域的面积。该轮廓区域可以是能包围人脸五官的不规则形状区域,或者是其他能包围人脸五官的圆形、矩形等规则形状区域。优选的,确定图片中所包含的人脸的面积,可具体包括:确定能包围人脸五官的最小矩形区域;计算矩形区域的面积,将计算结果作为人脸的面积。
目标剪裁尺寸(即裁剪框的尺寸)可以是预先被设定好的,也可是根据设定的标准图片的尺寸和图片的原始尺寸实时确定的。其中,标准图片的尺寸能够确定要将图片裁剪成何种尺寸,以使得裁剪后的图片的尺寸与标准图片的尺寸是一致的,或者裁剪后的图片经过等比压缩之后的尺寸与标准图片的尺寸一致。本实施例可采用宽*高来描述尺寸。例如,设定的标准图片的尺寸为80*100,图片的原始尺寸为100*120,此时目标剪裁尺寸可为96*120、88*110或者84*105。显然,设定的标准图片的尺寸比例与目标剪裁尺寸比例均为0.8。
在本实施例中,在根据图片中所包含的人脸的数目、位置和面积以及目标剪裁尺寸来确定裁剪框的位置时,可以将裁剪框的位置定位于:在裁剪框满足目标裁剪尺寸的前提下,能够圈定图片中所有人脸时的位置,或者能够圈定图片中面积最大的人脸时的位置,或者能够圈定图片中部分人的人脸而其他人的人脸不被截断时的位置。当然,还可通过其它方式来确定裁剪框的位置,例如将裁剪框的位置定为在图片中面积最大的人脸的中心位置处。
操作130、如果未识别到人脸,对图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对图片进行裁剪。
其中,主体显著性识别指的是对除人脸之外的主体的显著性特征进行的识别。主体可以是桌椅、鲜花、食品或者人物等。在未识别到人脸的情况下,可采用设定算法对图片进行主体显著性识别,例如:首先对图片进行LAB色彩空间变换;通过对经过色彩空间变换后的图片进行DCT(Discrete CosineTransform,离散余弦变换)处理,去掉其中的低频成分;将经过低频成分过滤后的DCT处理结果进行DCT反变换,从而根据反变换结果得到所保留的主体区域,也就是主体显著性识别的结果。
在得到主体显著性识别结果之后,可根据主体显著性识别结果和目标裁剪尺寸来确定裁剪框的位置,并将目标剪裁尺寸作为裁剪框的尺寸,最后根据所确定的裁剪框对图片进行裁剪。其中,确定裁剪框的位置过程可参见上述根据人脸识别结果和目标裁剪尺寸来确定裁剪框的位置过程,只要将上述中的人脸替换为主体即可。在此不再赘述。
优选的,在根据图片中所包含的人脸或主体的数目、位置和面积以及目标剪裁尺寸,来确定裁剪框的位置失败时,可直接将图片的中心位置作为裁剪框的位置。
在确定了裁剪框的尺寸和位置之后,也即确定了裁剪框之后,根据所确定的裁剪框对图片进行裁剪,从而得到与标准图片的尺寸比例相同的图片,之后再对所得到的裁剪后的图片进行等比压缩便可得到适合网页显示的、尺寸统一的标准图片。例如,设定的标准图片的尺寸为80*100,待裁剪的图片的尺寸为100*120,剪裁后的图片的尺寸为96*120,故需对裁剪后的96*120尺寸的图片像素以96/86的比例进行压缩,以得到80*100尺寸的标准图片。
本实施例为保证图片裁剪后的显示效果,首先对图片的内容进行了识别,之后根据内容识别结果对图片进行裁剪。具体的,因为主体具有随机性,故主体显著性识别的粒度相对于人脸识别粒度较粗,故在对图片进行内容识别时,首先采用了人脸识别方案,在未识别到图片中存在人脸的情况下,再对图片进行主体性显著识别。
本实施例提出的技术方案,可以保证在搜索结果页或产品浏览页中的图片尺寸保持齐整,并且关键的人脸、人头或主要物体等核心信息能够尽量得以完整的展示,不会带来恶劣的视觉效果,对图片阅读体验有很大提升和帮助。相比现有技术中未对图片进行内容识别或识别算法不当的图片裁剪方案,本实施例更能避免展示不雅的图片。
图2是本发明实施例一提供的一种待裁剪图片的显示示意图。参见图2,待裁剪图片是一个竖图(即为高大于宽的图片),主体人物对应竖图中的竖直矩形区域210,如果不先对图片进行人脸识别,而是只做主体显著性识别,那么只能得出该图的主体是一个竖直矩形区域,并不清楚这个主体中核心的部分(即 人脸)的位置。如果要将该竖图裁剪成正方形时可能会将人脸裁剪掉。如果先对图片做人脸识别,确定出人脸的位置,然后可以将裁剪框的位置设定在能够圈定人脸的位置处,这样可以保证裁剪后人脸的完整性。
实施例二
图3是本发明实施例二提供的一种基于人脸识别的图片裁剪方法的流程示意图。本实施例在上述各实施例的基础上,优选地是对目标裁剪尺寸的确定操作以及裁剪框的确定操作做进一步优化,以使得裁剪后的图片中的人脸和主体尽量不被截断,提升用户对图片的阅读体验。参见图3,该基于人脸识别的图片裁剪方法包括:
操作310、根据设定的标准图片的尺寸和图片的原始尺寸,确定图片的裁剪方式是横向裁剪还是竖向裁剪;
操作320、根据所确定的裁剪方式,计算在图片的高或宽上需裁剪掉的最小长度,确定图片的目标裁剪尺寸;
操作330、对图片进行人脸识别,判断是否识别到人脸,如果识别到人脸,执行操作340-360,否则执行操作370-380;
操作340、确定图片中所包含的人脸的数目、位置和面积;
操作350、根据人脸的数目、位置和面积以及目标裁剪尺寸,定位第一裁剪框中心位置,以确定裁剪框,其中裁剪框满足如下条件:裁剪框能够圈定图片中的所有人脸,第一裁剪框中心位置为图片中所有人脸的中心位置;
操作360、如果定位失败,则根据人脸的数目、位置和面积以及目标裁剪尺寸,重新定位至少一个第二裁剪框中心位置以确定裁剪框,其中裁剪框满足如下条件:裁剪框能够圈定图片中部分人的人脸,并且不会截断图片中未被圈定的人脸;继续执行操作390;
操作370、对图片进行主体显著性识别;
操作380、根据主体显著性识别结果所包含的主体区域以及目标裁剪尺寸,定位裁剪框中心位置以确定裁剪框,其中裁剪框满足如下条件:裁剪框在图片中所圈住的区域与主体区域的相交区域面积达到设定的阈值,裁剪框中心位置为相交区域的中心位置;继续执行操作390;
操作390、根据所确定的裁剪框对图片进行裁剪。
上述对目标裁剪尺寸进行确定的操作310-320,能够使得图片中被裁剪掉的部分最少,保证裁剪图片时图片中所包含的人脸或主体尽量不被截断。具体的,确定目标剪裁尺寸的过程可为:根据设定的标准图片的尺寸和图片的原始尺寸,确定图片的裁剪方式是横向裁剪还是竖向裁剪;根据所确定的裁剪方式,计算在图片的高或宽上需裁剪掉的最小长度;根据所计算出的最小长度确定图片的目标裁剪尺寸;其中,目标裁剪尺寸比例和标准图片的尺寸比例相同。
例如,设标准图片的宽高分别为W1和H1,图片的原始宽高分别为W2和H2。在确定目标剪裁尺寸时,可首先计算标准图片的宽高比值K1(即W1/H1)和图片的原始宽高比值K2(即W2/H2);
如果K1>K2,则判断采用横向裁剪方式,计算在图片的原始高H2上需裁剪掉的最小长度为:H2-W2/K1,图片的目标裁剪尺寸为:裁剪后的图片的宽W与原始宽W2相同,裁剪后的图片的高H为W2*H1/W1;
如果K1<K2,则判断采用竖向裁剪方式,计算在图片的宽W2上需裁剪掉的最小长度为:W2-H2*K1,图片的目标裁剪尺寸为:裁剪后的图片的宽W为H2*W1/H1,裁剪后的图片的高H与原始高H2相同。
为更加清楚的阐述本实施例提出的基于人脸识别的图片裁剪方法,现进行举例说明。
图4A是本发明实施例二提供的一种网页上待展示图片的显示示意图。图4B是本发明实施例二提供的一种网页上待展示图片以及对应的初始裁剪框的显示示意图。图4C是本发明实施例二提供的一种网页上待展示图片、对应的初始裁剪框以及人脸识别区域的显示示意图。图4D是本发明实施例二提供的一种网页上待展示图片、对应的调整后的裁剪框以及人脸识别区域的显示示意图。
参见图4A、图4B、图4C和图4D,由于网页上待展示的标准图片的尺寸是121*75,所以目标裁剪尺寸比例应为121∶75,如图4B中所示的初始裁剪框410,该初始裁剪框410示出了裁剪方式为横向裁剪,且目标裁剪尺寸比例为121∶75。图4C中所示的矩形框420所包围的区域为所识别出的人脸区域。在识别到人脸之后,根据人脸识别结果以及目标裁剪尺寸,将初始裁剪框410滑动 至能够圈定矩形框420所包围的人脸区域的位置,如图4D中所示。
本实施例提供的技术方案,通过对图片内容进行人脸识别,检测出人脸的数目、位置和面积,再基于检测结果和目标裁剪尺寸确定合理的裁剪位置,对图片进行裁剪,以保证人脸的完整性;如果图片中不包含人脸,那么再对图片进行主体显著性识别,并针对图片所包含的主体区域和目标裁剪尺寸确定合理的裁剪位置,进行图片裁剪,以保证最终图片裁剪效果的雅观。
在上述技术方案的基础上,在识别到人脸的情况下确定完毕裁剪框之后,还包括:若所确定的裁剪框数量大于一,则根据设定规则对所确定的裁剪框进行筛选;将筛选出的所有裁剪框的中心位置进行加权得到新的裁剪框中心位置,以确定新的裁剪框;
其中,设定规则包括下述至少一个:满足中心位置与图片顶部的距离小于等于设定的第一阈值;能够圈定的人脸个数大于等于设定的第二阈值;能够圈定面积最大的人脸。
这样,使得后续根据所确定的新的裁剪框对图片进行裁剪操作之后,更能保证搜索结果页或产品浏览页上图片中面积较大的人脸这一核心信息尽量得以完整的展示。
实施例三
图5为本发明实施例三提供的一种基于人脸识别的图片裁剪装置的结构示意图。本实施例可适用于图片尺寸较大时对图片进行裁剪的情况,特别是适用于当网页中待显示的各图片尺寸不统一且较大时对图片进行裁剪这样一个应用场景。参见图5,该装置的具体结构包括:
人脸识别模块510,用于对图片进行人脸识别;
第一裁剪模块520,用于如果人脸识别模块510识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
第二裁剪模块530,用于如果人脸识别模块未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
进一步的,该装置还包括目标裁剪尺寸确定模块500,用于在第一裁剪模块 520或第二裁剪模块530对所述图片进行裁剪之前:
根据设定的标准图片的尺寸和所述图片的原始尺寸,确定所述图片的裁剪方式是横向裁剪还是竖向裁剪;
根据所确定的裁剪方式,计算在所述图片的高或宽上需裁剪掉的最小长度;
根据所计算出的最小长度确定所述图片的目标裁剪尺寸;
其中,所述目标裁剪尺寸比例和所述标准图片的尺寸比例相同。
进一步的,第一裁剪模块520,包括:
人脸信息确定子模块521,用于确定所述图片中所包含的人脸的数目、位置和面积;
第一图片裁剪子模块522,用于根据所述人脸的数目、位置和面积,以及目标剪裁尺寸,对所述图片进行裁剪。
进一步的,人脸信息确定子模块521,具体用于:确定能包围人脸五官的最小矩形区域;计算所述矩形区域的面积,将计算结果作为人脸的面积。
进一步的,第一图片裁剪子模块522,包括:
第一裁剪框确定单元5220,用于根据所述人脸的数目、位置和面积,以及所述目标裁剪尺寸,定位第一裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中的所有人脸;所述第一裁剪框中心位置为所述图片中所有人脸的中心位置;
第二裁剪框确定单元5222,用于如果第一裁剪框确定单元4221定位失败,则根据所述人脸的数目、位置和面积,以及所述目标裁剪尺寸,重新定位至少一个第二裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中部分人的人脸,并且不会截断所述图片中未被圈定的人脸;
图片裁剪单元5224,用于根据所确定的裁剪框对所述图片进行裁剪。
进一步的,第一图片裁剪子模块522还包括裁剪框筛选单元5223,用于在第一裁剪框确定单元5220或第二裁剪框确定单元5222确定完毕裁剪框之后:
若所确定的裁剪框数量大于一,则根据设定规则对所确定的裁剪框进行筛选;将筛选出的所有裁剪框的中心位置进行加权得到新的裁剪框中心位置,以 确定新的裁剪框;
其中,所述设定规则包括下述至少一个:
满足中心位置与所述图片顶部的距离小于等于设定的第一阈值;
能够圈定的人脸个数大于等于设定的第二阈值;
能够圈定面积最大的人脸。
进一步的,第二裁剪模块530,包括:
主体显著性识别单元5300,用于如果所述人脸识别模块未识别到人脸,对所述图片进行主体显著性识别;
裁剪框确定单元5302,用于根据主体显著性识别结果所包含的主体区域,以及所述目标裁剪尺寸,定位裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框在所述图片中所圈住的区域与所述主体区域的相交区域面积达到设定的阈值;所述裁剪框中心位置为所述相交区域的中心位置;
图片裁剪单元5304,用于根据所确定的裁剪框对所述图片进行裁剪。
上述产品可执行本发明任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。
本发明实施例还提供一种基于人脸识别的图片裁剪设备,该设备包括:一个或者多个处理器,存储器,以及一个或者多个程序;所述一个或者多个程序存储在所述存储器中,当被所述一个或者多个处理器执行时:
对图片进行人脸识别;
如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
本发明实施例还提供一个或多个包含计算机可执行指令的存储介质,所述 计算机可执行指令在由计算机处理器执行时用于执行一种基于人脸识别的图片裁剪方法,所述方法包括以下步骤:对图片进行人脸识别;如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
该方法可以具体包括本发明任意实施例所提供的应用于基于人脸识别的图片裁剪装置上的基于人脸识别的图片裁剪方法。
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。

Claims (16)

  1. 一种基于人脸识别的图片裁剪方法,其特征在于,包括:
    对图片进行人脸识别;
    如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
    如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
  2. 根据权利要求1所述的基于人脸识别的图片裁剪方法,其特征在于,在对所述图片进行裁剪之前,还包括:
    根据设定的标准图片的尺寸和所述图片的原始尺寸,确定所述图片的裁剪方式是横向裁剪还是竖向裁剪;
    根据所确定的裁剪方式,计算在所述图片的高或宽上需裁剪掉的最小长度;
    根据所计算出的最小长度确定所述图片的目标裁剪尺寸;
    其中,所述目标裁剪尺寸比例和所述标准图片的尺寸比例相同。
  3. 根据权利要求1或2所述的基于人脸识别的图片裁剪方法,其特征在于,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪包括:
    确定所述图片中所包含的人脸的数目、位置和面积;
    根据所述人脸的数目、位置和面积,以及目标剪裁尺寸,对所述图片进行裁剪。
  4. 根据权利要求3所述的基于人脸识别的图片裁剪方法,其特征在于,确定所述图片中所包含的人脸的面积,包括:确定能包围人脸五官的最小矩形区域;计算所述矩形区域的面积,将计算结果作为人脸的面积。
  5. 根据权利要求3或4所述的基于人脸识别的图片裁剪方法,其特征在于,根据所述人脸的数目、位置和面积,以及目标裁剪尺寸,对所述图片进行裁剪,包括:
    根据所述人脸的数目、位置和面积,以及所述目标裁剪尺寸,定位第一裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中的所有人脸;所述第一裁剪框中心位置为所述图片中所有人脸的中心位置;
    如果定位失败,则根据所述人脸的数目、位置和面积,以及所述目标裁剪 尺寸,重新定位至少一个第二裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中部分人的人脸,并且不会截断所述图片中未被圈定的人脸;
    根据所确定的裁剪框对所述图片进行裁剪。
  6. 根据权利要求5所述的基于人脸识别的图片裁剪方法,其特征在于,在确定完毕裁剪框之后,还包括:若所确定的裁剪框数量大于一,则根据设定规则对所确定的裁剪框进行筛选;将筛选出的所有裁剪框的中心位置进行加权得到新的裁剪框中心位置,以确定新的裁剪框;
    其中,所述设定规则包括下述至少一个:
    满足中心位置与所述图片顶部的距离小于等于设定的第一阈值;
    能够圈定的人脸个数大于等于设定的第二阈值;
    能够圈定面积最大的人脸。
  7. 根据权利要求1-6中任一项所述的基于人脸识别的图片裁剪方法,其特征在于,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪,包括:
    根据主体显著性识别结果所包含的主体区域,以及所述目标裁剪尺寸,定位裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框在所述图片中所圈住的区域与所述主体区域的相交区域面积达到设定的阈值;所述裁剪框中心位置为所述相交区域的中心位置;
    根据所确定的裁剪框对所述图片进行裁剪。
  8. 一种基于人脸识别的图片裁剪装置,其特征在于,包括:
    人脸识别模块,用于对图片进行人脸识别;
    第一裁剪模块,用于如果所述人脸识别模块识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
    第二裁剪模块,用于如果所述人脸识别模块未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
  9. 根据权利要求8所述的基于人脸识别的图片裁剪装置,其特征在于,还包括目标裁剪尺寸确定模块,用于在所述第一裁剪模块或第二裁剪模块对所述 图片进行裁剪之前:
    根据设定的标准图片的尺寸和所述图片的原始尺寸,确定所述图片的裁剪方式是横向裁剪还是竖向裁剪;
    根据所确定的裁剪方式,计算在所述图片的高或宽上需裁剪掉的最小长度;
    根据所计算出的最小长度确定所述图片的目标裁剪尺寸;
    其中,所述目标裁剪尺寸比例和所述标准图片的尺寸比例相同。
  10. 根据权利要求8或9所述的基于人脸识别的图片裁剪装置,其特征在于,所述第一裁剪模块,包括:
    人脸信息确定子模块,用于确定所述图片中所包含的人脸的数目、位置和面积;
    第一图片裁剪子模块,用于根据所述人脸的数目、位置和面积,以及目标剪裁尺寸,对所述图片进行裁剪。
  11. 根据权利要求10所述的基于人脸识别的图片裁剪装置,其特征在于,所述人脸信息确定子模块,具体用于:确定能包围人脸五官的最小矩形区域;计算所述矩形区域的面积,将计算结果作为人脸的面积。
  12. 根据权利要求10或11所述的基于人脸识别的图片裁剪装置,其特征在于,所述第一图片裁剪子模块,包括:
    第一裁剪框确定单元,用于根据所述人脸的数目、位置和面积,以及所述目标裁剪尺寸,定位第一裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中的所有人脸;所述第一裁剪框中心位置为所述图片中所有人脸的中心位置;
    第二裁剪框确定单元,用于如果所述第一裁剪框确定单元定位失败,则根据所述人脸的数目、位置和面积,以及所述目标裁剪尺寸,重新定位至少一个第二裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框能够圈定所述图片中部分人的人脸,并且不会截断所述图片中未被圈定的人脸;
    图片裁剪单元,用于根据所确定的裁剪框对所述图片进行裁剪。
  13. 根据权利要求12所述的基于人脸识别的图片裁剪装置,其特征在于, 所述第一图片裁剪子模块还包括裁剪框筛选单元,用于在所述第一裁剪框确定单元或第二裁剪框确定单元确定完毕裁剪框之后:
    若所确定的裁剪框数量大于一,则根据设定规则对所确定的裁剪框进行筛选;将筛选出的所有裁剪框的中心位置进行加权得到新的裁剪框中心位置,以确定新的裁剪框;
    其中,所述设定规则包括下述至少一个:
    满足中心位置与所述图片顶部的距离小于等于设定的第一阈值;
    能够圈定的人脸个数大于等于设定的第二阈值;
    能够圈定面积最大的人脸。
  14. 根据权利要求8-13中任一项所述的基于人脸识别的图片裁剪装置,其特征在于,所述第二裁剪模块,包括:
    主体显著性识别单元,用于如果所述人脸识别模块未识别到人脸,对所述图片进行主体显著性识别;
    裁剪框确定单元,用于根据主体显著性识别结果所包含的主体区域,以及所述目标裁剪尺寸,定位裁剪框中心位置以确定裁剪框;其中所述裁剪框满足如下条件:所述裁剪框在所述图片中所圈住的区域与所述主体区域的相交区域面积达到设定的阈值;所述裁剪框中心位置为所述相交区域的中心位置;
    图片裁剪单元,用于根据所确定的裁剪框对所述图片进行裁剪。
  15. 一种基于人脸识别的图片裁剪设备,其特征在于,包括:一个或者多个处理器,存储器,以及一个或者多个程序;所述一个或者多个程序存储在所述存储器中,当被所述一个或者多个处理器执行时:
    对图片进行人脸识别;
    如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
    如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
  16. 一个或多个包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种基于人脸识别的图片裁剪方法,其特征在于,所述方法包括以下步骤:
    对图片进行人脸识别;
    如果识别到人脸,根据人脸识别结果和目标剪裁尺寸对所述图片进行裁剪;
    如果未识别到人脸,对所述图片进行主体显著性识别,根据主体显著性识别结果和目标裁剪尺寸对所述图片进行裁剪。
PCT/CN2014/094231 2014-04-09 2014-12-18 基于人脸识别的图片裁剪方法、装置、设备和存储介质 WO2015154516A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410140768.9A CN103914689B (zh) 2014-04-09 2014-04-09 基于人脸识别的图片裁剪方法及装置
CN201410140768.9 2014-04-09

Publications (1)

Publication Number Publication Date
WO2015154516A1 true WO2015154516A1 (zh) 2015-10-15

Family

ID=51040358

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/094231 WO2015154516A1 (zh) 2014-04-09 2014-12-18 基于人脸识别的图片裁剪方法、装置、设备和存储介质

Country Status (2)

Country Link
CN (1) CN103914689B (zh)
WO (1) WO2015154516A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647590A (zh) * 2018-04-25 2018-10-12 董志忠 一种智能头像处理算法
CN110264396A (zh) * 2019-06-27 2019-09-20 杨骥 视频人脸替换方法、***及计算机可读存储介质
CN110807361A (zh) * 2019-09-19 2020-02-18 腾讯科技(深圳)有限公司 人体识别方法、装置、计算机设备及存储介质
CN111243061A (zh) * 2020-01-21 2020-06-05 苏宁云计算有限公司 一种商品图片的生成方法、装置、***
CN111524145A (zh) * 2020-04-13 2020-08-11 北京智慧章鱼科技有限公司 图片智能裁剪方法、***、计算机设备及存储介质
CN111652015A (zh) * 2019-03-27 2020-09-11 上海铼锶信息技术有限公司 一种对图片中关键人脸进行选择的方法和***
CN113095119A (zh) * 2020-01-09 2021-07-09 北京君正集成电路股份有限公司 一种修正人脸裁剪框的人脸识别***
CN114359301A (zh) * 2020-09-29 2022-04-15 合肥君正科技有限公司 一种自适应扩展系数的人脸裁剪优化方法
CN116543004A (zh) * 2023-07-05 2023-08-04 荣耀终端有限公司 图像裁切方法、装置、终端设备及计算机可读存储介质

Families Citing this family (57)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914689B (zh) * 2014-04-09 2017-03-15 百度在线网络技术(北京)有限公司 基于人脸识别的图片裁剪方法及装置
CN105335925A (zh) * 2014-07-30 2016-02-17 北京畅游天下网络技术有限公司 一种图片的裁剪方法和浏览器装置
CN104392202A (zh) * 2014-10-11 2015-03-04 北京中搜网络技术股份有限公司 一种基于图片识别的自动裁剪方法
CN104952027A (zh) * 2014-10-11 2015-09-30 腾讯科技(北京)有限公司 一种包含人脸信息的图片剪裁方法及装置
CN104360854B (zh) * 2014-11-03 2018-08-10 联想(北京)有限公司 一种信息处理方法及电子设备
CN104484853A (zh) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 对包含图形标志的图片进行裁剪的方法和装置
CN104484855B (zh) * 2014-12-24 2018-03-27 北京奇虎科技有限公司 图片裁剪的方法和装置
WO2016101767A1 (zh) * 2014-12-24 2016-06-30 北京奇虎科技有限公司 图片裁剪的方法和装置以及图片检测方法和装置
CN104484854A (zh) * 2014-12-24 2015-04-01 北京奇虎科技有限公司 人物图片裁剪方法和装置
CN104504649A (zh) * 2014-12-30 2015-04-08 百度在线网络技术(北京)有限公司 图片的裁剪方法和装置
CN105825243A (zh) * 2015-01-07 2016-08-03 阿里巴巴集团控股有限公司 证件图像检测方法及设备
WO2016179808A1 (en) * 2015-05-13 2016-11-17 Xiaoou Tang An apparatus and a method for face parts and face detection
CN104866565B (zh) * 2015-05-21 2019-03-12 百度在线网络技术(北京)有限公司 图片搜索方法及装置
CN106326823B (zh) * 2015-07-07 2020-06-30 北京神州泰岳软件股份有限公司 一种获取图片中头像的方法和***
CN105528786B (zh) * 2015-12-04 2019-10-01 小米科技有限责任公司 图像处理方法及装置
CN105469074A (zh) * 2015-12-23 2016-04-06 苏州汇莱斯信息科技有限公司 一种基于奇异值分解的人脸识别算法
CN106920141A (zh) * 2015-12-28 2017-07-04 阿里巴巴集团控股有限公司 页面展示内容处理方法及装置
CN105787869A (zh) * 2016-02-18 2016-07-20 王萌 一种人脸识别截图方法
CN105718439B (zh) * 2016-03-04 2018-10-26 广州微印信息科技有限公司 一种基于人脸识别的照片自动排版方法
CN105761205B (zh) * 2016-03-17 2018-12-11 网易有道信息技术(北京)有限公司 一种图片投放方法和装置
CN107437051A (zh) * 2016-05-26 2017-12-05 上海市公安局刑事侦查总队 图像处理方法及装置
CN106383707A (zh) * 2016-09-07 2017-02-08 努比亚技术有限公司 一种图片的显示方法及***
CN107009412B (zh) * 2017-04-12 2019-05-28 广东工业大学 一种证件照自动裁剪方法、装置以及***
CN107291342B (zh) * 2017-05-03 2020-01-31 广东小天才科技有限公司 一种点读数据的复制勾勒方法及装置
CN107240105A (zh) * 2017-06-05 2017-10-10 深圳市茁壮网络股份有限公司 一种图片剪裁方法及装置
CN107463914A (zh) * 2017-08-11 2017-12-12 环球智达科技(北京)有限公司 图像切割方法
CN107562877A (zh) * 2017-09-01 2018-01-09 北京搜狗科技发展有限公司 图像数据的显示方法、装置和用于图像数据显示的装置
WO2019071386A1 (zh) * 2017-10-09 2019-04-18 深圳传音通讯有限公司 一种图像数据处理方法及装置
CN109657526B (zh) * 2017-10-12 2020-12-01 飞狐信息技术(天津)有限公司 一种基于人脸识别的图片智能裁剪方法和***
CN108062755B (zh) * 2017-11-02 2020-10-02 广东数相智能科技有限公司 一种图片智能裁剪方法及装置
CN108154515A (zh) * 2017-12-27 2018-06-12 三星电子(中国)研发中心 图片展现方法和装置
CN108364295A (zh) * 2018-01-08 2018-08-03 武汉斗鱼网络科技有限公司 一种图片裁切方法及***
CN108597003A (zh) * 2018-04-20 2018-09-28 腾讯科技(深圳)有限公司 一种文章封面生成方法、装置、处理服务器及存储介质
CN108776970B (zh) * 2018-06-12 2021-01-12 北京字节跳动网络技术有限公司 图像处理方法和装置
CN109448001B (zh) * 2018-10-26 2021-08-27 世纪开元智印互联科技集团股份有限公司 一种图片自动裁剪方法
CN109447072A (zh) * 2018-11-08 2019-03-08 北京金山安全软件有限公司 一种缩略图裁剪方法、装置、电子设备及可读存储介质
CN109712164A (zh) * 2019-01-17 2019-05-03 上海携程国际旅行社有限公司 图像智能剪裁方法、***、设备及存储介质
CN110223301B (zh) * 2019-03-01 2021-08-03 华为技术有限公司 一种图像裁剪方法和电子设备
CN109919156B (zh) * 2019-03-13 2022-07-19 网易传媒科技(北京)有限公司 图像裁剪预测模型的训练方法、介质、装置及计算设备
CN110297927B (zh) * 2019-05-17 2022-07-29 百度在线网络技术(北京)有限公司 文章发布方法、装置、设备及存储介质
CN110189378B (zh) * 2019-05-23 2022-03-04 北京奇艺世纪科技有限公司 一种视频处理方法、装置及电子设备
CN110349082B (zh) * 2019-06-28 2023-08-29 腾讯科技(深圳)有限公司 图像区域的裁剪方法和装置、存储介质及电子装置
CN110334653A (zh) * 2019-07-08 2019-10-15 聚好看科技股份有限公司 视频通信中的图像处理方法、装置及设备
CN110706150A (zh) * 2019-07-12 2020-01-17 北京达佳互联信息技术有限公司 图像处理方法、装置、电子设备及存储介质
CN110782392B (zh) * 2019-07-12 2023-11-14 北京达佳互联信息技术有限公司 图像处理方法、装置、电子设备及存储介质
CN110580678B (zh) * 2019-09-10 2023-06-20 北京百度网讯科技有限公司 图像处理方法及装置
CN112541934B (zh) * 2019-09-20 2024-02-27 百度在线网络技术(北京)有限公司 一种图像处理方法及装置
CN110750664B (zh) * 2019-10-15 2023-03-28 腾讯科技(深圳)有限公司 图片的显示方法及装置
CN111062279B (zh) * 2019-12-04 2023-06-06 深圳先进技术研究院 照片处理方法及照片处理装置
CN111079662A (zh) * 2019-12-19 2020-04-28 江苏云从曦和人工智能有限公司 一种人物识别方法、装置、机器可读介质及设备
CN111125526B (zh) * 2019-12-24 2023-03-14 腾讯科技(深圳)有限公司 基于人工智能的内容推送方法、装置及电子设备
CN111462121A (zh) * 2020-03-23 2020-07-28 上海携程商务有限公司 基于图像语义理解的图像裁切方法、***、设备和介质
CN113709354A (zh) * 2020-05-20 2021-11-26 华为技术有限公司 一种拍摄方法及电子设备
CN112016548B (zh) * 2020-10-15 2021-02-09 腾讯科技(深圳)有限公司 一种封面图展示方法及相关装置
CN112927241A (zh) * 2021-03-08 2021-06-08 携程旅游网络技术(上海)有限公司 图片截取和缩略图生成方法、***、设备及储存介质
CN113159026A (zh) * 2021-03-31 2021-07-23 北京百度网讯科技有限公司 图像处理方法、装置、电子设备和介质
CN113763242A (zh) * 2021-05-17 2021-12-07 腾讯科技(深圳)有限公司 一种图像处理方法、装置及计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101685620A (zh) * 2008-09-26 2010-03-31 鸿富锦精密工业(深圳)有限公司 对图片进行调整的显示装置及方法
CN102063709A (zh) * 2011-01-12 2011-05-18 中山大学 一种数码相机构图效果提高方法
CN103369244A (zh) * 2012-04-10 2013-10-23 奥林巴斯映像株式会社 图像合成设备、图像合成方法
CN103914689A (zh) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 基于人脸识别的图片裁剪方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101685620A (zh) * 2008-09-26 2010-03-31 鸿富锦精密工业(深圳)有限公司 对图片进行调整的显示装置及方法
CN102063709A (zh) * 2011-01-12 2011-05-18 中山大学 一种数码相机构图效果提高方法
CN103369244A (zh) * 2012-04-10 2013-10-23 奥林巴斯映像株式会社 图像合成设备、图像合成方法
CN103914689A (zh) * 2014-04-09 2014-07-09 百度在线网络技术(北京)有限公司 基于人脸识别的图片裁剪方法及装置

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108647590A (zh) * 2018-04-25 2018-10-12 董志忠 一种智能头像处理算法
CN111652015B (zh) * 2019-03-27 2024-04-26 上海铼锶信息技术有限公司 一种对图片中关键人脸进行选择的方法和***
CN111652015A (zh) * 2019-03-27 2020-09-11 上海铼锶信息技术有限公司 一种对图片中关键人脸进行选择的方法和***
CN110264396B (zh) * 2019-06-27 2022-11-18 杨骥 视频人脸替换方法、***及计算机可读存储介质
CN110264396A (zh) * 2019-06-27 2019-09-20 杨骥 视频人脸替换方法、***及计算机可读存储介质
CN110807361A (zh) * 2019-09-19 2020-02-18 腾讯科技(深圳)有限公司 人体识别方法、装置、计算机设备及存储介质
CN110807361B (zh) * 2019-09-19 2023-08-08 腾讯科技(深圳)有限公司 人体识别方法、装置、计算机设备及存储介质
CN113095119B (zh) * 2020-01-09 2023-11-21 北京君正集成电路股份有限公司 一种修正人脸裁剪框的人脸识别***
CN113095119A (zh) * 2020-01-09 2021-07-09 北京君正集成电路股份有限公司 一种修正人脸裁剪框的人脸识别***
CN111243061B (zh) * 2020-01-21 2022-12-20 苏宁云计算有限公司 一种商品图片的生成方法、装置、***
CN111243061A (zh) * 2020-01-21 2020-06-05 苏宁云计算有限公司 一种商品图片的生成方法、装置、***
CN111524145A (zh) * 2020-04-13 2020-08-11 北京智慧章鱼科技有限公司 图片智能裁剪方法、***、计算机设备及存储介质
CN111524145B (zh) * 2020-04-13 2024-06-04 北京智慧章鱼科技有限公司 图片智能裁剪方法、***、计算机设备及存储介质
CN114359301A (zh) * 2020-09-29 2022-04-15 合肥君正科技有限公司 一种自适应扩展系数的人脸裁剪优化方法
CN114359301B (zh) * 2020-09-29 2024-05-28 合肥君正科技有限公司 一种自适应扩展系数的人脸裁剪优化方法
CN116543004A (zh) * 2023-07-05 2023-08-04 荣耀终端有限公司 图像裁切方法、装置、终端设备及计算机可读存储介质
CN116543004B (zh) * 2023-07-05 2024-04-19 荣耀终端有限公司 图像裁切方法、装置、终端设备及计算机可读存储介质

Also Published As

Publication number Publication date
CN103914689B (zh) 2017-03-15
CN103914689A (zh) 2014-07-09

Similar Documents

Publication Publication Date Title
WO2015154516A1 (zh) 基于人脸识别的图片裁剪方法、装置、设备和存储介质
KR102045695B1 (ko) 안면 이미지 처리 방법 및 장치, 및 저장 매체
US11182885B2 (en) Method and apparatus for implementing image enhancement, and electronic device
US9749684B2 (en) Multimedia processing method and multimedia apparatus
WO2020000908A1 (zh) 一种人脸活体检测方法及装置
JP6719457B2 (ja) 画像の主要被写体を抽出する方法とシステム
US11244144B2 (en) Age recognition method, computer storage medium and electronic device
WO2017035966A1 (zh) 用于人脸图像处理的方法和装置
WO2020001013A1 (zh) 图像处理方法、装置、计算机可读存储介质和终端
WO2015161757A1 (zh) 图片缩略图的获取方法及装置
WO2021043295A1 (zh) 一种全景视频的目标追踪方法、装置及便携式终端
US11900675B2 (en) Dynamic image analysis and cropping
WO2020151156A1 (zh) 视频流播放方法、***、计算机装置及可读存储介质
JP2013058060A (ja) 人物属性推定装置、人物属性推定方法及びプログラム
US10740594B2 (en) Face recognition method and device, and picture displaying method and device
WO2021208767A1 (zh) 人脸轮廓修正方法、装置、设备及存储介质
US10121088B2 (en) System and method for straightening curved page content
US20160110909A1 (en) Method and apparatus for creating texture map and method of creating database
WO2019223066A1 (zh) 虹膜图像全局增强方法、装置、设备及存储介质
US20140072234A1 (en) Method and apparatus for estimating position of head, computer readable storage medium thereof
CN113850239B (zh) 多文档检测方法、装置、电子设备及存储介质
US11360555B2 (en) Systems and methods for automatic eye gaze refinement
CN111612712A (zh) 一种人脸端正度的确定方法、装置、设备及介质
US9563940B2 (en) Smart image enhancements
CN113850805B (zh) 多文档检测方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 14889058

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 14889058

Country of ref document: EP

Kind code of ref document: A1