CN105354792A - A virtual glasses try-on method and mobile terminal - Google Patents
A virtual glasses try-on method and mobile terminal Download PDFInfo
- Publication number
- CN105354792A CN105354792A CN201510707664.6A CN201510707664A CN105354792A CN 105354792 A CN105354792 A CN 105354792A CN 201510707664 A CN201510707664 A CN 201510707664A CN 105354792 A CN105354792 A CN 105354792A
- Authority
- CN
- China
- Prior art keywords
- glasses
- face
- picture
- human face
- eyes
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 239000011521 glass Substances 0.000 claims abstract description 201
- 238000001514 detection method Methods 0.000 claims abstract description 31
- 238000012545 processing Methods 0.000 claims abstract description 14
- 210000000887 face Anatomy 0.000 claims description 36
- 230000008569 process Effects 0.000 claims description 12
- 230000000694 effects Effects 0.000 abstract description 9
- 238000010586 diagram Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 5
- 229910052751 metal Inorganic materials 0.000 description 4
- 239000002184 metal Substances 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- UDKIYKILOKEDQK-UHFFFAOYSA-N esperin Chemical compound OC(=O)C(C)NC(=O)C(CC(C)C)NC(=O)C1CC(=O)OC(C)CC(=O)NC(CCC(O)=O)C(=O)NC(CC(C)C)C(=O)NC(CC(C)C)C(=O)NC(C(C)C)C(=O)N1 UDKIYKILOKEDQK-UHFFFAOYSA-N 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 150000002739 metals Chemical class 0.000 description 2
- 229910052719 titanium Inorganic materials 0.000 description 2
- 239000010936 titanium Substances 0.000 description 2
- -1 titanium metals Chemical class 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000004570 mortar (masonry) Substances 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/14—Transformations for image registration, e.g. adjusting or mapping for alignment of images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/161—Detection; Localisation; Normalisation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- User Interface Of Digital Computer (AREA)
- Image Processing (AREA)
- Telephone Function (AREA)
Abstract
Description
技术领域technical field
本发明实施例涉及计算机视觉与虚拟穿戴相结合的技术领域,具体涉及一种一种虚拟眼镜试戴方法及移动终端。The embodiment of the present invention relates to the technical field of combining computer vision and virtual wear, and in particular to a virtual glasses try-on method and a mobile terminal.
背景技术Background technique
随着移动互联网技术的快速发展,移动终端(如手机、平板电脑等等)已经成为生活中不可或缺的一部分。与传统实体店铺购物相比,网络购物具有可不受时间、地点约束、且品种齐全、价格低廉等优点,但是在网络购物过程中,往往只能简单地通过图片或精简视频对商品进行展示,用户较难根据该方式选择自己想要的商品。With the rapid development of mobile Internet technology, mobile terminals (such as mobile phones, tablet computers, etc.) have become an indispensable part of life. Compared with shopping in traditional brick-and-mortar stores, online shopping has the advantages of being free from time and location constraints, complete varieties, and low prices. It is difficult to choose the product you want in this way.
生活中,眼镜作为网络购物的众多消费种类中的一种,其使用非常流行。但是,在网上选择眼镜的过程,眼镜仅由已有的模特图片进行效果观察,如此,眼镜的佩戴效果展示不直观,从而,用户难以在网络购物的过程中感受到自身试戴的感觉,因而,降低了用户体验。In life, glasses are very popular as one of the many consumption categories of online shopping. However, in the process of selecting glasses on the Internet, the effect of the glasses is only observed from the existing model pictures. In this way, the display of the wearing effect of the glasses is not intuitive, so that it is difficult for the user to feel the feeling of trying them on during the online shopping process. Therefore, , reducing the user experience.
发明内容Contents of the invention
本发明实施例提供了一种虚拟眼镜试戴方法及移动终端,以期让用户更为直观地了解用户选择的佩戴效果,同时,提高用户体验。Embodiments of the present invention provide a virtual glasses try-on method and a mobile terminal, in order to allow users to more intuitively understand the wearing effect selected by the user, and at the same time improve user experience.
本发明实施例第一方面提供了一种虚拟眼镜试戴方法,包括:The first aspect of the embodiment of the present invention provides a virtual glasses try-on method, including:
获取用户输入的图像;Get the image entered by the user;
对所述图像进行人脸检测;Perform face detection on the image;
在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;In the case of detecting a human face, determine the angle value of the human face, the face shape and the center point of the two eyes of the human face;
确定与所述角度值和所述脸型对应的目标模特图片;Determining a target model picture corresponding to the angle value and the face shape;
获取用户选择的眼镜款式;Obtain the glasses style selected by the user;
根据所述角度值确定所述眼镜款式对应的眼镜图片;determining the glasses picture corresponding to the glasses style according to the angle value;
根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;According to the proportional relationship between the second distance in the target model picture and the first distance between the center points of the two eyes in the face, the glasses picture is scaled, wherein the second distance is the The distance between the center points of the eyes of the model in the target model image;
将所述缩放处理之后的眼镜图片与所述人脸进行叠加。and superimposing the zoomed glasses picture with the human face.
结合本发明实施例第一方面,在第一方面的第一种可能的实施方式中,所述在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点及所述两眼的中心点之间的第一距离包括:With reference to the first aspect of the embodiments of the present invention, in the first possible implementation manner of the first aspect, when a human face is detected, determining the angle value of the human face, the shape of the face, and the angle of the human face The center point of the two eyes and the first distance between the center points of the two eyes comprise:
在检测到多个人脸的情况下,选择所述多个人脸中的人脸i,其中,所述人脸i为所述多个人脸中的任一人脸;In the case of detecting a plurality of human faces, selecting a human face i in the plurality of human faces, wherein the human face i is any human face in the plurality of human faces;
确定所述人脸i的角度值、脸型及所述人脸i中两眼的中心点。Determine the angle value of the face i, the face shape, and the center points of the two eyes in the face i.
结合本发明实施例第一方面,在第一方面的第二种可能的实施方式中,所述根据所述角度值确定所述眼镜款式对应的眼镜图片包括:With reference to the first aspect of the embodiments of the present invention, in a second possible implementation manner of the first aspect, the determining the glasses picture corresponding to the glasses style according to the angle value includes:
根据所述角度值从图片库中搜索与所述眼镜款式对应的眼镜图片。According to the angle value, the glasses picture corresponding to the glasses style is searched from the image library.
结合本发明实施例第一方面,在第一方面的第三种可能的实施方式中,所述将所述缩放处理之后的眼镜图片与所述人脸进行叠加包括:With reference to the first aspect of the embodiments of the present invention, in a third possible implementation manner of the first aspect, the superimposing the zoomed glasses picture on the human face includes:
根据所述人脸的两眼的中心点的位置关系将所述缩放处理之后的眼镜图片覆盖在所述人脸上方。The zoomed glasses picture is overlaid on the human face according to the positional relationship between the center points of the two eyes of the human face.
结合本发明实施例第一方面或第一种至第三种中任一种可能的实施方式中,在第一方面的第四种可能的实施方式中,所述将所述缩放处理之后的眼镜图片与所述人脸进行叠加之后,所述方法还包括:In combination with the first aspect or any one of the first to third possible implementation manners of the embodiments of the present invention, in the fourth possible implementation manner of the first aspect, the glasses after the scaling process After superimposing the picture and the human face, the method also includes:
获取用户选择的场景模式;Obtain the scene mode selected by the user;
从预设图片库中选择与所述场景模式对应的眼镜图片叠加在所述人脸上方。A picture of glasses corresponding to the scene mode is selected from a preset picture library and superimposed on the face of the person.
本发明实施例第二方面提供了一种移动终端,包括:The second aspect of the embodiment of the present invention provides a mobile terminal, including:
获取单元,用于获取用户输入的图像;an acquisition unit, configured to acquire an image input by a user;
检测单元,用于对所述获取单元获取到的图像进行人脸检测;a detection unit, configured to perform face detection on the image acquired by the acquisition unit;
第一确定单元,用于在所述检测单元检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;The first determination unit is configured to determine the angle value of the human face, the shape of the face, and the center point of the two eyes of the human face when the detection unit detects the human face;
第二确定单元,用于确定与所述第一确定单元确定的角度值和脸型对应的目标模特图片;A second determination unit, configured to determine a target model picture corresponding to the angle value and face shape determined by the first determination unit;
获取单元还具体用于:The acquisition unit is also specifically used for:
获取用户选择的眼镜款式;Obtain the glasses style selected by the user;
第三确定单元,用于根据所述第一确定单元确定的角度值确定所述获取单元获取到的眼镜款式对应的眼镜图片;A third determination unit, configured to determine the glasses picture corresponding to the glasses style acquired by the acquisition unit according to the angle value determined by the first determination unit;
缩放单元,用于根据所述第二确定单元确定的目标模特图片中的第二距离与所述第一确定单元确定的人脸中两眼的中心点的第一距离之间的比例关系对所述第三确定单元确定的眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;The scaling unit is used to calculate the ratio according to the ratio between the second distance in the target model picture determined by the second determination unit and the first distance between the center points of the two eyes in the human face determined by the first determination unit. The glasses picture determined by the third determining unit is subjected to scaling processing, wherein the second distance is the distance between the center points of the two eyes of the model in the target model picture;
第一叠加单元,用于将所述缩放单元缩放处理之后的眼镜图片与所述检测单元检测到的人脸进行叠加。The first superimposing unit is configured to superimpose the glasses picture after scaling processing by the scaling unit and the human face detected by the detecting unit.
结合本发明实施例第二方面,在第二方面的第一种可能的实施方式中,所述第一确定单元包括:With reference to the second aspect of the embodiments of the present invention, in a first possible implementation manner of the second aspect, the first determination unit includes:
选择单元,用于在所述检测单元检测到多个人脸的情况下,选择所述多个人脸中的人脸i,其中,所述人脸i为所述多个人脸中的任一人脸;A selection unit, configured to select a face i among the plurality of faces when the detection unit detects a plurality of faces, wherein the face i is any one of the plurality of faces;
第一确定子单元,用于确定所述选择单元选择的人脸i的角度值、脸型及所述人脸i中两眼的中心点。The first determination subunit is used to determine the angle value, face shape and center point of the two eyes of the face i selected by the selection unit.
结合本发明实施例第二方面,在第二方面的第二种可能的实施方式中,所述第二确定单元具体用于:With reference to the second aspect of the embodiments of the present invention, in a second possible implementation manner of the second aspect, the second determination unit is specifically configured to:
根据所述角度值从图片库中搜索与所述眼镜款式对应的眼镜图片。According to the angle value, the glasses picture corresponding to the glasses style is searched from the image library.
结合本发明实施例第二方面,在第二方面的第三种可能的实施方式中,所述叠加单元具体用于:With reference to the second aspect of the embodiments of the present invention, in a third possible implementation manner of the second aspect, the superposition unit is specifically configured to:
根据所述人脸的两眼的中心点的位置关系将所述缩放处理之后的眼镜图片覆盖在所述人脸上方。The zoomed glasses picture is overlaid on the human face according to the positional relationship between the center points of the two eyes of the human face.
结合本发明实施例第二方面或第一种至第三种中任一种可能的实施方式中,在第二方面的第四种可能的实施方式中,所述获取单元还具体用于:In combination with the second aspect of the embodiments of the present invention or any one of the first to third possible implementation manners, in the fourth possible implementation manner of the second aspect, the acquiring unit is further specifically configured to:
获取用户选择的场景模式;Obtain the scene mode selected by the user;
所述移动终端还包括:The mobile terminal also includes:
第二叠加单元,用于从预设图片库中选择与所述获取单元获取到的场景模式对应的眼镜图片叠加在所述识别单元识别到的人脸上方。The second superimposing unit is configured to select a picture of glasses corresponding to the scene mode acquired by the acquisition unit from a preset picture library and superimpose it on the face recognized by the recognition unit.
采用本发明实施例,具有如下有益效果:Adopting the embodiment of the present invention has the following beneficial effects:
通过本发明实施例获取用户输入的图像;对所述图像进行人脸检测;在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;确定与所述角度值和所述脸型对应的目标模特图片;获取用户选择的眼镜款式;根据所述角度值确定所述眼镜款式对应的眼镜图片;根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;将所述缩放处理之后的眼镜图片与所述人脸进行叠加。从而,用户可更为直接地观察到眼镜的佩戴效果,提升了用户体验。Obtain the image input by the user through the embodiment of the present invention; perform face detection on the image; when a face is detected, determine the angle value of the face, the shape of the face, and the center point of the two eyes of the face ; Determine the target model picture corresponding to the angle value and the face shape; Obtain the glasses style selected by the user; Determine the glasses picture corresponding to the glasses style according to the angle value; According to the second distance in the target model picture The proportional relationship between the first distance and the center point of the two eyes in the human face performs scaling processing on the glasses picture, wherein the second distance is the center of the two eyes of the model in the target model picture The distance between the points; the glasses picture after the scaling process is superimposed on the human face. Therefore, the user can more directly observe the wearing effect of the glasses, which improves the user experience.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1是本发明实施例提供的一种虚拟眼镜试戴方法的第一实施例流程示意图;Fig. 1 is a schematic flow chart of the first embodiment of a method for trying on virtual glasses provided by an embodiment of the present invention;
图2是本发明实施例提供的一种虚拟眼镜试戴方法的第二实施例流程示意图;Fig. 2 is a schematic flow chart of the second embodiment of a method for trying on virtual glasses provided by an embodiment of the present invention;
图3a是本发明实施例提供的一种移动终端的第一实施例结构示意图;Fig. 3a is a schematic structural diagram of a first embodiment of a mobile terminal provided by an embodiment of the present invention;
图3b是本发明实施例提供的一种移动终端的第一实施例又一结构示意图;Fig. 3b is another structural schematic diagram of the first embodiment of a mobile terminal provided by the embodiment of the present invention;
图3c是本发明实施例提供的一种移动终端的第一实施例又一结构示意图;Fig. 3c is another structural schematic diagram of the first embodiment of a mobile terminal provided by the embodiment of the present invention;
图4是本发明实施例提供的一种移动终端的第二实施例结构示意图。Fig. 4 is a schematic structural diagram of a second embodiment of a mobile terminal provided by an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 creative efforts fall within the protection scope of the present invention.
以下分别进行详细说明。Each will be described in detail below.
本发明的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third" and "fourth" in the description and claims of the present invention and the drawings are used to distinguish different objects, rather than to describe a specific order . Furthermore, the terms "include" and "have", as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes unlisted steps or units, or optionally further includes For other steps or units inherent in these processes, methods, products or apparatuses.
本发明实施例所描述的移动终端可以包括智能手机(如Android手机、iOS手机、WindowsPhone手机等)、平板电脑、掌上电脑、笔记本电脑、移动互联网设备(MID,MobileInternetDevices)或穿戴式设备等,上述移动终端仅是举例,而非穷举,包含但不限于上述移动终端。The mobile terminal described in the embodiment of the present invention may include a smart phone (such as an Android phone, an iOS phone, a Windows Phone, etc.), a tablet computer, a handheld computer, a notebook computer, a mobile Internet device (MID, MobileInternetDevices) or a wearable device, etc., the above-mentioned The mobile terminal is only an example, not exhaustive, including but not limited to the above-mentioned mobile terminal.
请参阅图1,为本发明实施例提供的一种虚拟眼镜方法的第一实施例流程示意图。本实施例中所描述的虚拟眼镜试戴方法,包括以下步骤:Please refer to FIG. 1 , which is a schematic flowchart of a first embodiment of a method for virtual glasses provided by an embodiment of the present invention. The virtual glasses try-on method described in this embodiment includes the following steps:
S101、获取用户输入的图像。S101. Acquire an image input by a user.
本实施例中,用户输入的图像可含有至少一个人脸,该图像可来自于移动终端的摄像头拍摄到的图片,也可以是移动终端中存储的照片,还可以是网络照片。该图像中的人脸的角度可为正脸,或者任一角度的侧脸。优选地,本实施例中,该图像可中有且只有一个人脸。In this embodiment, the image input by the user may contain at least one human face, and the image may be a picture captured by a camera of the mobile terminal, a photo stored in the mobile terminal, or a photo on the Internet. The angle of the face in the image can be a frontal face, or a side face at any angle. Preferably, in this embodiment, the image may contain one and only one human face.
S102、对所述图像进行人脸检测。S102. Perform face detection on the image.
具体实现中,移动终端可对用户输入的图像进行人脸检测,该人脸检测的目的在于检测该图片中是否包含人脸,或者包含一个脸还是多个脸。In a specific implementation, the mobile terminal may perform face detection on the image input by the user. The purpose of the face detection is to detect whether the picture contains a human face, or whether it contains one face or multiple faces.
可选地,移动终端在检测出图像中不包含人脸图像的情况下,可提醒用户重新进行拍摄或者另选图片。Optionally, when the mobile terminal detects that the image does not contain a face image, it may remind the user to take another picture or select another picture.
可选地,移动终端在检测到人脸图像但是未检测到人眼的情况下,可提醒用户重新进行拍摄或者另选图片,进一步地,在用户比了一只眼睛的情况下,则提示用户张开另外一只眼睛。Optionally, when the mobile terminal detects a human face image but does not detect human eyes, it can remind the user to take another picture or choose another picture. Further, when the user compares one eye, the user is prompted to Open the other eye.
S103、在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点。S103. If a human face is detected, determine an angle value of the human face, a face shape, and a center point of two eyes of the human face.
具体实现中,在移动终端只检测到一个人脸的情况下,可确定该人脸的角度值、脸型及该人脸中两眼的中心点,还可确定该两眼的中心点之间的距离。In the specific implementation, when the mobile terminal only detects one human face, it can determine the angle value of the human face, the face shape and the center point of the two eyes in the human face, and can also determine the distance between the center points of the two eyes. distance.
进一步地,在移动终端检测出多个人脸的情况下,可选择该多个人脸中的人脸i,其中,该人脸i为所述多个人脸中的任一人脸;再确定该人脸i的角度值、脸型及该人脸i中两眼的中心点。Further, in the case that the mobile terminal detects multiple human faces, face i among the multiple human faces can be selected, wherein the human face i is any one of the multiple human faces; The angle value of i, the face shape and the center point of the two eyes of the face i.
进一步地,在移动终端检测出多个人脸的情况下,可同时确定该多个人脸中的至少两个人脸的角度值、脸型及该至少两个人脸中的每个人脸的两眼的中心点。Further, in the case that the mobile terminal detects multiple human faces, it can simultaneously determine the angle value of at least two human faces in the multiple human faces, the face shape and the center point of the two eyes of each human face in the at least two human faces .
S104、确定与所述角度值和所述脸型对应的目标模特图片。S104. Determine a target model picture corresponding to the angle value and the face shape.
具体实现中,移动终端可依据角度值和脸型在图片库中进行搜索,该图片库可位于移动终端或者服务器,将与该角度值和脸型匹配的图片作为目标模特图片。In a specific implementation, the mobile terminal can search the picture library according to the angle value and face shape. The picture library can be located in the mobile terminal or a server, and the picture matching the angle value and face shape is used as the target model picture.
S105、获取用户选择的眼镜款式。S105. Obtain the glasses style selected by the user.
具体实现中,眼镜的类别可为全框、半框和无框。眼镜款式则该该任一类别眼镜下的一款眼镜。In a specific implementation, the categories of the glasses may be full-rim, half-rim and frameless. The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别可包括但不仅限于:时尚(500元-800元)、轻奢(800元-2000元)、奢侈(2000元-5000元)和极致(5000元以上)。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the categories of glasses may include but not limited to: fashion (500-800 yuan), light luxury (800-2000 yuan), luxury (2000-5000 yuan) and extreme (5000 yuan or more). The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别还可包括但不仅限于:板材、金属、钛金属和混合材质。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the category of glasses may also include but not limited to: plates, metals, titanium metals and mixed materials. The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别可包括但不仅限于:阿玛尼、爱思柏林、阿莎露、宝丽来、保时捷、风景、高尔夫、卡加尔、维多利亚、香奈儿和佐芙。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the categories of glasses may include but not limited to: Armani, Esperin, Azalo, Polaroid, Porsche, Landscape, Golf, Cargal, Victoria, Chanel, and Zoff. The glasses style should be a kind of glasses under any category of glasses.
眼镜的类别还可包括但不仅限于:男士太阳镜、女士太阳镜、男士光学镜和女式光学镜。眼镜款式则该该任一类别眼镜下的一款眼镜。Eyewear categories may also include, but are not limited to: Men's Sunglasses, Women's Sunglasses, Men's Optical, and Women's Optical. The glasses style should be a kind of glasses under any category of glasses.
S106、根据所述角度值确定所述眼镜款式对应的眼镜图片。S106. Determine the glasses picture corresponding to the glasses style according to the angle value.
具体实现中,移动终端可根据该角度值从图片库中搜索与该眼镜款式对应的眼镜图片。需要说明的是,图片库中可包含多个模特图片,该模特图片可佩戴各种款式的眼镜。例如,某一款眼镜,可将该眼镜进行任一角度拍摄,得到该眼镜对应的一系列眼镜图片,该眼镜图片可以角度值加以命名,从而,可有效区分这一系列眼镜图片。可选地,从图片库中搜索与所述眼镜款式对应的眼镜图片。即图片库中存储着不同款式的眼镜系列图片,每个眼镜系列图片中包含某款眼镜的任一角度的眼镜图片,In a specific implementation, the mobile terminal may search the picture library for glasses pictures corresponding to the glasses style according to the angle value. It should be noted that the picture library may contain multiple model pictures, and the model pictures may wear glasses of various styles. For example, for a certain type of glasses, the glasses can be photographed at any angle to obtain a series of glasses pictures corresponding to the glasses, and the glasses pictures can be named by angle values, so that the series of glasses pictures can be effectively distinguished. Optionally, a picture of glasses corresponding to the style of glasses is searched from a picture library. That is, the picture library stores pictures of glasses series of different styles, and each series picture of glasses contains pictures of glasses at any angle of a certain type of glasses.
S107、根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离。S107. Perform scaling processing on the glasses picture according to the proportional relationship between the second distance in the target model picture and the first distance between the center points of the eyes of the human face, wherein the second distance is The distance between the center points of the two eyes of the model in the target model picture.
具体实现中,移动终端对人脸进行检测的过程中检测到的人脸的两眼的中心点之间的距离可为第一距离,两眼的中心点,即为每个眼镜的中心点,第二距离为目标模特图片中的模特的两眼的中心点之间的距离,第二距离与眼镜图片相匹配。可根据第一距离与第二距离之间的比例关系确定眼镜图片的缩放比例。假设第一距离为1,第二距离为2,显示第二距离为第一距离的2倍,则可将眼镜图片的比例缩小一半。In a specific implementation, the distance between the center points of the two eyes of the face detected by the mobile terminal in the process of detecting the face may be the first distance, and the center point of the two eyes is the center point of each glasses. The second distance is the distance between the center points of the two eyes of the model in the target model picture, and the second distance matches the glasses picture. The zoom ratio of the glasses picture can be determined according to the proportional relationship between the first distance and the second distance. Assuming that the first distance is 1, the second distance is 2, and the second distance is displayed as twice the first distance, the scale of the glasses picture can be reduced by half.
S108、将所述缩放处理之后的眼镜图片与所述人脸进行叠加。S108. Superimpose the zoomed glasses picture with the human face.
具体实现中,移动终端可将缩放处理后的眼镜图片叠加在人脸区域,即根据人脸中的两眼的中心点确定眼镜的摆放位置,根据该摆放位置将眼镜叠加在人脸区域。In a specific implementation, the mobile terminal can superimpose the zoomed glasses picture on the face area, that is, determine the placement position of the glasses according to the center point of the two eyes in the face, and superimpose the glasses on the face area according to the placement position .
通过本发明实施例获取用户输入的图像;对所述图像进行人脸检测;在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;确定与所述角度值和所述脸型对应的目标模特图片;获取用户选择的眼镜款式;根据所述角度值确定所述眼镜款式对应的眼镜图片;根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;将所述缩放处理之后的眼镜图片与所述人脸进行叠加。从而,用户可更为直接地观察到眼镜的佩戴效果,提升了用户体验。Obtain the image input by the user through the embodiment of the present invention; perform face detection on the image; when a face is detected, determine the angle value of the face, the shape of the face, and the center point of the two eyes of the face ; Determine the target model picture corresponding to the angle value and the face shape; Obtain the glasses style selected by the user; Determine the glasses picture corresponding to the glasses style according to the angle value; According to the second distance in the target model picture The proportional relationship between the first distance and the center point of the two eyes in the human face performs scaling processing on the glasses picture, wherein the second distance is the center of the two eyes of the model in the target model picture The distance between the points; the glasses picture after the scaling process is superimposed on the human face. Therefore, the user can more directly observe the wearing effect of the glasses, which improves the user experience.
请参阅图2,为本发明实施例提供的一种虚拟眼镜试戴方法的第二实施例流程示意图。本实施例中所描述的虚拟眼镜试戴方法,包括以下步骤:Please refer to FIG. 2 , which is a schematic flowchart of a second embodiment of a method for trying on virtual glasses provided by an embodiment of the present invention. The virtual glasses try-on method described in this embodiment includes the following steps:
S201、获取用户输入的图像。S201. Acquire an image input by a user.
本实施例中,用户输入的图像可含有至少一个人脸,该图像可来自于移动终端的摄像头拍摄到的图片,也可以是移动终端中存储的照片,还可以是网络照片。该图像中的人脸的角度可为正脸,或者任一角度的侧脸。优选地,本实施例中,该图像可中有且只有一个人脸。In this embodiment, the image input by the user may contain at least one human face, and the image may be a picture captured by a camera of the mobile terminal, a photo stored in the mobile terminal, or a photo on the Internet. The angle of the face in the image can be a frontal face, or a side face at any angle. Preferably, in this embodiment, the image may contain one and only one human face.
S202、对所述图像进行人脸检测。S202. Perform face detection on the image.
具体实现中,移动终端可对用户输入的图像进行人脸检测,该人脸检测的目的在于检测该图片中是否包含人脸,或者包含一个脸还是多个脸。In a specific implementation, the mobile terminal may perform face detection on the image input by the user. The purpose of the face detection is to detect whether the picture contains a human face, or whether it contains one face or multiple faces.
可选地,移动终端在检测出图像中不包含人脸图像的情况下,可提醒用户重新进行拍摄或者另选图片。Optionally, when the mobile terminal detects that the image does not contain a face image, it may remind the user to take another picture or select another picture.
可选地,移动终端在检测到人脸图像但是未检测到人眼的情况下,可提醒用户重新进行拍摄或者另选图片,进一步地,在用户比了一只眼睛的情况下,则提示用户张开另外一只眼睛。Optionally, when the mobile terminal detects a human face image but does not detect human eyes, it can remind the user to take another picture or choose another picture. Further, when the user compares one eye, the user is prompted to Open the other eye.
S203、在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点。S203. If a human face is detected, determine an angle value of the human face, a face shape, and a center point of two eyes of the human face.
具体实现中,在移动终端只检测到一个人脸的情况下,可确定该人脸的角度值、脸型及该人脸中两眼的中心点,还可确定该两眼的中心点之间的距离。In the specific implementation, when the mobile terminal only detects one human face, it can determine the angle value of the human face, the face shape and the center point of the two eyes in the human face, and can also determine the distance between the center points of the two eyes. distance.
进一步地,在移动终端检测出多个人脸的情况下,可选择该多个人脸中的人脸i,其中,该人脸i为所述多个人脸中的任一人脸;再确定该人脸i的角度值、脸型及该人脸i中两眼的中心点。该任一人脸可包括但不仅限于:多个人脸中的脸部面积最大的人脸、脸部面积最小的人脸、脸部显示最完整的人脸、在人脸检测过程中第一个被检测到的人脸等等。Further, in the case that the mobile terminal detects multiple human faces, face i among the multiple human faces can be selected, wherein the human face i is any one of the multiple human faces; The angle value of i, the face shape and the center point of the two eyes of the face i. The arbitrary face may include, but is not limited to: the face with the largest face area among the multiple faces, the face with the smallest face area, the face with the most complete face display, and the face that is the first to be detected in the face detection process. Detected faces and more.
进一步地,在移动终端检测出多个人脸的情况下,可同时确定该多个人脸中的至少两个人脸的角度值、脸型及该至少两个人脸中的每个人脸的两眼的中心点。Further, in the case that the mobile terminal detects multiple human faces, it can simultaneously determine the angle value of at least two human faces in the multiple human faces, the face shape and the center point of the two eyes of each human face in the at least two human faces .
S204、确定与所述角度值和所述脸型对应的目标模特图片。S204. Determine a target model picture corresponding to the angle value and the face shape.
具体实现中,移动终端可依据角度值和脸型在图片库中进行搜索,该图片库可位于移动终端或者服务器,将与该角度值和脸型匹配的图片作为目标模特图片。In a specific implementation, the mobile terminal can search the picture library according to the angle value and face shape. The picture library can be located in the mobile terminal or a server, and the picture matching the angle value and face shape is used as the target model picture.
S205、获取用户选择的眼镜款式。S205. Obtain the glasses style selected by the user.
具体实现中,眼镜的类别可为全框、半框和无框。眼镜款式则该该任一类别眼镜下的一款眼镜。In a specific implementation, the categories of the glasses may be full-rim, half-rim and frameless. The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别可包括但不仅限于:时尚(500元-800元)、轻奢(800元-2000元)、奢侈(2000元-5000元)和极致(5000元以上)。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the categories of glasses may include but not limited to: fashion (500-800 yuan), light luxury (800-2000 yuan), luxury (2000-5000 yuan) and extreme (5000 yuan or more). The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别还可包括但不仅限于:板材、金属、钛金属和混合材质。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the category of glasses may also include but not limited to: plates, metals, titanium metals and mixed materials. The glasses style should be a kind of glasses under any category of glasses.
进一步地,眼镜的类别可包括但不仅限于:阿玛尼、爱思柏林、阿莎露、宝丽来、保时捷、风景、高尔夫、卡加尔、维多利亚、香奈儿和佐芙。眼镜款式则该该任一类别眼镜下的一款眼镜。Further, the categories of glasses may include but not limited to: Armani, Esperin, Azalo, Polaroid, Porsche, Landscape, Golf, Cargal, Victoria, Chanel, and Zoff. The glasses style should be a kind of glasses under any category of glasses.
眼镜的类别还可包括但不仅限于:男士太阳镜、女士太阳镜、男士光学镜和女式光学镜。眼镜款式则该该任一类别眼镜下的一款眼镜。Eyewear categories may also include, but are not limited to: Men's Sunglasses, Women's Sunglasses, Men's Optical, and Women's Optical. The glasses style should be a kind of glasses under any category of glasses.
S206、根据所述角度值确定所述眼镜款式对应的眼镜图片。S206. Determine the glasses picture corresponding to the glasses style according to the angle value.
具体实现中,移动终端可根据该角度值从图片库中搜索与该眼镜款式对应的眼镜图片。需要说明的是,图片库中可包含多个模特图片,该模特图片可佩戴各种款式的眼镜。例如,某一款眼镜,可将该眼镜进行任一角度拍摄,得到该眼镜对应的一系列眼镜图片,该眼镜图片可以角度值加以命名,从而,可有效区分这一系列眼镜图片。可选地,从图片库中搜索与所述眼镜款式对应的眼镜图片。即图片库中存储着不同款式的眼镜系列图片,每个眼镜系列图片中包含某款眼镜的任一角度的眼镜图片。In a specific implementation, the mobile terminal may search the picture library for glasses pictures corresponding to the glasses style according to the angle value. It should be noted that the picture library may contain multiple model pictures, and the model pictures may wear glasses of various styles. For example, for a certain type of glasses, the glasses can be photographed at any angle to obtain a series of glasses pictures corresponding to the glasses, and the glasses pictures can be named by angle values, so that the series of glasses pictures can be effectively distinguished. Optionally, a picture of glasses corresponding to the style of glasses is searched from a picture library. That is, the picture library stores pictures of glasses series of different styles, and each series picture of glasses contains pictures of glasses of any angle of a certain type of glasses.
S207、根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离。S207. Perform scaling processing on the glasses picture according to the proportional relationship between the second distance in the target model picture and the first distance between the center points of the two eyes in the human face, wherein the second distance is The distance between the center points of the two eyes of the model in the target model picture.
具体实现中,移动终端对人脸进行检测的过程中检测到的人脸的两眼的中心点之间的距离可为第一距离,两眼的中心点,即为每个眼镜的中心点,第二距离为目标模特图片中的模特的两眼的中心点之间的距离,第二距离与眼镜图片相匹配。可根据第一距离与第二距离之间的比例关系确定眼镜图片的缩放比例。假设第一距离为1,第二距离为2,显示第二距离为第一距离的2倍,则可将眼镜图片的比例缩小一半。In a specific implementation, the distance between the center points of the two eyes of the face detected by the mobile terminal in the process of detecting the face may be the first distance, and the center point of the two eyes is the center point of each glasses. The second distance is the distance between the center points of the two eyes of the model in the target model picture, and the second distance matches the glasses picture. The zoom ratio of the glasses picture can be determined according to the proportional relationship between the first distance and the second distance. Assuming that the first distance is 1, the second distance is 2, and the second distance is displayed as twice the first distance, the scale of the glasses picture can be reduced by half.
S208、将所述缩放处理之后的眼镜图片与所述人脸进行叠加。S208. Superimpose the zoomed glasses picture with the human face.
具体实现中,移动终端可将缩放处理后的眼镜图片叠加在人脸区域,即根据人脸中的两眼的中心点确定眼镜的摆放位置,根据该摆放位置将眼镜叠加在人脸区域。In a specific implementation, the mobile terminal can superimpose the zoomed glasses picture on the face area, that is, determine the placement position of the glasses according to the center point of the two eyes in the face, and superimpose the glasses on the face area according to the placement position .
S209、获取用户选择的场景模式。S209. Obtain the scene mode selected by the user.
可选地,移动终端可获取用户选择的场景模式,该场景模式可包括但不仅限于:咖啡厅、公园、广场、会所、海边、夕阳、晚霞。Optionally, the mobile terminal may obtain a scene mode selected by the user, and the scene mode may include but not limited to: coffee shop, park, square, clubhouse, seaside, sunset, and sunset.
S210、从预设图片库中选择与所述场景模式对应的眼镜图片叠加在所述人脸上方。S210. Select a picture of glasses corresponding to the scene mode from a preset picture library and superimpose it on the face of the person.
具体实现中,进而,移动终端可从预设图片库中选择与场景模式对应的眼镜图片叠加在所述人脸图像上方。预设图片库可包含一组或者多组图片库,例如,可对一个场景设置一个图片库。In a specific implementation, furthermore, the mobile terminal may select a picture of glasses corresponding to a scene mode from a preset picture library and superimpose it on the face image. The preset picture library may include one or more sets of picture libraries, for example, one picture library may be set for one scene.
通过本发明实施例获取用户输入的图像;对所述图像进行人脸检测;在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;确定与所述角度值和所述脸型对应的目标模特图片;获取用户选择的眼镜款式;根据所述角度值确定所述眼镜款式对应的眼镜图片;根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;将所述缩放处理之后的眼镜图片与所述人脸进行叠加;获取用户选择的场景模式;从预设图片库中选择与所述场景模式对应的眼镜图片叠加在所述人脸图像上方。从而,用户可更为直接地观察到眼镜的佩戴效果,提升了用户体验。Obtain the image input by the user through the embodiment of the present invention; perform face detection on the image; when a face is detected, determine the angle value of the face, the shape of the face, and the center point of the two eyes of the face ; Determine the target model picture corresponding to the angle value and the face shape; Obtain the glasses style selected by the user; Determine the glasses picture corresponding to the glasses style according to the angle value; According to the second distance in the target model picture The proportional relationship between the first distance and the center point of the two eyes in the human face performs scaling processing on the glasses picture, wherein the second distance is the center of the two eyes of the model in the target model picture The distance between the points; superimposing the glasses picture after the scaling process with the human face; obtaining the scene mode selected by the user; selecting the glasses picture corresponding to the scene mode from the preset picture library to be superimposed on the human face above the face image. Therefore, the user can more directly observe the wearing effect of the glasses, which improves the user experience.
请参阅图3a-图3c,其中,图3a为本发明实施例提供的一种移动终端的第一实施例结构示意图。图3a中本实施例中所描述的移动终端,包括:获取单元301、检测单元302、第一确定单元303、第二确定单元304、第三确定单元305、缩放单元306和叠加单元307,具体如下:Please refer to FIG. 3a-FIG. 3c, wherein FIG. 3a is a schematic structural diagram of a first embodiment of a mobile terminal provided by an embodiment of the present invention. The mobile terminal described in this embodiment in FIG. 3a includes: an acquisition unit 301, a detection unit 302, a first determination unit 303, a second determination unit 304, a third determination unit 305, a scaling unit 306, and a superposition unit 307, specifically as follows:
获取单元301,用于获取用户输入的图像Acquisition unit 301, configured to acquire the image input by the user
检测单元302,用于对所述获取单元301获取到的图像进行人脸检测;A detection unit 302, configured to perform face detection on the image acquired by the acquisition unit 301;
第一确定单元303,用于在所述检测单元302检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;The first determination unit 303 is configured to determine the angle value of the human face, the shape of the face, and the center point of the two eyes of the human face when the detection unit 302 detects the human face;
第二确定单元304,用于确定与所述第一确定单元303确定的角度值和脸型对应的目标模特图片。The second determination unit 304 is configured to determine a target model picture corresponding to the angle value and face shape determined by the first determination unit 303 .
获取单元301还具体用于:The obtaining unit 301 is also specifically used for:
获取用户选择的眼镜款式;Obtain the glasses style selected by the user;
第三确定单元305,用于根据所述第一确定单元303确定的角度值确定所述获取单元301获取到的眼镜款式对应的眼镜图片;The third determination unit 305 is configured to determine the glasses picture corresponding to the glasses style acquired by the acquisition unit 301 according to the angle value determined by the first determination unit 303;
缩放单元306,用于根据所述第二确定单元304确定的目标模特图片中的第二距离与所述第一确定单元确定的人脸中两眼的中心点的第一距离之间的比例关系对所述第三确定单元305确定的眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;Scaling unit 306, configured according to the proportional relationship between the second distance in the target model picture determined by the second determination unit 304 and the first distance between the center points of the two eyes in the human face determined by the first determination unit Perform zoom processing on the glasses picture determined by the third determining unit 305, wherein the second distance is the distance between the center points of the eyes of the model in the target model picture;
第一叠加单元307,用于将所述缩放单元306缩放处理之后的眼镜图片与所述检测单元302检测到的人脸进行叠加。The first superimposing unit 307 is configured to superimpose the glasses picture scaled by the scaling unit 306 with the human face detected by the detection unit 302 .
作为一种可能的实施方式,第二确定单元304具体用于:As a possible implementation manner, the second determining unit 304 is specifically configured to:
根据所述角度值从图片库中搜索与所述眼镜款式对应的眼镜图片。According to the angle value, the glasses picture corresponding to the glasses style is searched from the image library.
作为一种可能的实施方式,第一叠加单元307具体用于:As a possible implementation manner, the first superimposing unit 307 is specifically configured to:
根据所述人脸的两眼的中心点的位置关系将所述缩放处理之后的眼镜图片覆盖在所述人脸上方。The zoomed glasses picture is overlaid on the human face according to the positional relationship between the center points of the two eyes of the human face.
作为一种可能的实施方式,如图3b所示,图3a中第一确定单元303包括:选择单元3031和第一确定子单元3032,具体如下:As a possible implementation manner, as shown in FIG. 3b, the first determination unit 303 in FIG. 3a includes: a selection unit 3031 and a first determination subunit 3032, specifically as follows:
选择单元3031,用于在所述检测单元302检测到多个人脸的情况下,选择所述多个人脸中的人脸i,其中,所述人脸i为所述多个人脸中的任一人脸;A selection unit 3031, configured to select a face i among the plurality of faces when the detection unit 302 detects a plurality of faces, wherein the face i is any one of the plurality of faces Face;
第一确定子单元3032,用于确定所述选择单元3031选择的人脸i的角度值、脸型及所述人脸i中两眼的中心点。The first determining subunit 3032 is configured to determine the angle value, face shape and center point of the two eyes of the face i selected by the selection unit 3031 .
作为一种可能的实施方式,如图3c所示,图3a或图3b的获取单元还具体用于:As a possible implementation manner, as shown in FIG. 3c, the acquiring unit in FIG. 3a or FIG. 3b is also specifically used for:
获取用户选择的场景模式;Obtain the scene mode selected by the user;
移动终端还包括:Mobile terminals also include:
第二叠加单元,用于将与所述获取单元301获取到的场景模式对应的反光场景图像叠加在所述第一叠加单元307叠加之后的眼镜的镜片区域。The second superimposing unit is configured to superimpose the reflective scene image corresponding to the scene mode acquired by the acquiring unit 301 on the lens area of the glasses after being superimposed by the first superimposing unit 307 .
通过本发明实施例所描述的移动终端可获取用户输入的图像;对所述图像进行人脸检测;在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;确定与所述角度值和所述脸型对应的目标模特图片;获取用户选择的眼镜款式;根据所述角度值确定所述眼镜款式对应的眼镜图片;根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;将所述缩放处理之后的眼镜图片与所述人脸进行叠加。从而,用户可更为直接地观察到眼镜的佩戴效果,提升了用户体验。Through the mobile terminal described in the embodiment of the present invention, the image input by the user can be obtained; face detection is performed on the image; when a face is detected, the angle value of the face, the shape of the face and the face are determined the center point of the two eyes; determine the target model picture corresponding to the angle value and the face shape; obtain the glasses style selected by the user; determine the glasses picture corresponding to the glasses style according to the angle value; The proportional relationship between the second distance in the picture and the first distance between the center points of the two eyes in the human face performs scaling processing on the glasses picture, wherein the second distance is the distance in the target model picture The distance between the center points of the two eyes of the model; superimposing the zoomed glasses picture with the human face. Therefore, the user can more directly observe the wearing effect of the glasses, which improves the user experience.
请参阅图4,为本发明实施例提供的一种移动终端的第二实施例结构示意图。本实施例中所描述的移动终端,包括:至少一个输入设备1000;至少一个输出设备2000;至少一个处理器3000,例如CPU;和存储器4000,上述输入设备1000、输出设备2000、处理器3000和存储器4000通过总线5000连接。Please refer to FIG. 4 , which is a schematic structural diagram of a second embodiment of a mobile terminal provided by an embodiment of the present invention. The mobile terminal described in this embodiment includes: at least one input device 1000; at least one output device 2000; at least one processor 3000, such as a CPU; and memory 4000, the above-mentioned input device 1000, output device 2000, processor 3000 and The memory 4000 is connected via a bus 5000 .
其中,上述输入设备1000具体可为摄像头、物理按键、触摸屏、者触摸板或者触控笔。Wherein, the above-mentioned input device 1000 may specifically be a camera, a physical button, a touch screen, a touch pad or a stylus.
上述输出设备2000具体可为显示屏。The aforementioned output device 2000 may specifically be a display screen.
上述存储器4000可以是高速RAM存储器,也可为非不稳定的存储器(non-volatilememory),例如磁盘存储器。上述存储器4000用于存储一组程序代码,上述输入设备1000、输出设备2000和处理器3000用于调用存储器4000中存储的程序代码,执行如下操作:The above-mentioned memory 4000 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory. The above-mentioned memory 4000 is used to store a set of program codes, and the above-mentioned input device 1000, output device 2000 and processor 3000 are used to call the program codes stored in the memory 4000, and perform the following operations:
上述处理器3000,用于The above-mentioned processor 3000 is used for
获取用户输入的图像;Get the image entered by the user;
对所述图像进行人脸检测;Perform face detection on the image;
在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;In the case of detecting a human face, determine the angle value of the human face, the face shape and the center point of the two eyes of the human face;
确定与所述角度值和所述脸型对应的目标模特图片;Determining a target model picture corresponding to the angle value and the face shape;
获取用户选择的眼镜款式;Obtain the glasses style selected by the user;
根据所述角度值确定所述眼镜款式对应的眼镜图片;determining the glasses picture corresponding to the glasses style according to the angle value;
根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;According to the proportional relationship between the second distance in the target model picture and the first distance between the center points of the two eyes in the face, the glasses picture is scaled, wherein the second distance is the The distance between the center points of the eyes of the model in the target model image;
将所述缩放处理之后的眼镜图片与所述人脸进行叠加。and superimposing the zoomed glasses picture with the human face.
作为一种可能的实施方式,上述处理器3000在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点及所述两眼的中心点之间的第一距离包括:As a possible implementation manner, when a human face is detected, the processor 3000 determines the angle value of the human face, the shape of the face, the center point of the two eyes of the human face, and the center point of the two eyes The first distance between consists of:
在检测到多个人脸的情况下,选择所述多个人脸中的人脸i,其中,所述人脸i为所述多个人脸中的任一人脸;In the case of detecting a plurality of human faces, selecting a human face i in the plurality of human faces, wherein the human face i is any human face in the plurality of human faces;
确定所述人脸i的角度值、脸型及所述人脸i中两眼的中心点。Determine the angle value of the face i, the face shape, and the center points of the two eyes in the face i.
作为一种可能的实施方式,上述处理器3000根据所述角度值确定所述眼镜款式对应的眼镜图片包括:As a possible implementation manner, the processor 3000 determining the glasses picture corresponding to the glasses style according to the angle value includes:
根据所述角度值从图片库中搜索与所述眼镜款式对应的眼镜图片。The glasses picture corresponding to the glasses style is searched from the image library according to the angle value.
作为一种可能的实施方式,上述处理器3000将所述缩放处理之后的眼镜图片与所述人脸进行叠加包括:As a possible implementation manner, the processor 3000 superimposing the zoomed glasses picture on the human face includes:
根据所述人脸的两眼的中心点的位置关系将所述缩放处理之后的眼镜图片覆盖在所述人脸上方。The zoomed glasses picture is overlaid on the human face according to the positional relationship between the center points of the two eyes of the human face.
作为一种可能的实施方式,上述处理器3000将所述缩放处理之后的眼镜图片与所述人脸进行叠加之后,所述方法还包括:As a possible implementation manner, after the processor 3000 superimposes the zoomed glasses picture on the human face, the method further includes:
获取用户选择的场景模式;Obtain the scene mode selected by the user;
从预设图片库中选择与所述场景模式对应的眼镜图片叠加在所述人脸上方。A picture of glasses corresponding to the scene mode is selected from a preset picture library and superimposed on the face of the person.
具体实现中,本发明实施例中所描述的输入设备1000、输出设备2000和处理器3000可执行本发明实施例提供的一种虚拟眼镜试戴方法的第一实施例和第二实施例中所描述的实现方式,也可执行本发明实施例提供的一种移动终端的第一实施例中所描述的终端的实现方式,在此不再赘述。In specific implementation, the input device 1000, the output device 2000 and the processor 3000 described in the embodiment of the present invention can execute the method described in the first embodiment and the second embodiment of a virtual glasses try-on method provided by the embodiment of the present invention. The described implementation manner may also execute the implementation manner of the terminal described in the first embodiment of a mobile terminal provided by the embodiment of the present invention, which will not be repeated here.
通过本发明实施例所描述的移动终端可获取用户输入的图像;对所述图像进行人脸检测;在检测到人脸的情况下,确定所述人脸的角度值、脸型及所述人脸的两眼的中心点;确定与所述角度值和所述脸型对应的目标模特图片;获取用户选择的眼镜款式;根据所述角度值确定所述眼镜款式对应的眼镜图片;根据所述目标模特图片中的第二距离与所述人脸中两眼的中心点的第一距离之间的比例关系对所述眼镜图片进行缩放处理,其中,所述第二距离为所述目标模特图片中的模特的两眼的中心点之间距离;将所述缩放处理之后的眼镜图片与所述人脸进行叠加。从而,用户可更为直接地观察到眼镜的佩戴效果,提升了用户体验。Through the mobile terminal described in the embodiment of the present invention, the image input by the user can be obtained; face detection is performed on the image; when a face is detected, the angle value of the face, the shape of the face and the face are determined the center point of the two eyes; determine the target model picture corresponding to the angle value and the face shape; obtain the glasses style selected by the user; determine the glasses picture corresponding to the glasses style according to the angle value; The proportional relationship between the second distance in the picture and the first distance between the center points of the two eyes in the human face performs scaling processing on the glasses picture, wherein the second distance is the distance in the target model picture The distance between the center points of the two eyes of the model; superimposing the zoomed glasses picture with the human face. Therefore, the user can more directly observe the wearing effect of the glasses, which improves the user experience.
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的任意一种信号处理方法的部分或全部步骤。An embodiment of the present invention also provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all steps of any one of the signal processing methods described in the above method embodiments when executed.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。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.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可能可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they 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 according to the present invention, certain steps may be carried out in other order 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 several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the above units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本发明各个实施例上述方法的全部或部分步骤。其中,而前述的存储介质可包括:U盘、移动硬盘、磁碟、光盘、只读存储器(英文:Read-OnlyMemory,缩写:ROM)或者随机存取存储器(英文:RandomAccessMemory,缩写:RAM)等各种可以存储程序代码的介质。If the above integrated units are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, server, or network device, etc., specifically, a processor in the computer device) execute all or part of the steps of the above-mentioned methods in various embodiments of the present invention. Wherein, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disc, read-only memory (English: Read-OnlyMemory, abbreviation: ROM) or random access memory (English: RandomAccessMemory, abbreviation: RAM), etc. Various media that can store program code.
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions recorded in each embodiment are modified, or some of the technical features are replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510707664.6A CN105354792B (en) | 2015-10-27 | 2015-10-27 | A kind of virtual glasses try-on method and mobile terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510707664.6A CN105354792B (en) | 2015-10-27 | 2015-10-27 | A kind of virtual glasses try-on method and mobile terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105354792A true CN105354792A (en) | 2016-02-24 |
CN105354792B CN105354792B (en) | 2019-05-28 |
Family
ID=55330759
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510707664.6A Active CN105354792B (en) | 2015-10-27 | 2015-10-27 | A kind of virtual glasses try-on method and mobile terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105354792B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106203364A (en) * | 2016-07-14 | 2016-12-07 | 广州帕克西软件开发有限公司 | System and method is tried in a kind of 3D glasses interaction on |
CN106843677A (en) * | 2016-12-29 | 2017-06-13 | 华勤通讯技术有限公司 | A kind of method for displaying image of Virtual Reality glasses, equipment and terminal |
CN107563874A (en) * | 2017-09-14 | 2018-01-09 | 广州便雅悯视光网络科技有限公司 | The virtual try-in method and device of a kind of sunglasses |
CN107945102A (en) * | 2017-10-23 | 2018-04-20 | 深圳市朗形网络科技有限公司 | A method and device for image synthesis |
CN108319943A (en) * | 2018-04-25 | 2018-07-24 | 北京优创新港科技股份有限公司 | A method of human face recognition model performance under the conditions of raising is worn glasses |
CN108376252A (en) * | 2018-02-27 | 2018-08-07 | 广东欧珀移动通信有限公司 | Control method, control device, terminal, computer device, and storage medium |
CN109660717A (en) * | 2018-11-26 | 2019-04-19 | 深圳艺达文化传媒有限公司 | From the stacking method and Related product of the earphone image that shoots the video |
CN109978655A (en) * | 2019-01-14 | 2019-07-05 | 明灏科技(北京)有限公司 | A kind of virtual frame matching method and system |
CN114489326A (en) * | 2021-12-30 | 2022-05-13 | 南京七奇智能科技有限公司 | Crowd-oriented gesture control device and method driven by virtual human interaction attention |
US11335028B2 (en) | 2018-02-27 | 2022-05-17 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Control method based on facial image, related control device, terminal and computer device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1971607A (en) * | 2006-12-04 | 2007-05-30 | 谢亦玲 | Picture database processing method for computerized glasses fitting system and glasses fitting device |
CN103413118A (en) * | 2013-07-18 | 2013-11-27 | 毕胜 | On-line glasses try-on method |
CN103456008A (en) * | 2013-08-26 | 2013-12-18 | 刘晓英 | Method for matching face and glasses |
US20140240354A1 (en) * | 2013-02-28 | 2014-08-28 | Samsung Electronics Co., Ltd. | Augmented reality apparatus and method |
CN104299143A (en) * | 2014-10-20 | 2015-01-21 | 上海电机学院 | Virtual try-in method and device |
CN104992464A (en) * | 2015-06-19 | 2015-10-21 | 上海卓易科技股份有限公司 | Virtual garment try-on system and garment try-on method |
-
2015
- 2015-10-27 CN CN201510707664.6A patent/CN105354792B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1971607A (en) * | 2006-12-04 | 2007-05-30 | 谢亦玲 | Picture database processing method for computerized glasses fitting system and glasses fitting device |
US20140240354A1 (en) * | 2013-02-28 | 2014-08-28 | Samsung Electronics Co., Ltd. | Augmented reality apparatus and method |
CN103413118A (en) * | 2013-07-18 | 2013-11-27 | 毕胜 | On-line glasses try-on method |
CN103456008A (en) * | 2013-08-26 | 2013-12-18 | 刘晓英 | Method for matching face and glasses |
CN104299143A (en) * | 2014-10-20 | 2015-01-21 | 上海电机学院 | Virtual try-in method and device |
CN104992464A (en) * | 2015-06-19 | 2015-10-21 | 上海卓易科技股份有限公司 | Virtual garment try-on system and garment try-on method |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106203364B (en) * | 2016-07-14 | 2019-05-24 | 广州帕克西软件开发有限公司 | System and method is tried in a kind of interaction of 3D glasses on |
CN106203364A (en) * | 2016-07-14 | 2016-12-07 | 广州帕克西软件开发有限公司 | System and method is tried in a kind of 3D glasses interaction on |
CN106843677A (en) * | 2016-12-29 | 2017-06-13 | 华勤通讯技术有限公司 | A kind of method for displaying image of Virtual Reality glasses, equipment and terminal |
CN107563874A (en) * | 2017-09-14 | 2018-01-09 | 广州便雅悯视光网络科技有限公司 | The virtual try-in method and device of a kind of sunglasses |
CN107945102A (en) * | 2017-10-23 | 2018-04-20 | 深圳市朗形网络科技有限公司 | A method and device for image synthesis |
US11335028B2 (en) | 2018-02-27 | 2022-05-17 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Control method based on facial image, related control device, terminal and computer device |
CN108376252A (en) * | 2018-02-27 | 2018-08-07 | 广东欧珀移动通信有限公司 | Control method, control device, terminal, computer device, and storage medium |
CN108319943B (en) * | 2018-04-25 | 2021-10-12 | 北京优创新港科技股份有限公司 | Method for improving face recognition model performance under wearing condition |
CN108319943A (en) * | 2018-04-25 | 2018-07-24 | 北京优创新港科技股份有限公司 | A method of human face recognition model performance under the conditions of raising is worn glasses |
CN109660717A (en) * | 2018-11-26 | 2019-04-19 | 深圳艺达文化传媒有限公司 | From the stacking method and Related product of the earphone image that shoots the video |
CN109978655A (en) * | 2019-01-14 | 2019-07-05 | 明灏科技(北京)有限公司 | A kind of virtual frame matching method and system |
CN114489326A (en) * | 2021-12-30 | 2022-05-13 | 南京七奇智能科技有限公司 | Crowd-oriented gesture control device and method driven by virtual human interaction attention |
CN114489326B (en) * | 2021-12-30 | 2023-12-15 | 南京七奇智能科技有限公司 | Crowd-oriented virtual human interaction attention driven gesture control device and method |
Also Published As
Publication number | Publication date |
---|---|
CN105354792B (en) | 2019-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105354792A (en) | A virtual glasses try-on method and mobile terminal | |
CN110113534B (en) | Image processing method, image processing device and mobile terminal | |
TWI751161B (en) | Terminal equipment, smart phone, authentication method and system based on face recognition | |
US9575559B2 (en) | Gaze-assisted touchscreen inputs | |
CN104699958B (en) | A kind of method and device for recommending menu according to user's body situation | |
CN105068646B (en) | The control method and system of terminal | |
CN107590474B (en) | Unlock control method and related products | |
WO2016078296A1 (en) | Garment try-on method and apparatus | |
CN111415185B (en) | Business processing method, device, terminal and storage medium | |
CN107527046A (en) | Solve lock control method and Related product | |
CN114175113A (en) | Electronic device for providing avatar and operation method thereof | |
CN106951750A (en) | Method for switching modes of mobile terminal and mobile terminal | |
CN110427108A (en) | Photographic method and Related product based on eyeball tracking | |
CN107172347A (en) | A kind of photographic method and terminal | |
CN113116291A (en) | Calibration and calibration method and device for eyeball tracking, mobile terminal and storage medium | |
CN106251191A (en) | The display control method of a kind of terminal screen and terminal | |
CN111612780B (en) | Human eye vision recognition method, device and computer storage medium | |
CN109479087B (en) | Image processing method and device | |
CN112989198B (en) | Push content determination method, device, equipment and computer-readable storage medium | |
CN109101523A (en) | A kind of image processing method, device and electronic equipment | |
CN110020903A (en) | Method and device for simulating user trial installation, storage medium and mobile terminal | |
US10304120B2 (en) | Merchandise sales service device based on dynamic scene change, merchandise sales system based on dynamic scene change, method for selling merchandise based on dynamic scene change and non-transitory computer readable storage medium having computer program recorded thereon | |
CN111429209A (en) | Method, device and server for multi-user virtual shopping | |
WO2020135397A1 (en) | Screen display control method and apparatus | |
CN108932704B (en) | Picture processing method, picture processing device and terminal equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |