Movatterモバイル変換


[0]ホーム

URL:


CN115239576B - Photo optimization method, electronic equipment and storage medium - Google Patents

Photo optimization method, electronic equipment and storage medium
Download PDF

Info

Publication number
CN115239576B
CN115239576BCN202210682176.4ACN202210682176ACN115239576BCN 115239576 BCN115239576 BCN 115239576BCN 202210682176 ACN202210682176 ACN 202210682176ACN 115239576 BCN115239576 BCN 115239576B
Authority
CN
China
Prior art keywords
photo
person
electronic device
historical
image
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.)
Active
Application number
CN202210682176.4A
Other languages
Chinese (zh)
Other versions
CN115239576A (en
Inventor
邓锋贤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co LtdfiledCriticalHonor Device Co Ltd
Priority to CN202210682176.4ApriorityCriticalpatent/CN115239576B/en
Priority to CN202310924224.0Aprioritypatent/CN117237204A/en
Publication of CN115239576ApublicationCriticalpatent/CN115239576A/en
Application grantedgrantedCritical
Publication of CN115239576BpublicationCriticalpatent/CN115239576B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The application provides a photo optimization method, electronic equipment and a storage medium, relates to the field of image processing, and solves the problem that a person image is poor in imaging effect due to adverse effects of the environment on a photo shot by the electronic equipment. The method comprises the following steps: after the electronic device obtains the first photo, the electronic device may obtain first feature information of a first person to which the first face image belongs in the first photo under the condition that the first photo includes the face image. The first feature information at least comprises face feature information of a first person. Then, the electronic device acquires a first three-dimensional model matched with the first characteristic information. The first three-dimensional model is used for representing three-dimensional characteristics of a first person in a historical photo corresponding to the first person; the three-dimensional features include at least three-dimensional features of a face. Finally, the electronic device fuses the first three-dimensional model with the image of the first person in the first photo to optimize the image of the first person in the first photo to obtain a second photo.

Description

Translated fromChinese
一种照片优化方法、电子设备和存储介质A photo optimization method, electronic device and storage medium

技术领域technical field

本申请涉及电子设备图像处理领域,尤其涉及一种照片优化方法、电子设备和存储介质。The present application relates to the field of image processing of electronic equipment, in particular to a photo optimization method, electronic equipment and storage media.

背景技术Background technique

目前,随着技术的发展,拍照已经是电子设备(例如手机)必备的功能了。在光线充足或者适合拍照的环境下,智能手机基本都能够拍照出清晰的人像。而在一些不利于拍照的场景下,例如逆光、暗光等场景下,用户使用电子设备拍摄的照片的人像的成像质量较差,用户体验不好。At present, with the development of technology, taking pictures has become an essential function of electronic devices (such as mobile phones). In an environment with sufficient light or suitable for taking pictures, smartphones can basically take clear portraits. However, in some scenes that are not conducive to taking pictures, such as backlight, dark light and other scenes, the image quality of the portrait taken by the user using the electronic device is poor, and the user experience is not good.

发明内容Contents of the invention

本申请实施例提供一种照片优化方法、电子设备和存储介质,解决了电子设备拍摄的照片因为环境的不利影响,导致人物图像的成像效果不好的问题。The embodiments of the present application provide a photo optimization method, an electronic device, and a storage medium, which solve the problem that the photograph taken by the electronic device has a bad imaging effect of a person image due to adverse effects of the environment.

为达到上述目的,本申请的实施例采用如下技术方案:In order to achieve the above object, the embodiments of the present application adopt the following technical solutions:

第一方面,本申请提供了一种照片优化方法,该方法可以应用于电子设备。该方法中,电子设备在获取第一照片后,电子设备可以在第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息。其中,第一特征信息至少包括第一人物的人脸特征信息。然后,电子设备获取与第一特征信息匹配的第一三维模型。其中,第一三维模型用于表征第一人物对应的历史照片中,第一人物的三维特征;三维特征至少包括人脸三维特征。最后,电子设备则将第一三维模型与第一照片中第一人物的图像进行融合,以对第一照片中第一人物的图像进行优化,得到第二照片。In a first aspect, the present application provides a photo optimization method, which can be applied to electronic devices. In this method, after the electronic device obtains the first photo, the electronic device may obtain the first feature information of the first person to whom the first face image in the first photo belongs under the condition that the first photo includes a face image. Wherein, the first feature information includes at least face feature information of the first person. Then, the electronic device acquires the first three-dimensional model matched with the first feature information. Wherein, the first 3D model is used to represent the 3D features of the first person in the historical photos corresponding to the first person; the 3D features at least include the 3D features of the face. Finally, the electronic device fuses the first three-dimensional model with the image of the first person in the first photo to optimize the image of the first person in the first photo to obtain the second photo.

基于上述方案,电子设备可以获取到某张照片时,获取到对应该照片中人脸图像所属的人物图像的三维模型。进而利用该三维模型,对该照片中的人物图像进行优化,得到优化后的照片。因为该三维模型是表征反映出该人物对应的历史照片中,该人物的三维特征的。而多个历史照片中该人物的图像的细节信息,则必然会比电子设备当前拍摄的照片中该人物的图像体现的细节更多。所以,该方案最终优化后的照片中,人物图像的细节信息会更丰富,人物图像也会更加清晰。这样,即便该照片因为拍摄时的环境不利于拍照导致人物图像不够清晰,通过本申请提供的技术方案也可以通过对该照片中的人物图像进行优化,得到人物图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the above solution, when the electronic device acquires a certain photo, it can acquire a three-dimensional model corresponding to the person image to which the face image in the photo belongs. Further, the three-dimensional model is used to optimize the person image in the photo to obtain an optimized photo. Because the three-dimensional model represents and reflects the three-dimensional features of the person in the historical photos corresponding to the person. The detailed information of the image of the person in the multiple historical photos will inevitably reflect more details than the image of the person in the photo currently taken by the electronic device. Therefore, in the final optimized photo of this solution, the detail information of the person image will be richer, and the person image will be clearer. In this way, even if the image of the person in the photo is not clear enough due to the unfavorable environment when the photo is taken, the technical solution provided by the application can also optimize the image of the person in the photo to obtain a photo with better imaging quality of the image of the person. It also improves the user experience.

在第一方面的一种可能的实现方式中,电子设备获取第一照片,包括:电子设备接收拍照操作;电子设备响应于拍照操作,获取第一照片。In a possible implementation manner of the first aspect, the acquiring the first photo by the electronic device includes: the electronic device receives a photographing operation; and the electronic device acquires the first photo in response to the photographing operation.

这样一来,电子设备在拍照得到第一照片后,便可以在该照片中包括人脸图像的情况下,及时利用该照片中人脸图像所属人物的三维模型,对该照片中的人物图像进行优化,得到优化后的照片。因为该三维模型是能够表征出该人物对应的历史照片中该人物三维特征的。而多个历史照片中该人物的图像的细节信息,则必然会比手机当前拍摄的照片中该人物的图像体现的细节更多。所以,该方案最终优化后的照片中,人物图像的细节信息会更丰富,人物图像也会更加清晰。这样,即便用户使用手机拍照时的环境不利于拍照,也可以得到人物图像的成像质量较好的照片,也就提高了用户的使用体验。In this way, after the electronic device obtains the first photo by taking pictures, it can use the three-dimensional model of the person whose face image in the photo belongs to in a timely manner under the condition that the photo includes a face image to perform Optimize to get optimized photos. Because the three-dimensional model can represent the three-dimensional features of the person in the historical photos corresponding to the person. And the detail information of the image of the person in the multiple historical photos will inevitably reflect more details than the image of the person in the photo currently taken by the mobile phone. Therefore, in the final optimized photo of this solution, the detail information of the person image will be richer, and the person image will be clearer. In this way, even if the environment when the user uses the mobile phone to take pictures is not conducive to taking pictures, the pictures with better imaging quality of the person images can be obtained, which improves the user experience.

在第一方面的另一种可能的实现方式中,电子设备响应于拍照操作,获取第一照片之前,方法还包括:电子设备响应于用户对相机应用图标的触发操作,显示相机预览界面,并实时确定相机预览界面中是否包括人脸图像;其中,相机预览界面用于预览电子设备的摄像头的拍摄画面;其中,第一照片中是否包括人脸图像,是电子设备接收拍照操作前最新一次对相机预览界面中是否包括人脸图像的确定结果。In another possible implementation manner of the first aspect, before the electronic device acquires the first photo in response to the photographing operation, the method further includes: the electronic device displays a camera preview interface in response to a user's trigger operation on the camera application icon, and Determine in real time whether the face image is included in the camera preview interface; wherein, the camera preview interface is used to preview the shooting picture of the camera of the electronic device; wherein, whether the face image is included in the first photo is the last time the electronic device receives the photographing operation. The determination result of whether the face image is included in the camera preview interface.

基于上述方案,电子设备在拍照得到第一照片前,会实时对相机预览界面中是否包括人脸图像进行判定。后续在得到第一照片时,便可以直接确定第一照片中是否包括人脸图像,进而决定是否执行后续的照片优化方案。这样一来,因为电子设备不需要在拍照后再判定照片中是否包括人脸图像,而是拍照得到照片时便可以知晓照片中是否包括人脸图像,节省了得到照片后的照片优化流程中判定是否包括人脸图像的步骤。所以该方案提高了照片优化方案的效率。Based on the above solution, before the electronic device takes a photo and obtains the first photo, it will judge whether the face image is included in the camera preview interface in real time. When the first photo is obtained later, it can directly determine whether the first photo includes a face image, and then decide whether to execute the subsequent photo optimization scheme. In this way, because the electronic device does not need to determine whether the photo includes a face image after taking the photo, it can know whether the photo includes a face image when the photo is taken, which saves the need to determine whether the photo includes a face image after the photo is obtained. Whether to include the face image step. Therefore, the scheme improves the efficiency of the photo optimization scheme.

在第一方面的另一种可能的实现方式中,电子设备获取第一照片,包括:电子设备响应于用户对图库展示界面中第一目标照片的优化操作,将第一目标照片确定为第一照片。In another possible implementation manner of the first aspect, the acquiring the first photo by the electronic device includes: the electronic device determines the first target photo as the first target photo in response to the user's optimization operation on the first target photo in the gallery display interface. photo.

基于上述方案,电子设备可以在用户指示对本地图库中的目标照片进行优化时(即对目标照片实施优化操作),可以先获取到对应该照片中人脸图像所属的人物的三维模型。进而利用该三维模型,对该照片中的人物的图像进行优化,得到优化后的照片。因为该三维模型是表征反映出该人物图像对应的历史照片中,对应该人物图像的人物的三维特征的。而多个历史照片中该人物图像对应的人物的细节信息,则必然会比电子设备当前拍摄的照片中该人物图像体现的细节更多。所以,该方案最终优化后的照片中,人物图像的细节信息会更丰富,人物的图像也会更加清晰。这样,即便电子设备已存储的目标照片在拍摄时的环境不利于拍照,也可以通过电子设备后续的优化得到人物图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the above solution, when the user instructs to optimize the target photo in the local gallery (that is, to perform an optimization operation on the target photo), the electronic device can first obtain the 3D model corresponding to the person whose face image in the photo belongs to. Furthermore, the three-dimensional model is used to optimize the image of the person in the photo to obtain an optimized photo. Because the three-dimensional model represents and reflects the three-dimensional features of the person corresponding to the person image in the historical photos corresponding to the person image. And the detail information of the person corresponding to the person image in the multiple historical photos must be more detailed than the person image in the current photo taken by the electronic device. Therefore, in the final optimized photo of the scheme, the detail information of the person image will be richer, and the image of the person will be clearer. In this way, even if the environment of the target photo stored in the electronic device is not conducive to taking pictures, the subsequent optimization of the electronic device can obtain a photo with better imaging quality of the person image, which improves the user experience.

在第一方面的另一种可能的实现方式中,电子设备获取与第一特征信息匹配的第一三维模型之前,该方法还包括:电子设备获取当前时刻之前至少一个历史照片集合;其中,每个历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;历史照片集合中的每张历史照片中均包括历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联第一人物的第一历史照片集合;电子设备根据历史照片集合,确定历史照片集合关联的人物的三维特征;其中,三维特征至少包括人脸三维特征;电子设备根据历史照片集合关联的人物的三维特征,构建历史照片集合关联的人物的三维模型。In another possible implementation manner of the first aspect, before the electronic device obtains the first three-dimensional model that matches the first feature information, the method further includes: the electronic device obtains at least one historical photo collection before the current moment; wherein, each Each historical photo collection is associated with a person, and different historical photo collections are associated with different people; each historical photo in the historical photo collection includes the image of the person associated with the historical photo collection; at least one historical photo collection includes the associated No. The first historical photo collection of a person; the electronic device determines the three-dimensional characteristics of the person associated with the historical photo collection according to the historical photo collection; wherein, the three-dimensional characteristics include at least the three-dimensional characteristics of the face; the electronic device determines the three-dimensional characteristics of the person associated with the historical photo collection , to construct a 3D model of a person associated with a collection of historical photos.

基于上述方案,电子设备可以提前构建好历史照片中对应的各个人物的三维模型,方便后续需要对拍摄的照片进行优化时使用。这样一来,可以使得电子设备在对拍摄的照片或者已存储的照片进行优化时,可以顺利快捷的获取到需要的三维模型,提高了照片优化的效率。Based on the above solution, the electronic device can build a three-dimensional model of each person corresponding to the historical photos in advance, which is convenient for subsequent use when the photos taken need to be optimized. In this way, the electronic device can smoothly and quickly obtain the required three-dimensional model when optimizing the captured photos or the stored photos, which improves the efficiency of photo optimization.

在第一方面的另一种可能的实现方式中,电子设备根据历史照片集合,确定历史照片集合对应的人物的三维特征,包括:电子设备根据历史照片集合中每个历史照片的成像质量参数,从历史照片集合中选择出至少一个第二目标照片;成像质量参数包括:分辨率、历史照片集合关联的人物的图像的完整程度;至少一个第二第一目标照片的成像质量参数高于历史照片集合中其他照片的成像质量参数;电子设备从第二目标照片,提取历史照片集合关联的人物的三维特征。In another possible implementation manner of the first aspect, the electronic device determines the three-dimensional features of the person corresponding to the historical photo collection according to the historical photo collection, including: the electronic device according to the imaging quality parameters of each historical photo in the historical photo collection, At least one second target photo is selected from the historical photo collection; the imaging quality parameters include: resolution, the completeness of the image of the person associated with the historical photo collection; the imaging quality parameter of at least one second first target photo is higher than that of the historical photo Imaging quality parameters of other photos in the collection; the electronic device extracts three-dimensional features of people associated with the historical photo collection from the second target photo.

因为对于成像质量不好的历史照片而言,其中人物的图像的成像质量必然也是比较差的,所以对每个历史照片进行特征提取是较为浪费电子设备的计算资源的。基于此,本申请提供得的上述技术方案中,电子设备可以从历史照片集合中选择成像质量参数较高的第二目标照片,作为提取三维特征的基础。这样一来,电子设备便可以以尽可能少的计算资源提取到历史照片集合关联的人物的三维特征,节省了电子设备的计算资源。Because for historical photos with poor imaging quality, the imaging quality of images of people in them must be relatively poor, so performing feature extraction on each historical photo is a waste of computing resources of electronic devices. Based on this, in the above technical solution provided by the present application, the electronic device may select a second target photo with a higher imaging quality parameter from the historical photo collection as a basis for extracting three-dimensional features. In this way, the electronic device can extract the three-dimensional features of the people associated with the historical photo collection with as few computing resources as possible, saving the computing resources of the electronic device.

在第一方面的另一种可能的实现方式中,电子设备获取第一照片之后,该方法还包括:电子设备将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合;电子设备根据第二历史照片集合,重新确定第一人物的三维特征;电子设备根据重新确定的第一人物的三维特征,重新构建第一人物的三维模型。In another possible implementation manner of the first aspect, after the electronic device obtains the first photo, the method further includes: the electronic device adds the first photo to the first historical photo collection associated with the first person to update The first set of historical photos is used to obtain a second set of historical photos; the electronic device re-determines the 3D features of the first person according to the second set of historical photos; the electronic device reconstructs the 3D features of the first person based on the re-determined 3D features of the first person 3D model.

基于上述方案,电子设备在对拍摄的照片中的某个人物的图像(例如第一人物的图像)进行优化后,可以将拍摄的照片(如第一照片)作为历史照片添加进该人物关联的历史照片集合中。进而可以利用更新后的该人物关联的历史照片集合得到该人物的更新后的三维模型,使得后续再需要对该人物的图像进行优化时的优化效果更好。Based on the above scheme, after the electronic device optimizes the image of a certain person in the captured photo (such as the image of the first person), it can add the captured photo (such as the first photo) as a historical photo to the person's associated in the collection of historical photographs. Furthermore, the updated 3D model of the person can be obtained by using the updated collection of historical photos associated with the person, so that the subsequent optimization of the image of the person is better.

在第一方面的另一种可能的实现方式中,电子设备在第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息之后,该方法还包括:电子设备在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合;电子设备根据第一历史照片集合,确定第一人物的三维特征;电子设备根据第一人物的三维特征,构建第一人物的三维模型。In another possible implementation of the first aspect, if the first photo includes a face image, after the electronic device acquires the first characteristic information of the first person to whom the first face image in the first photo belongs , the method further includes: when the first three-dimensional model is not obtained, the electronic device uses the first photo to construct a first historical photo collection associated with the first person; the electronic device determines the first person's Three-dimensional features: the electronic device constructs a three-dimensional model of the first character according to the three-dimensional features of the first character.

在一些实施例中,对于拍摄得到的第一人物而言,若电子设备之前未对其拍摄过,也未存储过第一人物的三维特征或三维模型,则电子设备将无法对第一照片中的第一人物的图像进行优化。所以为了后续可以对手机拍摄的照片或者存储的照片中第一人物的图像进行优化,基于上述技术方案提到的,电子设备可以利用当前的第一照片建立关联第一人物的第一历史照片集合,得到第一人物的三维特征,进而得到第一人物的三维模型。从而方便后续电子设备在需要对第一人物的图像进行优化时,可以顺利得到第一人物的三维模型,完成照片优化,提高用户使用体验。In some embodiments, for the captured first person, if the electronic device has not photographed it before, and has not stored the 3D features or 3D model of the first person, the electronic device will not be able to analyze the first person in the first photo. The image of the first person is optimized. Therefore, in order to subsequently optimize the image of the first person in the photo taken by the mobile phone or stored in the photo, based on the above technical solution, the electronic device can use the current first photo to establish a first historical photo collection associated with the first person , to obtain the 3D features of the first person, and then obtain the 3D model of the first person. In this way, it is convenient for the subsequent electronic device to successfully obtain the 3D model of the first person when it needs to optimize the image of the first person, complete photo optimization, and improve user experience.

在第一方面的另一种可能的实现方式中,电子设备获取与第一特征信息匹配的第一三维模型,包括:电子设备获取与第一特征信息匹配的第一三维特征;第一三维特征为第一人物对应的历史照片中,第一人物的三维特征;电子设备利用第一三维特征,构建第一三维模型。In another possible implementation manner of the first aspect, the acquiring the first 3D model matching the first feature information by the electronic device includes: acquiring the first 3D feature matching the first feature information by the electronic device; In the historical photos corresponding to the first person, the 3D features of the first person; the electronic device constructs the first 3D model by using the first 3D features.

实际中,若直接利用第一特征信息与多个三维模型进行匹配,来寻找第一三维模型。则需要先从三维模型中获取可以比对的特征信息后,才能进行匹配,匹配过程繁琐麻烦。所以为了提高匹配效率,进而提高照片优化效率。基于上述方案所提到的,在本申请中,电子设备可以是先获取到第一特征信息匹配的第一三维特征,之后根据该第一三维特征构建得到第一三维模型。In practice, if the first feature information is directly used to match multiple 3D models, the first 3D model is found. It is necessary to obtain the feature information that can be compared from the 3D model before matching, and the matching process is cumbersome and troublesome. Therefore, in order to improve the matching efficiency, and then improve the photo optimization efficiency. Based on what is mentioned in the above solution, in this application, the electronic device may first obtain the first 3D feature matched with the first feature information, and then construct the first 3D model according to the first 3D feature.

在第一方面的另一种可能的实现方式中,电子设备在第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息之前,方法还包括:电子设备获取当前时刻之前至少一个历史照片集合;其中,每个历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;历史照片集合中的每张历史照片中均存在历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联第一人物的第一历史照片集合;电子设备根据历史照片集合,确定历史照片集合关联的人物的三维特征;其中,三维特征至少包括人脸三维特征。In another possible implementation manner of the first aspect, if the first photo includes a face image, before the electronic device acquires the first feature information of the first person to whom the first face image in the first photo belongs , the method also includes: the electronic device obtains at least one historical photo collection before the current moment; wherein, each historical photo collection is associated with a person, and different historical photo collections are associated with different characters; each historical photo in the historical photo collection There are images of people associated with the historical photo collection; at least one historical photo collection includes the first historical photo collection associated with the first person; the electronic device determines the three-dimensional characteristics of the person associated with the historical photo collection according to the historical photo collection; wherein, the three-dimensional The features include at least three-dimensional features of the human face.

及时雨上述方案,电子设备可以提前确定历史照片中关联的各个人物的三维特征,方便后续电子设备需要对照片进行优化时顺利的获取第一三维特征,进而构建得到第一三维模型。这样,也就使得电子设备在对拍摄照片进行优化时,可以快捷的获取到需要的三维模型,提高了照片优化的效率。With the above solution in place, the electronic device can determine the 3D features of each person associated with the historical photos in advance, so that the subsequent electronic device can smoothly obtain the first 3D features when it needs to optimize the photos, and then construct the first 3D model. In this way, the electronic device can quickly obtain the required three-dimensional model when optimizing the photo taken, which improves the efficiency of photo optimization.

在第一方面的另一种可能的实现方式中,电子设备获取第一照片之后,该方法还包括:电子设备将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合;电子设备根据第二历史照片集合,重新确定第一人物的三维特征。In another possible implementation manner of the first aspect, after the electronic device obtains the first photo, the method further includes: the electronic device adds the first photo to the first historical photo collection associated with the first person to update The first set of historical photos is used to obtain the second set of historical photos; the electronic device re-determines the three-dimensional features of the first person according to the second set of historical photos.

基于上述技术方案,电子设备在对拍摄的照片中的某个人物的图像(例如第一人物的图像)进行优化后,可以将拍摄的照片作为历史照片添加进该人物对应的历史照片集合中。进而得到该人物的更新后的三维特征,使得后续再需要对某个照片中该人物的图像进行优化时可以构建得到更准确的三维模型,提高照片优化效果。Based on the above technical solution, after the electronic device optimizes the image of a certain person (for example, the image of the first person) in the captured photo, it can add the captured photo as a historical photo to the historical photo collection corresponding to the person. Then, the updated 3D features of the person are obtained, so that when the image of the person in a certain photo needs to be optimized later, a more accurate 3D model can be constructed to improve the effect of photo optimization.

在第一方面的另一种可能的实现方式中,电子设备在第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息之后,方法还包括:电子设备在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合;电子设备根据第一历史照片集合,确定第一人物的三维特征。In another possible implementation of the first aspect, if the first photo includes a face image, after the electronic device acquires the first characteristic information of the first person to whom the first face image in the first photo belongs , the method further includes: when the first three-dimensional model is not acquired, the electronic device uses the first photo to construct a first historical photo collection associated with the first person; the electronic device determines the first person's three-dimensional image according to the first historical photo collection feature.

基于上述技术方案,电子设备在因为无法获取到第一照片中的某个人物(即第一人物)的人物图像的三维特征,而无法构建相应的三维模型的情况下,可以利用该第一照片建立相应的历史照片集合,进而得到三维特征。从而使得电子设备后续在需要对新得到的照片中该人物的图像进行优化时,可以顺利得到三维特征,进而构建相应的三维模型,从而完成相应的照片优化流程,提高用户使用体验。Based on the above technical solution, when the electronic device cannot construct a corresponding three-dimensional model because the three-dimensional features of the character image of a certain person (namely the first person) in the first photo cannot be obtained, the electronic device can use the first photo Establish the corresponding historical photo collection, and then get the three-dimensional features. Therefore, when the electronic device subsequently needs to optimize the image of the person in the newly obtained photo, it can successfully obtain the three-dimensional features, and then build a corresponding three-dimensional model, thereby completing the corresponding photo optimization process and improving user experience.

在第一方面的另一种可能的实现方式中,电子设备获取第一照片之后,该方法还包括:In another possible implementation manner of the first aspect, after the electronic device acquires the first photo, the method further includes:

电子设备在第一照片中包括人脸图像的情况下,获取第二人脸图像所属的第二人物的第二特征信息;其中,第二人物和第一人物不同,第二特征信息至少包括第二人物的人脸特征信息;电子设备获取与第二特征信息匹配的第二三维模型;其中,第二三维模型用于表征第二人物对应的历史照片中,第二人物的三维特征;电子设备将第二三维模型与第一照片中第二人物的图像进行融合,以对第一照片中第二人物的图像进行优化,得到第三照片。In the case that the first photo includes a face image, the electronic device acquires second characteristic information of a second person to whom the second human face image belongs; wherein, the second person is different from the first person, and the second characteristic information includes at least the first person. The facial feature information of the second person; the electronic device acquires a second three-dimensional model that matches the second characteristic information; wherein, the second three-dimensional model is used to represent the three-dimensional features of the second person in the historical photos corresponding to the second person; the electronic device The second three-dimensional model is fused with the image of the second person in the first photo to optimize the image of the second person in the first photo to obtain a third photo.

基于上述技术方案,针对第一照片中的每个人物图像,电子设备均可以利用相应的三维模型进行优化。所以,该方案最终优化后的照片中,人物图像的细节信息会更丰富,人物图像也会更加清晰。这样,即便电子设备已存储的目标照片在拍摄时的环境不利于拍照,也可以通过电子设备后续的优化得到人物图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the above technical solution, for each character image in the first photo, the electronic device can be optimized using a corresponding three-dimensional model. Therefore, in the final optimized photo of this solution, the detail information of the person image will be richer, and the person image will be clearer. In this way, even if the environment of the target photo stored in the electronic device is not conducive to taking pictures, the subsequent optimization of the electronic device can obtain a photo with better imaging quality of the person image, which improves the user experience.

在第一方面的另一种可能的实现方式中,该方法还包括:电子设备将第一照片和第四照片进行融合,以得到第五照片;其中,第四照片为电子设备对第一照片中的目标人物的图像进行优化后得到的;其中,目标人物包括第一人物和/或第二人物。In another possible implementation manner of the first aspect, the method further includes: the electronic device fuses the first photo and the fourth photo to obtain a fifth photo; obtained after optimizing the image of the target person in ; wherein the target person includes the first person and/or the second person.

在一些实施例中,电子设备已存储的未被优化过的目标照片因为是直接拍摄得到的,所以其中的人物的图像和其背景图像(即除人物图像以外的图像)之间的过渡在观感上会很平滑。而优化后的第二照片(或者第三照片,或者第二照片和第三照片的结合),因为其中人物的图像是经过优化的,可能会导致人物的图像与背景图像之间存在较为明显的区别,产生割裂感。所以为了避免这种割裂感,基于上述技术方案所提到的,电子设备可以通过融合第一照片和第四照片,得到第五照片。因为最终处理得到的第五照片是由原始的第一照片和优化后的第四照片融合得到的,所以其不仅人物的图像清晰细节多,且人物的图像和背景图像之间不存在割裂感,整个画面更加和谐。进而,用户的观感也就更好,提高了用户的使用体验。In some embodiments, because the unoptimized target photo stored in the electronic device is obtained directly, the transition between the image of the person and the background image (that is, an image other than the image of the person) is not easy to perceive. will be smooth. In the optimized second photo (or the third photo, or the combination of the second photo and the third photo), because the image of the person is optimized, there may be a relatively obvious difference between the image of the person and the background image. The difference creates a sense of separation. Therefore, in order to avoid this sense of fragmentation, based on the aforementioned technical solution, the electronic device can obtain the fifth photo by fusing the first photo and the fourth photo. Because the final processed fifth photo is obtained by fusion of the original first photo and the optimized fourth photo, not only the image of the person is clear and detailed, but also there is no sense of separation between the image of the person and the background image. The whole picture is more harmonious. Furthermore, the user's look and feel is better, and the user experience is improved.

第二方面,本申请提供一种电子设备,该电子设备包括摄像头、显示屏、存储器和一个或多个处理器;摄像头、显示屏、存储器与处理器耦合;其中,存储器中存储有计算机程序代码,计算机程序代码包括计算机指令,当计算机指令被处理器执行时,使得电子设备执行如第一方面及其任一种可能的设计方式提供的照片优化方法。In a second aspect, the present application provides an electronic device, which includes a camera, a display screen, a memory, and one or more processors; the camera, a display screen, and a memory are coupled to the processor; wherein, computer program codes are stored in the memory The computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the photo optimization method provided in the first aspect and any possible design manner thereof.

第三方面,本申请提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当所述计算机指令在电子设备上运行时,使得电子设备执行如第一方面及其任一种可能的设计方式提供的照片优化方法。In a third aspect, the present application provides a computer-readable storage medium, the computer-readable storage medium includes computer instructions, and when the computer instructions are run on an electronic device, the electronic device executes the first aspect and any one thereof. Photo optimization methods provided by possible design methods.

第四方面,本申请提供一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行如第一方面及其任一种可能的设计方式提供的照片优化方法。其中,该计算机可以是前述的电子设备。In a fourth aspect, the present application provides a computer program product. When the computer program product runs on a computer, the computer executes the photo optimization method provided in the first aspect and any possible design thereof. Wherein, the computer may be the aforementioned electronic device.

可以理解地,上述提供的第二方面及其任一种可能的设计方式所述的电子设备,第三方面所述的计算机可读存储介质,第四方面所述的计算机程序产品所能达到的有益效果,可参考第一方面及其任一种可能的设计方式中的有益效果,此处不再赘述。It can be understood that the electronic device described in the second aspect and any possible design thereof provided above, the computer-readable storage medium described in the third aspect, and the computer program product described in the fourth aspect can achieve For beneficial effects, reference may be made to the beneficial effects in the first aspect and any possible design manner thereof, and details are not repeated here.

附图说明Description of drawings

图1为本申请实施例提供的一种照片优化方法的实施环境示意图;FIG. 1 is a schematic diagram of an implementation environment of a photo optimization method provided in an embodiment of the present application;

图2为本申请实施例提供的一种电子设备的结构示意图;FIG. 2 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;

图3为本申请实施例提供的一种拍摄照片的优化流程示意图一;FIG. 3 is a first schematic diagram of an optimization process for taking photos provided by an embodiment of the present application;

图4为本申请实施例提供的一种相机预览界面的示意图;FIG. 4 is a schematic diagram of a camera preview interface provided by an embodiment of the present application;

图5为本申请实施例提供的一种启动相机的场景示意图;FIG. 5 is a schematic diagram of a scene of starting a camera provided by an embodiment of the present application;

图6为本申请实施例提供的一种拍摄照片的优化流程示意图二;FIG. 6 is a schematic diagram 2 of an optimization process for taking photos provided by the embodiment of the present application;

图7为本申请实施例提供的一种拍摄照片的优化流程示意图三;FIG. 7 is a schematic diagram of an optimization process for taking photos provided in the embodiment of the present application III;

图8为本申请实施例提供的一种拍摄照片的优化流程示意图四;FIG. 8 is a schematic diagram 4 of an optimization process for taking photos provided by an embodiment of the present application;

图9为本申请实施例提供的一种拍摄照片的优化流程示意图五;FIG. 9 is a schematic diagram five of an optimization process for taking pictures provided by an embodiment of the present application;

图10为本申请实施例提供的一种优化后的照片示意图;Figure 10 is a schematic diagram of an optimized photo provided in the embodiment of the present application;

图11为本申请实施例提供的一种照片优化前后的对比场景示意图;FIG. 11 is a schematic diagram of comparison scenes before and after photo optimization provided by the embodiment of the present application;

图12为本申请实施例提供的一种拍摄照片的优化流程示意图六;FIG. 12 is a schematic diagram six of an optimization process for taking photos provided by the embodiment of the present application;

图13为本申请实施例提供的一种优化前后的照片对比示意图;Figure 13 is a schematic diagram of comparison of photos before and after optimization provided in the embodiment of the present application;

图14为本申请实施例提供的一种拍摄照片的优化流程示意图七;FIG. 14 is a schematic diagram of an optimization process for taking photos provided in the embodiment of the present application VII;

图15为本申请实施例提供的一种已存储照片的优化流程示意图一;FIG. 15 is a first schematic diagram of an optimization process for stored photos provided by the embodiment of the present application;

图16为本申请实施例提供的一种确定第一照片的场景示意图;FIG. 16 is a schematic diagram of a scene for determining a first photo provided by an embodiment of the present application;

图17为本申请实施例提供的一种已存储照片的优化流程示意图二;FIG. 17 is a schematic diagram of an optimization process for stored photos provided in the embodiment of the present application;

图18为本申请实施例提供的一种已存储照片的优化流程示意图三;FIG. 18 is a schematic diagram of an optimization process of a stored photo provided in the embodiment of the present application;

图19为本申请实施例提供的一种优化信息生成流程示意图一;FIG. 19 is a first schematic diagram of an optimization information generation process provided by an embodiment of the present application;

图20为本申请实施例提供的一种图库应用中的照片分类场景示意图;FIG. 20 is a schematic diagram of a photo classification scene in a gallery application provided by an embodiment of the present application;

图21为本申请实施例提供的一种优化信息生成流程示意图二;FIG. 21 is a second schematic diagram of an optimization information generation process provided by the embodiment of the present application;

图22为本申请实施例提供的一种优化信息生成流程示意图三;FIG. 22 is a third schematic diagram of an optimization information generation process provided by the embodiment of the present application;

图23为本申请实施例提供的一种拍摄照片的优化流程示意图八;FIG. 23 is a schematic diagram eight of an optimization process for taking photos provided by the embodiment of the present application;

图24为本申请实施例提供的一种已存储照片的优化流程示意图四;Fig. 24 is a schematic diagram 4 of an optimization process for stored photos provided by the embodiment of the present application;

图25为本申请实施例提供的一种拍摄照片的优化流程示意图九;FIG. 25 is a schematic diagram of an optimization process for taking photos provided in the embodiment of the present application.

图26为本申请实施例提供的一种已存储照片的优化流程示意图五;FIG. 26 is a schematic diagram of a stored photo optimization process provided by the embodiment of the present application (5);

图27为本申请实施例提供的一种拍摄照片的优化流程示意图十;FIG. 27 is a schematic diagram ten of an optimization process for taking photos provided by the embodiment of the present application;

图28为本申请实施例提供的一种拍摄照片的优化流程示意图十一;Fig. 28 is an eleventh schematic diagram of an optimization process for taking photos provided by the embodiment of the present application;

图29为本申请实施例提供的一种已存储照片的优化流程示意图六;Fig. 29 is a schematic diagram 6 of an optimization process of a stored photo provided by the embodiment of the present application;

图30为本申请实施例提供的一种已存储照片的优化流程示意图七;Fig. 30 is a schematic diagram 7 of an optimization process of stored photos provided by the embodiment of the present application;

图31为本申请实施例提供的另一种电子设备的结构示意图。FIG. 31 is a schematic structural diagram of another electronic device provided by an embodiment of the present application.

具体实施方式Detailed ways

本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联人物的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification and appended claims of this application, the singular expressions "a", "an", "said", "above", "the" and "this" are intended to also Plural expressions are included unless the context clearly indicates otherwise. It should also be understood that "/" means or, for example, A/B can mean A or B; "and/or" in the text is just a relationship describing the associated person, indicating that there can be three relationships, such as , A and/or B, can mean: A exists alone, A and B exist simultaneously, and B exists alone.

在本申请中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本申请所描述的实施例可以与其它实施例相结合。Reference in this application to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the embodiments described in this application can be combined with other embodiments.

本申请以下实施例中的术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。The terms "first" and "second" in the following embodiments of the present application are used for description purposes only, and should not be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.

目前,大多数电子设备均具备有拍照功能。但是,在一些不利于拍照的场景下,例如暗光、逆光等场景下,用户使用电子设备拍摄的照片中的人像的成像质量不高,导致用户使用体验不好。Currently, most electronic devices have a camera function. However, in some scenes that are not conducive to taking pictures, such as dark light, backlight and other scenes, the imaging quality of the portraits in the photos taken by the user using the electronic device is not high, resulting in poor user experience.

针对上述问题,本申请实施例提供一种照片优化方法,该方法可以应用于具备有拍照功能的电子设备。在该方法中,电子设备可以根据照片中某个人物的图像的第一特征信息,例如人脸特征信息,获取对应该人物的图像的三维模型。该三维模型为能够表征该照片中该人物的图像对应的历史照片(即包括有该人物的图像对应的人物的图像的历史照片)中,该人物的三维特征。之后,电子设备可以将该人物的三维模型与该人物图像进行融合,以对该照片进行优化,得到优化后的照片。这样一来,因为电子设备中照片的人像便可以利用历史照片进行优化,使得照片中的人像更清晰立体,提高了用户的使用体验。In view of the above problems, an embodiment of the present application provides a photo optimization method, which can be applied to an electronic device with a camera function. In this method, the electronic device may obtain a three-dimensional model corresponding to the image of a certain person according to the first characteristic information of the image of a certain person in the photo, such as facial feature information. The three-dimensional model is capable of representing the three-dimensional features of the person in the historical photos corresponding to the image of the person in the photo (ie, the historical photos including the image of the person corresponding to the image of the person). Afterwards, the electronic device can fuse the three-dimensional model of the person with the image of the person to optimize the photo to obtain an optimized photo. In this way, because the portraits of the photos in the electronic device can be optimized by using the historical photos, the portraits in the photos are clearer and three-dimensional, and the user experience is improved.

本申请实施例提供的技术方案可能涉及的实施环境的示意图可参照图1所示。在该实施环境中,可以包括电子设备01和服务器02。其中,电子设备01和服务器02之间通过有线通讯或无线通讯的方式进行通信。在本申请实施例中,电子设备01和服务器02之间存在一定对应关系,例如电子设备为荣耀终端有限公司的产品时,服务器02应当为荣耀终端有限公司为其生产的电子设备配置的能够存储该电子设备需要上传存储的数据,例如:电子设备拍摄的照片、电子设备根据历史照片确定的三维特征或者三维模型。该服务器02还可以根据电子设备上传存储的数据生成后续电子设备可能需要的数据。例如,该服务器02可以利用电子设备上传的拍摄的照片,生成对应某个人物的三维特征,或者进一步生成对应某个人物的三维模型。Refer to FIG. 1 for a schematic diagram of an implementation environment that may be involved in the technical solutions provided in the embodiments of the present application. In this implementation environment, an electronic device 01 and a server 02 may be included. Wherein, the electronic device 01 and the server 02 communicate through wired communication or wireless communication. In the embodiment of this application, there is a certain correspondence between the electronic device 01 and the server 02. For example, when the electronic device is a product of Glory Terminal Co., Ltd., the server 02 should be configured for the electronic device produced by Glory Terminal Co., Ltd. to be able to store The electronic device needs to upload stored data, for example: photos taken by the electronic device, 3D features or 3D models determined by the electronic device based on historical photos. The server 02 can also generate data that may be required by subsequent electronic devices according to the data uploaded and stored by the electronic devices. For example, the server 02 can generate a 3D feature corresponding to a certain person, or further generate a 3D model corresponding to a certain person, by using the photograph uploaded by the electronic device.

示例性的,本申请中的服务器02可以是一台服务器,也可以是多台服务器组成的服务器集群,或者是一个云计算服务中心,本申请对此不做限定。在本申请中,服务器02主要用于存储器电子设备上传存储的电子设备拍摄的照片,和/或,电子设备根据历史照片确定的三维特征,和/或,电子设备根据历史照片确定三维模型。在电子设备执行本申请提供的技术方案的情况下,服务器02在接收到电子设备01获取数据的请求时,可以将其请求的数据发送给电子设备01。Exemplarily, the server 02 in this application may be one server, or a server cluster composed of multiple servers, or a cloud computing service center, which is not limited in this application. In this application, the server 02 is mainly used to store photos taken by the electronic device uploaded and stored by the electronic device, and/or the electronic device determines the 3D features based on the historical photos, and/or the electronic device determines the 3D model based on the historical photos. When the electronic device executes the technical solution provided by this application, the server 02 may send the requested data to the electronic device 01 when receiving the data acquisition request from the electronic device 01 .

示例性的,本申请实施例中的电子设备可以是手机、平板电脑、穿戴式设备(如智能手表或智能手环)、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、导航装置、移动上网装置(mobile internet device,MID)或可穿戴式设备(wearable device)等可以进行拍照的设备,本申请实施例对该电子设备的具体形态不作特殊限制。Exemplarily, the electronic device in the embodiment of the present application may be a mobile phone, a tablet computer, a wearable device (such as a smart watch or a smart bracelet), an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, and a cellular Phone, personal digital assistant (personal digital assistant, PDA), augmented reality (augmented reality, AR) \ virtual reality (virtual reality, VR) equipment, navigation device, mobile internet device (mobile internet device, MID) or wearable device (wearable device) and other devices that can take pictures, the embodiment of the present application does not make special restrictions on the specific form of the electronic device.

以电子设备是手机为例。图2示出了本申请提供的中电子设备100的结构示意图。Take the electronic device as a mobile phone as an example. FIG. 2 shows a schematic structural diagram of an electronic device 100 provided in this application.

参照图2所示,电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,显示屏193,用户标识模块(subscriber identification module,SIM)卡接口194,以及摄像头195等。其中,传感器模块180可以包括压力传感器,陀螺仪传感器,气压传感器,磁传感器,加速度传感器,距离传感器,接近光传感器,指纹传感器,温度传感器,触摸传感器,环境光传感器,骨传导传感器等。2, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, display screen 193, a subscriber identification module (subscriber identification module, SIM) card interface 194, a camera 195, and the like. Wherein, the sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。在本申请中,AP和GPU配合,可以确定电子设备中的照片中是否包括人脸图像,并提取其中的相关特征信息,例如人脸特征信息或者体态特征信息;进一步的还可以确定与该人脸图像匹配的三维特征或者三维模型。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. . Wherein, different processing units may be independent devices, or may be integrated in one or more processors. In this application, the AP and the GPU cooperate to determine whether the photo in the electronic device includes a face image, and extract relevant feature information, such as face feature information or body feature information; 3D features or 3D models for face image matching.

电子设备100通过GPU,显示屏193,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏193和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the display screen 193 , and the application processor. The GPU is a microprocessor for image processing, connected to the display screen 193 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏193用于显示图像,视频等。该显示屏可以是触摸屏。在一些实施例中,电子设备100可以包括1个或N个显示屏193,N为大于1的正整数。The display screen 193 is used to display images, videos and the like. The display can be a touch screen. In some embodiments, the electronic device 100 may include 1 or N display screens 193 , where N is a positive integer greater than 1.

电子设备100可以通过ISP,摄像头195,视频编解码器,GPU,显示屏193以及应用处理器等实现拍摄功能。ISP用于处理摄像头195反馈的数据。摄像头195用于捕获静态图像或视频。在一些实施例中,电子设备100可以包括1个或N个摄像头195,N为大于1的正整数。The electronic device 100 can realize the shooting function through the ISP, the camera 195 , the video codec, the GPU, the display screen 193 and the application processor. The ISP is used for processing the data fed back by the camera 195 . Camera 195 is used to capture still images or video. In some embodiments, the electronic device 100 may include 1 or N cameras 195 , where N is a positive integer greater than 1.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:贴膜状态识别,图像修复、图像识别,人脸识别,语音识别,文本理解等。本申请中,NPU可以利用电子设备获取的三维特征生成相应的三维模型。GPU和NPU的配合,则可以利用电子设备获取的三维模型对照片中的人物的图像进行融合优化。The NPU is a neural-network (NN) computing processor. By referring to the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process input information and continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as: recognition of the film state, image restoration, image recognition, face recognition, speech recognition, text understanding, and the like. In this application, the NPU can use the 3D features acquired by the electronic device to generate a corresponding 3D model. With the cooperation of GPU and NPU, the three-dimensional model acquired by the electronic device can be used to fuse and optimize the image of the person in the photo.

控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。A controller can be the nerve center and command center of an electronic device. The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.

处理器110中还可以设置存储器,用于存储指令和数据,例如电子设备拍摄的照片,根据照片获取的三维特征乃至三维模型等。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data, such as photos taken by electronic devices, 3D features or even 3D models obtained from the photos. In some embodiments, the memory in processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and/or A universal serial bus (universal serial bus, USB) interface, etc.

外部存储器接口120可以用于连接外部的非易失性存储器,实现扩展电子设备的存储能力。外部的非易失性存储器通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部的非易失性存储器中。The external memory interface 120 can be used to connect an external non-volatile memory, so as to expand the storage capacity of the electronic device. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and video are stored in an external non-volatile memory.

内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。The internal memory 121 may include one or more random access memories (random access memory, RAM) and one or more non-volatile memories (non-volatile memory, NVM). The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs. The non-volatile memory can also store executable programs and data of users and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.

触摸传感器,也称“触控器件”。触摸传感器可以设置于显示屏193,由触摸传感器与显示屏193组成触摸屏,也称“触控屏”。触摸传感器用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏193提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器也可以设置于电子设备的表面,与显示屏193所处的位置不同。Touch sensor, also known as "touch device". The touch sensor can be arranged on the display screen 193, and the touch sensor and the display screen 193 form a touch screen, also called "touch screen". The touch sensor is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 193 . In some other embodiments, the touch sensor may also be disposed on the surface of the electronic device, which is different from the position of the display screen 193 .

在本申请中,触摸传感器可以检测到用户作用于手机显示屏上的操作,由处理器110分析并执行该操作对应执行的功能,例如熄屏,亮屏等。In this application, the touch sensor can detect the user's operation on the display screen of the mobile phone, and the processor 110 analyzes and executes the functions corresponding to the operation, such as turning off the screen and turning on the screen.

压力传感器用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器可以设置于显示屏193。压力传感器的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏193,电子设备100根据压力传感器检测所述触摸操作强度。电子设备100也可以根据压力传感器的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, a pressure sensor may be provided on the display screen 193 . There are many types of pressure sensors, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may be comprised of at least two parallel plates with conductive material. When a force is applied to the pressure sensor, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of pressure according to the change in capacitance. When a touch operation acts on the display screen 193, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view short messages is executed. When a touch operation whose intensity is greater than or equal to the first pressure threshold acts on the icon of the short message application, the instruction of creating a new short message is executed.

按键190包括电源键,音量键等。用户通过长按电源键可以控制手机开机或关机,用户通过按压音量键则可以控制手机的播放音量。The keys 190 include a power key, a volume key and the like. The user can control the mobile phone to turn on or off by long pressing the power button, and the user can control the playback volume of the mobile phone by pressing the volume key.

马达191可以产生振动提示。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口194用于连接SIM卡。The motor 191 can generate a vibrating reminder. The indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like. The SIM card interface 194 is used for connecting a SIM card.

当然,可以理解的,上述图2所示仅仅为电子设备的形态为手机时的示例性说明。若电子设备是平板电脑,手持计算机,PC,PDA,可穿戴式设备(如:智能手表、智能手环)等其他设备形态时,电子设备的结构中可以包括比图2中所示更少的结构,也可以包括比图2中所示更多的结构,在此不作限制。Of course, it can be understood that the above FIG. 2 is only an exemplary description when the form of the electronic device is a mobile phone. If the electronic device is in the form of a tablet computer, a handheld computer, a PC, a PDA, a wearable device (such as a smart watch, a smart bracelet), etc., the structure of the electronic device may include fewer components than those shown in Figure 2 The structure may also include more structures than those shown in FIG. 2 , which is not limited here.

可以理解的,需要进行优化的照片可以是电子设备使用相机应用拍摄的照片,也可以是用户本地图库中存储的未进行优化过的照片。因此,本申请提供的照片优化方法中,电子设备可以优化电子设备直接拍摄的照片,也可以优化用户在电子设备的图库中选择的已存储的照片。另外,在照片优化的具体过程中还需要使用预先存储好的优化信息(三维特征或者三维模型)。因此,相应的,本申请提供的照片优化方法可以包括“拍摄照片的优化”流程、“优化信息生成”流程和“已存储照片的优化”流程。It can be understood that the photo that needs to be optimized may be a photo taken by the electronic device using a camera application, or a non-optimized photo stored in the user's local gallery. Therefore, in the photo optimization method provided by the present application, the electronic device may optimize the photos directly taken by the electronic device, or optimize the stored photos selected by the user in the gallery of the electronic device. In addition, pre-stored optimization information (3D features or 3D models) needs to be used in the specific process of photo optimization. Therefore, correspondingly, the photo optimization method provided in the present application may include a process of "optimization of captured photos", a process of "generating optimization information" and a process of "optimization of stored photos".

以下实施例中的方法流程均可以在具有上述硬件架构的电子设备中实现。The method procedures in the following embodiments can all be implemented in electronic devices with the above-mentioned hardware architecture.

下面以电子设备为手机为例,对本申请实施例提供的照片优化方法中,拍摄照片的优化流程进行介绍。如图3所示,该拍摄照片的优化流程可以包括S301-S307:Taking the electronic device as a mobile phone as an example, the photo optimization process in the photo optimization method provided in the embodiment of the present application will be introduced below. As shown in Figure 3, the optimization process for taking photos may include S301-S307:

S301、手机接收用户对相机应用图标的触发操作。S301. The mobile phone receives a user's trigger operation on the camera application icon.

在用户需要使用手机进行拍照时,用户可以点击手机桌面的相机应用图标,从而触发手机启动摄像开始进行拍摄。When the user needs to use the mobile phone to take pictures, the user can click the camera application icon on the desktop of the mobile phone, thereby triggering the mobile phone to start the camera and start shooting.

S302、响应于用户对相机应用图标的触发操作,手机启动摄像头,显示相机预览界面。S302. In response to the user's trigger operation on the camera application icon, the mobile phone starts the camera and displays a camera preview interface.

实际中,为了使得手机在打开相机应用时,用户可以明确此时摄像头对应的拍摄区域中的内容,手机会将摄像头对拍摄区域得到的画面实时的呈现在相机预览界面中。也就是说,相机预览界面用于预览手机的摄像头的拍摄画面。In practice, in order to enable the user to know the content in the shooting area corresponding to the camera when the mobile phone opens the camera application, the mobile phone will present the picture obtained by the camera on the shooting area in real time in the camera preview interface. That is to say, the camera preview interface is used to preview the pictures taken by the camera of the mobile phone.

目前手机大多具备有后置摄像头和前置摄像头,其中前置摄像头用于拍摄手机屏幕正对方向的拍摄区域,而后置摄像头则拍摄手机背面正对方向的拍摄区域。而本申请中S302中提到的手机启动的摄像头可以是前置摄像头,也可以是后置摄像头,还可以是前置摄像头和后置摄像头。具体手机启动何种摄像头可以根据相机应用的设置或者手机之前一次进行拍摄时的设置而定,本申请对此不做具体限制。At present, most mobile phones are equipped with a rear camera and a front camera, wherein the front camera is used to shoot the shooting area facing the direction of the mobile phone screen, and the rear camera is used to shoot the shooting area facing the direction of the back of the mobile phone. The camera activated by the mobile phone mentioned in S302 in this application may be a front camera, a rear camera, or a front camera and a rear camera. The specific camera to be activated by the mobile phone may be determined according to the settings of the camera application or the previous shooting of the mobile phone, which is not specifically limited in this application.

参照图4中(a)所示,在手机启动的摄像头为前置摄像头的情况下,相机预览界面显示前置摄像头拍摄的画面,本申请中可以称为前景画面。Referring to Fig. 4 (a), when the camera activated by the mobile phone is the front camera, the camera preview interface displays the picture captured by the front camera, which may be referred to as the foreground picture in this application.

参照图4中(b)所示,在手机启动的摄像头为后置摄像头的情况下,相机预览界面显示后置摄像头拍摄的画面,本申请中可以称为后景画面。Referring to Fig. 4 (b), when the camera activated by the mobile phone is the rear camera, the camera preview interface displays the picture captured by the rear camera, which may be referred to as the background picture in this application.

参照图4中(c)所示,在手机启动的摄像头为前置摄像头和后置摄像头的情况下,相机预览界面则按照一定比例(例如1:1)分为第一区域401和第二区域402两个区域。其中,第一区域401用于显示前置摄像头拍摄的前景画面,第二区域402则用于显示后置摄像头拍摄的后景画面。当然,图4中(c)示出的第一区域和第二区域在相机预览界面中的排布关系仅为示例,实际中还可以有其他任意可行的方式,例如画中画等。本申请对此不做具体限制。Referring to (c) in FIG. 4 , when the cameras activated by the mobile phone are the front camera and the rear camera, the camera preview interface is divided into a first area 401 and a second area according to a certain ratio (for example, 1:1). 402 two areas. Wherein, the first area 401 is used to display the foreground image captured by the front camera, and the second area 402 is used to display the background image captured by the rear camera. Certainly, the arrangement relationship between the first area and the second area in the camera preview interface shown in (c) of FIG. 4 is only an example, and there may be any other feasible manner in practice, such as picture-in-picture. This application does not specifically limit this.

示例性的,以手机响应于用户对相机应用图标的触发操作,启动了后置摄像头为例,手机可以显示如图5中(a)所示的桌面501。该桌面501中包括相机应用图标502。上述S301和S302具体实现如下:手机可以接收用户对相机应用图标502的触发操作(例如点击操作)。响应于对相机应用图标502的触发操作,手机可以启动手机的后置摄像头进行拍摄,并显示如图5中(b)所示的相机预览界面503。Exemplarily, taking the mobile phone starting the rear camera as an example in response to the user's trigger operation on the camera application icon, the mobile phone may display a desktop 501 as shown in (a) in FIG. 5 . The desktop 501 includes a camera application icon 502 . The specific implementation of the above S301 and S302 is as follows: the mobile phone may receive a user's trigger operation (such as a click operation) on the camera application icon 502 . In response to a trigger operation on the camera application icon 502, the mobile phone can start the rear camera of the mobile phone to take pictures, and display a camera preview interface 503 as shown in (b) in FIG. 5 .

S303、手机接收用于在相机预览界面上实施的拍照操作。S303. The mobile phone receives a photographing operation for performing on the camera preview interface.

示例性的,以手机响应于用户对相机应用图标的触发操作,启动了后置摄像头为例。参照图5中(b)所示,相机预览界面503中可以包括有拍照控件504。该拍照控件504用于触发手机采集相机预览界面503当前显示的画面生成照片。该拍照操作可以是用于对该拍照控件504的触发操作,例如点击操作。Exemplarily, take the mobile phone starting the rear camera as an example in response to the user's trigger operation on the camera application icon. Referring to (b) in FIG. 5 , the camera preview interface 503 may include a camera control 504 . The photographing control 504 is used to trigger the mobile phone to capture the screen currently displayed on the camera preview interface 503 to generate a photograph. The photographing operation may be a triggering operation for the photographing control 504, such as a click operation.

S304、手机响应于用户实施的拍照操作,获取第一照片。S304. The mobile phone acquires the first photo in response to the photographing operation performed by the user.

示例性的,参照图5中(b)所示,第一照片中的图像内容具体可以为用户实施拍照操作时,相机预览界面503中显示的画面。Exemplarily, referring to (b) in FIG. 5 , the image content in the first photo may specifically be the screen displayed in the camera preview interface 503 when the user performs a photographing operation.

S305、手机在第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息。S305. If the first photo includes a face image, the mobile phone acquires first characteristic information of a first person to whom the first face image in the first photo belongs.

本申请提供的拍照优化方法的主要目的是对照片中的人物的图像进行优化,而一个人物的图像最主要的则是该人物的人脸图像。所以本申请中,手机在响应于用户的拍照操作,获取到第一照片后,需要在确定拍摄的第一照片中包括人脸图像的情况下,才会实施对该照片的优化,即执行后续的S306和S307。其中,第一人脸图像是第一照片中的人脸图像中的一个。The main purpose of the photographing optimization method provided in this application is to optimize the image of the person in the photo, and the most important aspect of the image of a person is the face image of the person. Therefore, in this application, after the mobile phone obtains the first photo in response to the user's camera operation, it needs to confirm that the first photo taken includes a face image before implementing the optimization of the photo, that is, performing subsequent S306 and S307. Wherein, the first face image is one of the face images in the first photo.

具体手机如何确定第一照片中是否包括人脸图像,则可以是任意可行的方式。例如,手机可以根据第一照片中是否存在预设大小的区域(可以根据第一照片的分辨率决定)内存在符合预设相对位置条件的五官来决定第一照片中是否包括人脸图像。具体的,若手机确定第一照片中存在预设大小的区域(可以根据第一照片的分辨率决定)内存在符合预设相对位置条件的五官,则确定第一照片中包括人脸图像;若手机确定第一照片中存在预设大小的区域(可以根据第一照片的分辨率决定)内不存在符合预设相对位置条件的五官,则确定第一照片中不包括人脸图像。Specifically, how the mobile phone determines whether the first photo includes a face image can be any feasible manner. For example, the mobile phone can determine whether the first photo includes a face image according to whether there are facial features that meet the preset relative position conditions in an area of a preset size (which can be determined according to the resolution of the first photo) in the first photo. Specifically, if the mobile phone determines that there is an area of a preset size (which can be determined according to the resolution of the first photo) in the first photo and there are facial features that meet the preset relative position conditions, then it is determined that the first photo includes a face image; if The mobile phone determines that there is no facial features meeting the preset relative position conditions in the area of the preset size (which can be determined according to the resolution of the first photo) in the first photo, and then determines that the first photo does not include a face image.

又例如,手机可以根据预先训练的人脸识别模型对第一照片中不同的物体进行识别,以确定第一照片中是否包括人脸图像。当然,实际中还可以是其他任意可行的实现方式。For another example, the mobile phone may recognize different objects in the first photo according to a pre-trained face recognition model, so as to determine whether the first photo includes a face image. Of course, in practice, any other feasible implementation manners may also be used.

不同人物图像最大的区别就是人脸信息,人脸的特征信息可以最大程度的区分不同的人物图像。基于此,本申请中的第一特征信息至少包括第一人物的人脸特征信息。示例性的,人脸特征信息中的具体特征可以包括以下至少一种:人脸细节信息、肤色、皮肤纹理。其中,人脸细节信息则可以包括有五官相对位置和五官大小等信息。The biggest difference between different person images is the face information, and the feature information of the face can distinguish different person images to the greatest extent. Based on this, the first feature information in the present application includes at least face feature information of the first person. Exemplarily, the specific features in the face feature information may include at least one of the following: face detail information, skin color, and skin texture. Among them, the facial detail information may include information such as relative positions and sizes of facial features.

进一步的,如果为了更准确的区分不同的人物图像,使得后续获取到更准确的三维模型,这里的第一特征信息还可以包括第一人物的体态特征信息。体态特征信息中的具体特征可以包括但不限于以下至少一种:四肢形态、身体比例。Furthermore, if in order to distinguish different person images more accurately so that a more accurate 3D model can be obtained later, the first feature information here may also include body feature information of the first person. The specific features in the body feature information may include but not limited to at least one of the following: limb shape, body proportion.

具体的,手机可以根据任意可行的方式的从第一照片中提取第一人物图像的第一特征信息。Specifically, the mobile phone may extract the first feature information of the first person image from the first photo in any feasible manner.

另外,手机在确定第一照片中不包括人脸图像的情况下,则正常存储该第一照片,并停止执行本申请实施例提供的技术方案。In addition, when the mobile phone determines that the first photo does not include a face image, it normally stores the first photo and stops executing the technical solution provided by the embodiment of the present application.

在一些实施例中,为了使得手机可以在拍摄到照片的情况下,更迅速的确定该照片是否是需要进行人物的图像优化的照片。手机可以在用户未实施拍照操作前,实时的检测相机预览界面中的画面是否包括人脸图像。这样一来,后续手机在响应于用户实施的拍照操作,获取第一照片的同时,便可以确定第一照片中是否存在人物的图像。进而便可以决定是否执行后续的操作。基于此,结合图3,参照图6所示,S302步骤可以替换为S302A:In some embodiments, in order to enable the mobile phone to more quickly determine whether the photo is a photo that needs to be optimized for a person's image when the photo is captured. The mobile phone can detect whether the picture in the camera preview interface includes a face image in real time before the user performs the camera operation. In this way, when the subsequent mobile phone obtains the first photo in response to the camera operation performed by the user, it can determine whether there is an image of a person in the first photo. Then it can be decided whether to perform subsequent operations. Based on this, in combination with FIG. 3 , referring to FIG. 6 , step S302 can be replaced with S302A:

S302A、手机响应于用户对相机应用图标的触发操作,显示相机预览界面,并实时确定相机预览界面中是否包括人脸图像。S302A. The mobile phone displays a camera preview interface in response to the user's trigger operation on the camera application icon, and determines in real time whether the camera preview interface includes a face image.

具体手机如何确定相机预览界面中是否包括人脸图像,可以参照前述手机确定第一照片中是否包括人脸图像的相关表述,此处不再赘述。How the mobile phone determines whether the face image is included in the camera preview interface can refer to the above-mentioned mobile phone to determine whether the face image is included in the first photo, and will not be repeated here.

其中,第一照片中是否包括人脸图像,是电子设备接收拍照操作前最新一次对相机预览界面中是否包括人脸图像的确定结果。Wherein, whether the first photo includes a human face image is the latest determination result of whether the camera preview interface includes a human face image before the electronic device receives the photographing operation.

基于此,结合图3,参照图6所示,S305步骤具体则可以替换为S305A:Based on this, referring to FIG. 3 and referring to FIG. 6, step S305 can be replaced with S305A:

S305A、手机在获取到目标结果的情况下,获取第一人脸图像所属的第一人物的第一特征信息。S305A. When the target result is obtained, the mobile phone obtains the first feature information of the first person to which the first face image belongs.

其中,目标结果为手机接收拍照操作前最新一次对相机预览界面中是否包括人脸图像的确定结果,且目标结果指示相机预览界面中包括人脸图像。Wherein, the target result is the latest determination result of whether the face image is included in the camera preview interface before the mobile phone receives the camera operation, and the target result indicates that the face image is included in the camera preview interface.

具体的,手机每次在对相机预览界面中是否包括人脸图像进行判断后,可以将判断结果存在特定的存储区中,以供后续手机在接收到用户实施的拍照操作时,调取最新一次存储的判断结果使用。进一步的,为了节省手机的存储空间,特定的存储区可以仅存储最新一次得到的判断结果。也就是说,手机每次在对相机预览界面中是否包括人脸图像进行判断后得到的判断结果,会用该判断结果替换特定的存储区中存储的判断结果。Specifically, each time the mobile phone judges whether the face image is included in the camera preview interface, it can store the judgment result in a specific storage area, so that when the mobile phone receives the camera operation performed by the user, it can retrieve the latest Stored judgment results are used. Further, in order to save the storage space of the mobile phone, a specific storage area may only store the judgment result obtained the latest time. That is to say, each time the mobile phone judges whether the face image is included in the camera preview interface, it will replace the judgment result stored in the specific storage area with the judgment result.

基于S302A和S305A对应的技术方案,手机则可以在响应于用户实施的拍照操作,获取到第一照片的同时,确定该第一照片是否包括人脸图像,也就提高了照片优化的效率。Based on the technical solutions corresponding to S302A and S305A, the mobile phone can determine whether the first photo includes a face image while obtaining the first photo in response to the camera operation performed by the user, thereby improving the efficiency of photo optimization.

S306、手机获取与第一特征信息匹配的第一三维模型。S306. The mobile phone acquires a first three-dimensional model that matches the first feature information.

其中,第一三维模型用于表征第一人物图像对应的历史照片中,第一人物的三维特征。三维特征至少包括人脸三维特征。第一人物图像对应的历史照片中均包括有第一人物的图像。在为了后续可以更进一步的对第一人物的图像中第一人物的体态进行优化,这里的三维特征还可以包括有体态三维特征。这样后续利用第一三维模型对第一人物的图像进行融合优化时,可以使得第一人物的图像中第一人物的人脸和身体的细节都更清晰,优化效果也就更好。Wherein, the first three-dimensional model is used to represent the three-dimensional features of the first person in the historical photos corresponding to the image of the first person. The three-dimensional features include at least three-dimensional features of human face. The historical photos corresponding to the image of the first person all include the image of the first person. In order to further optimize the posture of the first person in the image of the first person subsequently, the three-dimensional features here may also include three-dimensional characteristics of the posture. In this way, when the first three-dimensional model is used to fuse and optimize the image of the first person, the details of the face and body of the first person in the image of the first person can be made clearer, and the optimization effect is better.

具体的,对于多个历史照片而言,手机可以先通过人脸识别技术,确定每个历史照片中的人脸以及相关特征。之后,通过特征比对,确定属于同一人物的人脸。基于此,便可以将多个历史照片确定为对应不同人物的历史照片。属于同一人物的历史照片中均包括有该人物的图像。当然,对于包括有多个人物的历史照片,该历史照片可以对应有多个人物。Specifically, for multiple historical photos, the mobile phone may first determine the face and related features in each historical photo through face recognition technology. After that, through feature comparison, the faces belonging to the same person are determined. Based on this, multiple historical photos can be determined as historical photos corresponding to different persons. Historical photographs belonging to the same person all include images of that person. Certainly, for a historical photo including multiple persons, the historical photo may correspond to multiple persons.

一种可实现的方式中,手机可以事先依据本地存储的第一人物图像对应的历史照片,确定得到第一三维模型并存储。在执行S306步骤的时候,手机便可以从本地存储器中获取该第一模型。这样可以更快速的获取到第一三维模型,提高照片优化的效率。具体如何依据历史照片确定三维模型,可以参照后续优化信息生成流程中的相关表述,此处不做具体表述。In an achievable manner, the mobile phone may determine and store the first three-dimensional model based on historical photos corresponding to the first person image stored locally in advance. When step S306 is executed, the mobile phone can obtain the first model from the local memory. In this way, the first 3D model can be obtained more quickly, and the efficiency of photo optimization can be improved. For details on how to determine the 3D model based on the historical photos, you can refer to the relevant descriptions in the subsequent optimization information generation process, and no specific descriptions will be made here.

示例性的,在这种情况下,手机对拍摄的照片优化的过程可以如图7所示。在用户拍摄得到照片之前,手机会利用图库中的历史照片,构建得到多个人物对应的三维模型,并存储在相应的数据库中,如人像三维数据库。Exemplarily, in this case, the process of optimizing the photograph taken by the mobile phone may be as shown in FIG. 7 . Before the user takes photos, the mobile phone will use the historical photos in the gallery to construct 3D models corresponding to multiple characters and store them in a corresponding database, such as a 3D portrait database.

之后,在用户实施了拍照操作的情况下,手机便会从人物三维模型数据库中获取该照片中人物(例如第一人物)对应的三维模型(例如第一三维模型)。Afterwards, when the user performs a photographing operation, the mobile phone will acquire the 3D model (eg, the first 3D model) corresponding to the character (eg, the first character) in the photo from the character 3D model database.

再之后,手机便可以利用获取的三维模型对照片中的人物的图像进行优化,得到最终优化后的照片。Afterwards, the mobile phone can use the obtained three-dimensional model to optimize the image of the person in the photo to obtain a final optimized photo.

另一种可实现的方式中,手机可以从服务器中获取第一三维模型。基于此,结合图3,参照图8所示,S306具体可以包括:S3061A和S3062A:In another practicable manner, the mobile phone may obtain the first three-dimensional model from the server. Based on this, referring to FIG. 3 and referring to FIG. 8 , S306 may specifically include: S3061A and S3062A:

S3061A、手机向服务器发送第一请求。S3061A. The mobile phone sends a first request to the server.

其中,第一请求携带有第一特征信息,第一请求用于请求与第一特征信息匹配的第一三维模型。Wherein, the first request carries first characteristic information, and the first request is used to request a first three-dimensional model matching the first characteristic information.

在本申请中,这里的服务器可以是与该手机存在关联关系的服务器。例如,该手机为荣耀终端有限公司生产的手机,则该服务器可以为荣耀终端有限公司为该手机配置的能够存储该电子设备需要上传存储的数据。该服务器针对不同的手机可以分配有不同的存储区,用来存储相应手机上传的数据。每个存储区可以对应有用户设置的唯一的账号和密码,用户可以使用自身设置的账号和密码登录手机上针对上传数据至该服务器的应用,而后可以通过该应用将需要上传的数据上传至该服务器为给手机配置的存储区中。In this application, the server here may be a server associated with the mobile phone. For example, if the mobile phone is a mobile phone produced by Honor Terminal Co., Ltd., then the server can be configured by Honor Terminal Co., Ltd. for the mobile phone to be able to store the data that needs to be uploaded and stored by the electronic device. The server can be allocated with different storage areas for different mobile phones to store data uploaded by corresponding mobile phones. Each storage area can correspond to a unique account and password set by the user. The user can use the account and password set by the user to log in to the application on the mobile phone for uploading data to the server, and then upload the data to be uploaded to the server through the application. The server is in the storage area configured for the mobile phone.

S3062A、手机接收来自服务器的第一响应,并从第一响应中获取第一三维模型。S3062A. The mobile phone receives the first response from the server, and acquires the first three-dimensional model from the first response.

在本申请中,服务器中实际存储的可以是以下任一种或多种:第一人物对应的所有历史照片、根据该历史照片确定的第一人物的三维特征(即本申请中提到的第一三维特征)、根据该第一人物的三维特征得到的第一三维模型。具体如何根据历史照片确定第一人物的三维特征,以及如何根据该第一人物的三维特征得到的第一三维模型,可以参照后续优化信息生成流程中的相关表述,此处不做具体表述。具体服务器中存储的什么内容,可以是出厂设定或者由用户设定。In this application, the actual storage in the server may be any one or more of the following: all historical photos corresponding to the first person, the three-dimensional features of the first person determined according to the historical photos (that is, the first person mentioned in this application A three-dimensional feature), the first three-dimensional model obtained according to the three-dimensional feature of the first person. For details on how to determine the 3D features of the first person based on the historical photos, and how to obtain the first 3D model based on the 3D features of the first person, you can refer to related expressions in the subsequent optimization information generation process, which will not be described in detail here. What content is stored in the specific server can be set by the factory or set by the user.

在一般情况下,手机上传至服务器的仅为历史照片(包括第一人物对应的历史照片),服务器在接收到历史照片后,可以根据出厂设定或者用户设定,生成相应的三维特征或者三维模型并存储,以供后续手机调用。Under normal circumstances, the mobile phone uploads to the server only historical photos (including the historical photos corresponding to the first person). After receiving the historical photos, the server can generate corresponding 3D features or 3D images according to the factory settings or user settings. model and store it for subsequent calls by mobile phones.

若在服务器中存储的是第一人物图像对应的所有历史照片,服务器在接收到该接收到来自手机的第一请求的情况下,可以根据该第一人物对应的所有历史照片,确定第一人物的三维特征。然后,服务器可以根据该第一人物的三维特征确定第一三维模型。之后,服务器便可以向手机发送该第一响应。If all the historical photos corresponding to the image of the first person are stored in the server, when the server receives the first request from the mobile phone, it can determine the first person according to all the historical photos corresponding to the first person three-dimensional features. Then, the server may determine the first three-dimensional model according to the three-dimensional features of the first person. Afterwards, the server can send the first response to the mobile phone.

其中,具体确定第一人物对应的所有历史照片的过程,可以是利用第一特征信息和所有历史照片中的人物的图像进行匹配。一般的,匹配过程中,会先将历史照片中的人物的特征信息提取出来,然后与第一特征信息进行匹配。之后,将匹配度大于一定阈值的历史照片确定为第一人物对应的历史照片。Wherein, the specific process of determining all the historical photos corresponding to the first person may be to use the first feature information to match the images of the people in all the historical photos. Generally, during the matching process, the feature information of the person in the historical photo is first extracted, and then matched with the first feature information. Afterwards, the historical photos whose matching degree is greater than a certain threshold are determined as the historical photos corresponding to the first person.

若在服务器中存储的是第一人物对应的第一三维特征,服务器在接收到该接收到来自手机的第一请求的情况下,会根据该第一三维特征,确定第一三维模型。之后,服务器便可以向手机发送该第一响应。If the first three-dimensional feature corresponding to the first person is stored in the server, when the server receives the first request from the mobile phone, it will determine the first three-dimensional model according to the first three-dimensional feature. Afterwards, the server can send the first response to the mobile phone.

其中,具体确定第一人物对应的第一三维特征的过程,可以是利用第一特征信息和服务器中存储的所有三维特征进行匹配。之后,将匹配度大于一定阈值的三维特征确定为第一人物对应的第一三维特征。Wherein, the specific process of determining the first three-dimensional feature corresponding to the first person may be to use the first feature information to match all three-dimensional features stored in the server. Afterwards, a three-dimensional feature whose matching degree is greater than a certain threshold is determined as the first three-dimensional feature corresponding to the first person.

若在服务器中存储的是第一人物图像对应的第一三维模型,服务器在接收到该接收到来自手机的第一请求的情况下,会直接向手机发送该第一响应。If the first three-dimensional model corresponding to the first character image is stored in the server, when the server receives the first request from the mobile phone, it will directly send the first response to the mobile phone.

其中,具体确定第一人物对应的第一三维模型的过程,可以是利用第一特征信息和服务器中存储的所有三维模型进行匹配。一般的,匹配过程中,会先将三维模型中的人物的三维特征信息提取出来,然后与第一特征信息进行匹配。之后,将匹配度大于一定阈值的三维模型确定为第一人物对应的第一三维模型。Wherein, the specific process of determining the first three-dimensional model corresponding to the first person may be to use the first feature information to match all three-dimensional models stored in the server. Generally, in the matching process, the three-dimensional feature information of the person in the three-dimensional model is first extracted, and then matched with the first feature information. Afterwards, the three-dimensional model whose matching degree is greater than a certain threshold is determined as the first three-dimensional model corresponding to the first person.

基于上述S3061A和S3062A对应的技术方案,一方面,第一三维模型或者其相关信息会存储在服务器中,降低了本申请提供照片优化方案对手机存储和计算的需求。另一方面,因为三维模型或者其相关信息会存储在服务器中,而服务器由于和手机存在一定关联的。那么,用户在换新手机或者清理过本地存储的历史照片,或者三维特征,或者三维模型的情况下,可以依据手机与服务器的关联关系,顺利的从服务器中获取第一三维模型,从而方便用户当前使用的手机对第一照片进行照片优化,提高了用户的使用体验。Based on the technical solutions corresponding to S3061A and S3062A above, on the one hand, the first 3D model or its related information will be stored in the server, which reduces the storage and calculation requirements of the mobile phone for the photo optimization solution provided by this application. On the other hand, because the 3D model or its related information will be stored in the server, and the server is related to the mobile phone. Then, when the user changes to a new mobile phone or has cleaned up the historical photos stored locally, or the 3D features, or the 3D model, he can smoothly obtain the first 3D model from the server according to the relationship between the mobile phone and the server, which is convenient for the user. The currently used mobile phone performs photo optimization on the first photo, which improves the user experience.

示例性的,S3061A和S3062A对应的技术方案中,手机对拍摄的照片优化的过程可以参照图7所示。其中,区别在于,历史照片和/或三维特征和/或三维模型,均存储在服务器中。而且,在服务器中未直接存储有三维模型的情况下,服务器在接收到第一请求后,会根据已存储的第一人物对应的历史照片或第一三维特征先生成三维模型。然后,服务器再向手机发送携带有第一三维模型的第一响应。Exemplarily, in the technical solution corresponding to S3061A and S3062A, the process of optimizing the photograph taken by the mobile phone may refer to FIG. 7 . Wherein, the difference is that the historical photos and/or 3D features and/or 3D models are all stored in the server. Moreover, if the server does not directly store the 3D model, after receiving the first request, the server will first generate the 3D model according to the stored historical photos or first 3D features corresponding to the first person. Then, the server sends the first response carrying the first three-dimensional model to the mobile phone.

在一些实施例中,因为第一特征信息和历史照片或者三维模型的匹配会较为麻烦,例如需要先从历史照片或三维模型中获取可以比对的特征信息后,才能进行匹配。所以为了提高匹配效率,进而提高照片优化效率。在本申请中,手机可以是先获取到第一特征信息匹配的第一三维特征,之后根据该第一三维特征构建得到第一三维模型。基于此,结合图3,参照图9所示,S306可以包括S3061B和S3062B:In some embodiments, because the matching of the first feature information and the historical photos or 3D models is troublesome, for example, it is necessary to obtain comparable feature information from the historical photos or 3D models before matching. Therefore, in order to improve the matching efficiency, and then improve the photo optimization efficiency. In this application, the mobile phone may first obtain the first three-dimensional feature matched with the first feature information, and then construct the first three-dimensional model according to the first three-dimensional feature. Based on this, referring to FIG. 3 and referring to FIG. 9, S306 may include S3061B and S3062B:

S3061B、手机获取与第一特征信息匹配的第一三维特征。S3061B. The mobile phone acquires the first three-dimensional feature matching the first feature information.

其中,第一三维特征为第一人物对应的历史照片中,第一人物的三维特征。其中,三维特征可以包括人脸三维特征和/或体态三维特征。Wherein, the first three-dimensional feature is a three-dimensional feature of the first person in a historical photo corresponding to the first person. Wherein, the three-dimensional features may include three-dimensional features of human face and/or three-dimensional features of body posture.

一种可实现的方式中,手机可以事先依据本地存储的第一人物对应的历史照片,确定得到第一三维特征并存储。在执行S3061B步骤的时候,手机便可以从本地存储器中获取该第一特征。这样可以更快速的获取到第一三维特征,提高照片优化的效率。具体如何依据历史照片确定三维模型,可以参照后续优化信息生成流程中的相关表述,此处不做具体表述。In an achievable manner, the mobile phone may determine and store the first three-dimensional feature based on the locally stored historical photos corresponding to the first person in advance. When executing step S3061B, the mobile phone can obtain the first feature from the local memory. In this way, the first three-dimensional feature can be obtained more quickly, and the efficiency of photo optimization can be improved. For details on how to determine the 3D model based on the historical photos, you can refer to the relevant descriptions in the subsequent optimization information generation process, and no specific descriptions will be made here.

示例性的,在这种情况下,手机对拍摄的照片优化的过程可以参照图7所示。其中,区别在于,人像三维数据库中存储的是三维特征。Exemplarily, in this case, the process of optimizing the photograph taken by the mobile phone may refer to FIG. 7 . The difference lies in that the 3D features are stored in the portrait 3D database.

另一种可实现的方式中,第一三维特征可以存储在于该手机对应的服务器中,手机可以从服务器中获取第一三维模型。基于此,S3061B具体可以包括:S1和S2:In another practicable manner, the first three-dimensional feature may be stored in a server corresponding to the mobile phone, and the mobile phone may obtain the first three-dimensional model from the server. Based on this, S3061B can specifically include: S1 and S2:

S1、手机向服务器发送第二请求。S1. The mobile phone sends a second request to the server.

其中,第二请求携带有第一特征信息,第二请求用于请求与第一特征信息匹配的第一三维特征。Wherein, the second request carries the first feature information, and the second request is used to request the first three-dimensional feature matching the first feature information.

S2、手机接收来自服务器的第二响应,并从第二响应中获取第一三维特征。S2. The mobile phone receives the second response from the server, and acquires the first three-dimensional feature from the second response.

在本申请中,服务器中实际存储的可以是以下任一种或多种:第一人物对应的所有历史照片、根据该历史照片确定的第一三维特征。具体如何根据历史照片确定第一人物的三维特征,可以参照后续优化信息生成流程中的相关表述,此处不做具体表述。具体服务器中存储的什么内容,可以是出厂设定或者由用户设定。In this application, any one or more of the following may be actually stored in the server: all historical photos corresponding to the first person, and the first three-dimensional features determined according to the historical photos. For details on how to determine the 3D features of the first person based on the historical photos, you can refer to the relevant descriptions in the subsequent optimization information generation process, and no specific descriptions are made here. What content is stored in the specific server can be set by the factory or set by the user.

在一般情况下,手机上传至服务器的仅为历史照片(包括第一人物图像对应的历史照片),服务器在接收到历史照片后,可以根据出厂设定或者用户设定,生成相应的三维特征,以供后续手机调用。Under normal circumstances, the mobile phone uploads to the server only historical photos (including the historical photos corresponding to the first person image), and the server can generate corresponding 3D features according to the factory settings or user settings after receiving the historical photos. for subsequent calls.

若在服务器中存储的是第一人物对应的所有历史照片,服务器在接收到该接收到来自手机的第二请求的情况下,可以根据该第一人物对应的所有历史照片,确定第一三维特征。之后,服务器便可以向手机发送该第二响应。If all the historical photos corresponding to the first person are stored in the server, when the server receives the second request from the mobile phone, it can determine the first three-dimensional feature according to all the historical photos corresponding to the first person . Afterwards, the server can send the second response to the mobile phone.

其中,具体确定第一人物对应的所有历史照片的过程,可以是利用第一特征信息和所有历史照片中的人物的图像进行匹配。一般的,匹配过程中,会先将历史照片中的人物的图像的特征信息提取出来,然后与第一特征信息进行匹配。之后,将匹配度大于一定阈值的历史照片确定为第一人物对应的历史照片。Wherein, the specific process of determining all the historical photos corresponding to the first person may be to use the first feature information to match the images of the people in all the historical photos. Generally, during the matching process, the feature information of the image of the person in the historical photo is first extracted, and then matched with the first feature information. Afterwards, the historical photos whose matching degree is greater than a certain threshold are determined as the historical photos corresponding to the first person.

若在服务器中存储的是第一人物对应的第一三维特征,服务器则可以直接向手机发送该第二响应。If the first three-dimensional feature corresponding to the first person is stored in the server, the server may directly send the second response to the mobile phone.

其中,具体确定第一人物对应的第一三维特征的过程,可以是利用第一特征信息和服务器中存储的所有三维特征进行匹配。之后,将匹配度大于一定阈值的三维特征确定为第一人物对应的第一三维特征。Wherein, the specific process of determining the first three-dimensional feature corresponding to the first person may be to use the first feature information to match all three-dimensional features stored in the server. Afterwards, a three-dimensional feature whose matching degree is greater than a certain threshold is determined as the first three-dimensional feature corresponding to the first person.

示例性的,S1和S2对应的技术方案中,手机对拍摄的照片优化的过程可以参照图7所示。其中,区别在于,历史照片和/或三维特征,均存储在服务器中。而且,在服务器中未直接存储有三维模型的情况下,服务器在接收到第二请求后,会根据已存储的第一人物对应的历史照片生成第一三维特征,然后再向手机发送携带有第一三维特征的第二响应。或者服务器在接收到第二请求后,会根据已存储的第一三维特征生成第二响应,并向手机发送该第二响应。Exemplarily, in the technical solutions corresponding to S1 and S2, the process of optimizing the photos taken by the mobile phone may refer to FIG. 7 . Wherein, the difference is that the historical photos and/or three-dimensional features are all stored in the server. Moreover, if there is no 3D model directly stored in the server, after receiving the second request, the server will generate the first 3D feature according to the stored historical photos corresponding to the first person, and then send the first 3D feature to the mobile phone. A second response of a 3D feature. Or, after receiving the second request, the server generates a second response according to the stored first three-dimensional feature, and sends the second response to the mobile phone.

基于S1和S2对应的技术方案的技术效果和基于S3061A和S3062A对应的技术方案的技术效果类似,此处不再赘述。两者区别在于,基于S1和S2对应的技术方案中,手机还需要根据第一三维特征构建第一三维模型,需要消耗一定的计算资源。而S3061A和S3062A对应的技术方案中则不需要手机消耗这一部分计算资源。The technical effect based on the technical solution corresponding to S1 and S2 is similar to the technical effect based on the technical solution corresponding to S3061A and S3062A, and will not be repeated here. The difference between the two is that, in the corresponding technical solutions based on S1 and S2, the mobile phone also needs to construct the first 3D model according to the first 3D features, which consumes certain computing resources. However, in the technical solutions corresponding to S3061A and S3062A, the mobile phone does not need to consume this part of computing resources.

S3062B、手机利用第一三维特征,构建第一三维模型。S3062B. The mobile phone constructs a first three-dimensional model by using the first three-dimensional feature.

具体如何根据第一三维特征构建第一三维模型,可以依据任意可行的三维重建技术,本申请对此不做具体限制。Specifically, how to construct the first 3D model according to the first 3D features may be based on any feasible 3D reconstruction technology, which is not specifically limited in this application.

基于上述S3061B和S3062B对应的技术方案,手机可以根据第一特征信息更快捷的匹配到第一三维特征,并进一步构建得到第一三维模型。为后续照片优化提供的数据支持。Based on the above technical solutions corresponding to S3061B and S3062B, the mobile phone can more quickly match the first 3D feature according to the first feature information, and further construct the first 3D model. Data support provided for subsequent photo optimization.

S307、手机将第一三维模型与第一照片中第一人物的图像进行融合,以对第一照片中的第一人物的图像进行优化,得到第二照片。S307. The mobile phone fuses the first three-dimensional model with the image of the first person in the first photo to optimize the image of the first person in the first photo to obtain a second photo.

在手机得到第二照片后,手机可以将该第二照片存储在本地图库中,以供用户查看。同时,为了使用户可以明确知晓手机的优化效果,手机还可以将第一照片也进行存储,以方便用户比对。当然,出于节省存储空间的目的,也可以不存储第一照片。After the mobile phone obtains the second photo, the mobile phone can store the second photo in a local gallery for the user to view. At the same time, in order to enable the user to clearly know the optimization effect of the mobile phone, the mobile phone can also store the first photo to facilitate comparison by the user. Of course, for the purpose of saving storage space, the first photo may not be stored.

在手机仅存储了第二照片的情况下,为了使用户可以知晓图库中哪些照片是已被优化过的。示例性的,参照图10所示,优化过的照片(例如第二照片)中可以存在有优化标记101。In the case that the mobile phone only stores the second photo, in order for the user to know which photos in the gallery have been optimized. Exemplarily, as shown in FIG. 10 , there may be an optimization mark 101 in the optimized photo (for example, the second photo).

在手机存储了第二照片和第一照片的情况下,为了使用户可以知晓图库中哪些照片是已被优化过的,并且可以快捷的对比未优化前的第一照片和优化后的第二照片。示例性的,参照图11中(a)所示,手机图库中的第二照片111上可以显示有优化控件112。在用户看到优化控件112,并且想对比第一照片和第二照片时,用户可以对该优化控件112实施触发操作,例如点击操作。手机响应于用户对优化控件112的触发操作,参照图11中(b)所示,可以全屏显示第二照片111,并显示提示信息113。示例性的,该提示信息具体可以为“请左滑查看未优化前的照片”。In the case that the mobile phone stores the second photo and the first photo, in order to let the user know which photos in the library have been optimized, and quickly compare the unoptimized first photo and the optimized second photo . Exemplarily, as shown in (a) of FIG. 11 , an optimization control 112 may be displayed on the second photo 111 in the mobile phone gallery. When the user sees the optimization control 112 and wants to compare the first photo with the second photo, the user can perform a trigger operation on the optimization control 112 , such as a click operation. In response to the trigger operation of the optimization control 112 by the user, as shown in (b) in FIG. Exemplarily, the prompt information may specifically be "Please swipe left to view the unoptimized photo".

之后,用户可以在实施左滑操作。手机响应于用户实施的左滑操作,参照图11中(c)所示,逐渐将第二照片111从屏幕左侧滑出屏幕,并将第一照片114逐渐从右侧向左滑入屏幕。在用户实施的左滑操作结束后,手机则可以如图11中(d)所示,全屏显示第一照片114。After that, the user can perform a left-swipe operation. In response to the left sliding operation performed by the user, the mobile phone gradually slides the second photo 111 out of the screen from the left side of the screen, and gradually slides the first photo 114 into the screen from the right side to the left as shown in (c) in FIG. 11 . After the left sliding operation performed by the user ends, the mobile phone can display the first photo 114 in full screen as shown in (d) in FIG. 11 .

当然,图11中(a)、(b)、(c)和(d)所示的场景仅为示例,实际中还可以是其他任意可行的实现方式。例如,手机可以响应于用户对优化控件112的触发操作,将第一照片和第二照片同时显示在手机屏幕中。Certainly, the scenarios shown in (a), (b), (c) and (d) in FIG. 11 are only examples, and any other feasible implementation manners may also be adopted in practice. For example, the mobile phone may simultaneously display the first photo and the second photo on the screen of the mobile phone in response to the user's trigger operation on the optimization control 112 .

基于前述S301-S307对应的技术方案,手机可以在拍摄到包括人脸图像的照片时,获取到对应该照片中人脸图像所属的人物的三维模型。进而利用该三维模型,对该照片中的人物的图像进行优化,得到优化后的照片。因为该三维模型是表征反映出该人物对应的历史照片中,对应该人物的三维特征的。而多个历史照片中该人物的细节信息,则必然会比手机当前拍摄的照片中该人物的图像体现的细节更多。所以,该方案最终优化后的照片中,人物的图像的细节信息会更丰富,人物的图像也会更加清晰。这样,即便用户使用手机拍照时的环境不利于拍照,也可以得到人物的图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the aforementioned technical solution corresponding to S301-S307, when the mobile phone captures a photo including a face image, it can obtain a three-dimensional model corresponding to the person whose face image in the photo belongs to. Furthermore, the three-dimensional model is used to optimize the image of the person in the photo to obtain an optimized photo. Because the three-dimensional model represents and reflects the three-dimensional features of the person in the historical photos corresponding to the person. The detailed information of the person in multiple historical photos will inevitably reflect more details than the image of the person in the current photo taken by the mobile phone. Therefore, in the finally optimized photo of the solution, the detailed information of the image of the person will be richer, and the image of the person will be clearer. In this way, even if the environment when the user uses the mobile phone to take pictures is not conducive to taking pictures, the pictures with better imaging quality of the image of the person can be obtained, which improves the user experience.

在一些实施例中,手机拍照得到的照片中的人物会存在多个,所以在对照片中的人物的图像优化时,往往需要优化不止一个人物的图像。基于此,结合图3,参照图12所示,本申请实施例提供的拍摄照片的优化流程中,在S304步骤之后,还可以包括S308-S310:In some embodiments, there may be more than one person in the photo taken by the mobile phone, so when optimizing the image of the person in the photo, it is often necessary to optimize the image of more than one person. Based on this, referring to FIG. 3 and referring to FIG. 12 , in the optimization process for taking pictures provided by the embodiment of the present application, after step S304, S308-S310 may also be included:

S308、手机在确定第一照片中存在第二人脸图像的情况下,获取第二人脸图像所属的第二人物的第二特征信息。S308. The mobile phone acquires second feature information of a second person to whom the second face image belongs when it is determined that the second face image exists in the first photo.

其中,第二人脸图像和第一人脸图像不同,第二特征信息至少包括第二人物的人脸特征信息。进一步的,如果为了更准确的区分不同的人物的图像,使得后续获取到更准确的三维模型,这里的第二特征信息还可以包括第二人物的体态特征信息。Wherein, the second face image is different from the first face image, and the second feature information includes at least face feature information of the second person. Furthermore, if in order to more accurately distinguish images of different persons so that a more accurate three-dimensional model can be acquired subsequently, the second feature information here may also include body feature information of the second person.

S309、手机获取与第二特征信息匹配的第二三维模型。S309. The mobile phone acquires a second three-dimensional model that matches the second feature information.

其中,第二三维模型用于表征第一人物对应的历史照片中,第二人物三维特征;三维特征至少包括人脸三维特征;第二人物对应的历史照片中均包括有第二人物的图像。在为了后续可以更进一步的对第二人物的体态进行优化,这里的三维特征还可以包括有体态三维特征。这样后续利用第二三维模型对第二人物的图像进行融合优化时,可以使得第二人物的图像中人脸和身体的细节都更清晰,优化效果也就更好。Wherein, the second 3D model is used to represent the 3D features of the second person in the historical photos corresponding to the first person; the 3D features include at least the 3D features of the face; the historical photos corresponding to the second person all include images of the second person. In order to further optimize the posture of the second character in the follow-up, the three-dimensional features here may also include the three-dimensional characteristics of the posture. In this way, when the second three-dimensional model is used to fuse and optimize the image of the second person, the details of the face and body in the image of the second person can be made clearer, and the optimization effect is also better.

S310、手机将第二三维模型与第一照片中第二人物的图像进行融合,以对第一照片中的第二人物的图像进行优化,得到第三照片。S310. The mobile phone fuses the second three-dimensional model with the image of the second person in the first photo to optimize the image of the second person in the first photo to obtain a third photo.

本申请中,S308-S310可以和S305-S307并行执行,也可以先执行S305-S307后执行S308-S310,或者也可以是其他任意可行的执行顺序,对此本申请不做具体限制。S308-S310的具体实现可以参照前述S305-S307的相关表述,此处不再赘述。In this application, S308-S310 can be executed in parallel with S305-S307, or S308-S310 can be executed first after S305-S307, or can be executed in any other feasible order, which is not specifically limited in this application. For the specific implementation of S308-S310, reference may be made to the related expressions of S305-S307 above, which will not be repeated here.

在本申请中,在S304后若既执行了S304-S307,又执行S308-S310,则最终得到的优化有的照片则为第二照片和第三照片的结合体,该优化后的照片中,第一人物图像和第二人物图像均尽心了相应的优化。In this application, if both S304-S307 and S308-S310 are executed after S304, the finally obtained optimized photo is a combination of the second photo and the third photo. In the optimized photo, Both the first character image and the second character image are optimized accordingly.

当然,若第一照片中还存在除第一人脸图像和第二人脸图像以外的人脸图像,则可以根据前述实施例中对第一人脸图像和第二人脸图像的优化流程,对其他人脸图像进行优化,以得到全部人物图像均被优化后的照片。具体优化流程可以参照前述实施例中的表述,此处不再赘述。Of course, if there are face images other than the first face image and the second face image in the first photo, then according to the optimization process for the first face image and the second face image in the foregoing embodiment, Optimizing other face images to obtain a photo in which all person images are optimized. For a specific optimization process, reference may be made to the expressions in the foregoing embodiments, and details are not repeated here.

基于上述S308-S310对应的技术方案,针对手机拍摄的照片中的每个人物图像,手机均可以利用相应的三维模型进行优化。所以,该方案最终优化后的照片中,人物的图像的细节信息会更丰富,人物的图像也会更加清晰。这样,即便用户使用手机拍照时的环境不利于拍照,也可以得到人物的图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the above technical solutions corresponding to S308-S310, for each person image in the photos taken by the mobile phone, the mobile phone can use the corresponding three-dimensional model to optimize. Therefore, in the finally optimized photo of the solution, the detailed information of the image of the person will be richer, and the image of the person will be clearer. In this way, even if the environment when the user uses the mobile phone to take pictures is not conducive to taking pictures, the pictures with better imaging quality of the image of the person can be obtained, which improves the user experience.

在一些实施例中,如果手机当前拍摄的环境本身就属于适合拍照的场景,而不是不利于拍照的场景(例如暗光场景、逆光场景等),那么此时可能并没有对拍摄得到的照片中人物图像进行优化的必要。基于此,本申请提供的拍摄照片的优化流程中,S305具体可以是:手机在确定第一照片的拍摄环境为预设环境的情况下,若确定第一照片中包括人脸图像的情况下,获取第一人脸图像所属的第一人物图像的第一特征信息。In some embodiments, if the current shooting environment of the mobile phone itself belongs to a scene suitable for taking pictures, rather than a scene that is not conducive to taking pictures (such as a dark light scene, a backlight scene, etc.), then there may not be any changes in the captured photos at this time. It is necessary to optimize the character image. Based on this, in the photo optimization process provided by this application, S305 may specifically be: when the mobile phone determines that the shooting environment of the first photo is the preset environment, if it is determined that the first photo includes a face image, The first characteristic information of the first person image to which the first human face image belongs is acquired.

同理,S308具体可以是:手机在确定第一照片的拍摄环境为预设环境的情况下,若确定第一照片中包括人脸图像的情况下,获取第二人脸图像所属的第二人物的第一特征信息。Similarly, S308 may specifically be: when the mobile phone determines that the shooting environment of the first photo is the preset environment, if it is determined that the first photo includes a face image, obtain the second person to which the second face image belongs. The first characteristic information of .

后续已存储照片的优化流程中相似步骤的内容同理,后续不再赘述。The content of the similar steps in the optimization process of the subsequent stored photos is the same, and will not be repeated in the future.

其中,预设环境可以为暗光环境或逆光环境等。具体的,手机可以根据用户实施拍照操作时,手机所处环境的环境亮度,以及相机预览界面中人物的图像和背景图像(人物图像以外的图像)之间的亮度差,来确定手机是否处于暗光环境或逆光环境。例如,若确定环境亮度小于预设亮度值,则可以确定第一照片的拍摄环境为暗光环境;若确定相机预览界面中背景图像的亮度减去人物的图像的亮度的差值大于一定阈值,则确定第一照片的拍摄环境为逆光环境。当然,实际中第一照片的拍摄环境的判定还可以是其他任意可行的判定方式,本申请对此不作具体限制。Wherein, the preset environment may be a dark environment or a backlight environment. Specifically, the mobile phone can determine whether the mobile phone is in the dark according to the ambient brightness of the environment where the mobile phone is located when the user performs the camera operation, and the brightness difference between the image of the person in the camera preview interface and the background image (image other than the image of the person). light environment or backlight environment. For example, if it is determined that the ambient brightness is less than the preset brightness value, it can be determined that the shooting environment of the first photo is a dark light environment; if it is determined that the difference between the brightness of the background image in the camera preview interface and the brightness of the image of the person is greater than a certain threshold, Then it is determined that the shooting environment of the first photo is a backlight environment. Of course, in practice, the determination of the shooting environment of the first photo may also be any other feasible determination manner, which is not specifically limited in this application.

在S304后,若手机确定第一照片的拍摄环境不为预设环境,则不再执行拍摄照片的优化流程的后续步骤。而是直接存储第一照片即可。这样一来,因为只有在不利于拍照的环境下,手机才会对拍摄得到的照片中的人物图像进行优化,而利于拍照的环境下拍摄的照片中人物的图像的成像质量是足够好的。所以这样可以在保证手机拍摄的照片中人物的图像的成像指令的同时,大大降低了手机的计算资源和存储资源的浪费。After S304, if the mobile phone determines that the shooting environment of the first photo is not the preset environment, the subsequent steps of the optimization process for taking photos will not be executed. Instead, the first photo can be stored directly. In this way, only in an environment that is not conducive to taking pictures, the mobile phone will optimize the image of the person in the photo taken, and the image quality of the image of the person in the photo taken in an environment that is conducive to taking pictures is good enough. Therefore, this can greatly reduce the waste of computing resources and storage resources of the mobile phone while ensuring the imaging instructions of the images of the characters in the photos taken by the mobile phone.

在一些实施例中,参照图13中(a)所示,手机拍摄得到或已存储的第一照片131因为均是直接拍摄得到的,所以其中人物的图像和其背景之间的过渡在观感上会很平滑。用户查看该第一照片131时,也就不会有异样的感觉。而参照图13中(b)所示,优化后的第二照片(或者第三照片,或者第二照片和第三照片的结合)132中,因为对第一人物的图像133的优化,可能会导致第一人物的图像133的边缘和背景之间会存在较为明显的痕迹。这样一来,用户查看第二照片132时,虽然其中的第一人物图像会更清晰细节更多,但是会带给用户一种割裂感,观感不好。为了解决这一点,结合图12,参照图14所示,在S310和S307步骤之后,拍摄照片的优化流程还包括S311:In some embodiments, as shown in (a) in FIG. 13 , the first photo 131 captured or stored by the mobile phone is directly captured, so the transition between the image of the person and its background is more visually appealing. will be smooth. When the user views the first photo 131, he will not have any strange feeling. And referring to shown in (b) in Fig. 13, in the optimized second photo (or the third photo, or the combination of the second photo and the third photo) 132, because of the optimization of the image 133 of the first person, there may be As a result, there will be obvious traces between the edge of the image 133 of the first person and the background. In this way, when the user views the second photo 132, although the image of the first person in it will be clearer and more detailed, it will give the user a sense of fragmentation and a bad impression. In order to solve this point, referring to FIG. 12 and referring to FIG. 14, after steps S310 and S307, the optimization process for taking pictures also includes S311:

S311、手机将第一照片和第四照片进行融合,以得到第五照片。S311. The mobile phone fuses the first photo and the fourth photo to obtain a fifth photo.

其中,第四照片为电子设备对第一照片中的目标人物的图像进行优化后得到的;其中,目标人物包括第一人物和/或第二人物。当然,这里目标人物图像还可以包括手机拍摄的第一照片中的其他人物图像。Wherein, the fourth photo is obtained after the electronic device optimizes the image of the target person in the first photo; wherein, the target person includes the first person and/or the second person. Of course, the image of the target person here may also include images of other people in the first photo taken by the mobile phone.

一种可实现的方式中,这里第一照片和第四照片的融合可以是利用预先训练的目标深度学习模型来进行处理。其中,在将第一照片和第四照片输入该目标深度学习模型后,该目标深度学习模型可以输出一张人物的图像和背景图像(即除人物图像以外的图像)之间平滑过渡的照片,即第五照片。例如,目标深度学习模型可以是某些短视频应用中使用的改变人脸或者切换人物所处背景等工具对应的深度学习模型,或者其他任意可行的深度学习模型,本申请对此不做具体限制。In an achievable manner, the fusion of the first photo and the fourth photo may be processed by using a pre-trained target deep learning model. Wherein, after the first photo and the fourth photo are input into the target deep learning model, the target deep learning model can output a photo of a smooth transition between an image of a person and a background image (that is, an image other than a person image), That is the fifth photo. For example, the target deep learning model can be the deep learning model corresponding to the tools used in some short video applications such as changing the face or switching the background of the character, or any other feasible deep learning model, which is not specifically limited in this application .

另一种可实现的方式中,融合后的第五照片中的每个像素的像素值(例如,灰度值、RGB值等)可以是第一照片和第四照片中相应像素的平均值。或者,融合后的第五照片中背景图像中的每个像素的像素值是第一照片和第四照片中相应像素的平均,而人物的图像的像素值则可以是第一照片和第四照片中相应像素的平均值的预设百分比。其中,预设百分比可以根据人物图像的边缘区域的像素的像素值和相邻的背景图像的边缘区域的像素值的差别而定。In another practicable manner, the pixel value (for example, gray value, RGB value, etc.) of each pixel in the fused fifth photo may be the average value of corresponding pixels in the first photo and the fourth photo. Or, the pixel value of each pixel in the background image in the fused fifth photo is the average of the corresponding pixels in the first photo and the fourth photo, and the pixel value of the person's image can be the average of the first photo and the fourth photo A preset percentage of the average value of the corresponding pixel in . Wherein, the preset percentage may be determined according to the difference between the pixel values of the pixels in the edge area of the person image and the pixel values in the edge area of the adjacent background image.

上述两种实现方式仅为示例,实际中还可以是其他任意可行方式。The above two implementation manners are only examples, and any other feasible manners may also be used in practice.

基于S311对应的技术方案,因为手机最终处理得到的第五照片是由原始的第一照片和优化后的第四照片融合得到的,所以其不仅人物的图像清晰细节多,且人物的图像和背景图像之间不存在割裂感,整个画面更加和谐。进而,用户的观感也就更好,提高了用户的使用体验。Based on the technical solution corresponding to S311, because the fifth photo finally processed by the mobile phone is obtained by fusing the original first photo and the optimized fourth photo, not only the image of the person is clear and detailed, but also the image of the person and the background There is no sense of fragmentation between images, and the whole picture is more harmonious. Furthermore, the user's look and feel is better, and the user experience is improved.

当然,实际中为了使得最终得到的优化后的照片画面更和谐,还可以是其他不需要融合第一照片和第四照片的方式得到第五照片。例如,可以是根据第一照片中人物的图像和背景图像之间相连的部分区域的像素值的排列情况,对第四照片中相应区域的像素值进行调整得到第五照片。具体使用何种方式得到第五照片,本申请不做具体限制,只要保证最终得到的第五照片中,人物的图像和背景图像之间平滑过渡、不存在割裂感、照片整体更和谐即可。Of course, in practice, in order to make the finally obtained optimized picture more harmonious, the fifth picture can also be obtained in other ways that do not need to fuse the first picture and the fourth picture. For example, the fifth photo may be obtained by adjusting the pixel values of the corresponding area in the fourth photo according to the arrangement of the pixel values of the part of the area connected between the image of the person and the background image in the first photo. The specific method used to obtain the fifth photo is not specifically limited in this application, as long as the finally obtained fifth photo has a smooth transition between the image of the person and the background image, there is no sense of fragmentation, and the overall photo is more harmonious.

下面以电子设备为手机为例,对本申请实施例提供的照片优化方法中,已存储照片的优化流程进行介绍。如图15所示,该已存储照片的优化流程可以包括S1501-S1504:Taking the electronic device as a mobile phone as an example, the process of optimizing stored photos in the method for optimizing photos provided in the embodiment of the present application will be introduced below. As shown in Figure 15, the optimization process of the stored photos may include S1501-S1504:

S1501、手机响应于用户对图库展示界面中第一目标照片的优化操作,将第一目标照片确定为第一照片。S1501. The mobile phone determines the first target photo as the first photo in response to the user's optimization operation on the first target photo in the gallery display interface.

其中,图库展示界面中包括有多个照片。图库展示界面可以是手机在接收到用户对图库应用图标实施的触发操作(如点击操作)后,响应于该操作显示的。图库展示界面也可以是电子设备在接收到用户对相机预览界面中存在的图库选项实施的触发操作后,响应于该操作显示的。其中图库选项可以用于触发打开图库应用并显示图库展示界面。Wherein, the gallery display interface includes multiple photos. The gallery display interface may be displayed by the mobile phone in response to a trigger operation (such as a click operation) performed by the user on the gallery application icon after receiving the operation. The gallery display interface may also be displayed by the electronic device in response to a trigger operation performed by the user on the gallery option existing in the camera preview interface after receiving the operation. The gallery option can be used to trigger the opening of the gallery application and display the gallery display interface.

示例性的,图库展示界面可以如图16中(a)所示。手机可以接收用户对图库展示界面中第一目标照片161的触发操作(如点击操作)。响应于该触发操作,手机可以显示如图16中(b)所示的第一目标照片的详情界面162,该详情界面162中包括有优化控件163。该详情界面162中主要用于供用户查看该第一目标照片、第一目标照片的相关信息(例如生成时间和地区,图中以2021年10月25日,上午10:00西安市长安区为例)以及对第一目标照片进行可行的操作(例如分享、收藏、优化、删除等)。之后,手机可以响应于用户对详情界面162中优化控件163的触发操作,将第一目标照片确定为第一照片。之后则对该第一照片进行照片优化,即执行后续的S1502-S1504。Exemplarily, the gallery display interface may be as shown in (a) in FIG. 16 . The mobile phone may receive a user's trigger operation (such as a click operation) on the first target photo 161 in the gallery display interface. In response to the trigger operation, the mobile phone may display a detail interface 162 of the first target photo as shown in (b) of FIG. 16 , and the detail interface 162 includes an optimization control 163 . The details interface 162 is mainly used for the user to view the first target photo and related information of the first target photo (such as the time and region of generation, in the figure, October 25, 2021, 10:00 AM in Chang'an District, Xi'an City) example) and perform feasible operations on the first target photo (such as sharing, collecting, optimizing, deleting, etc.). Afterwards, the mobile phone may determine the first target photo as the first photo in response to the user's trigger operation on the optimization control 163 in the detail interface 162 . Afterwards, photo optimization is performed on the first photo, that is, subsequent steps S1502-S1504 are performed.

这里,可以将用户在图库展示界面中对第一目标照片的触发操作以及用户在第一目标照片的详情界面中对优化控件的触发操作,认为是上述提到的优化操作。实际中,该优化操作还可以是其他任意可行的实现方式。例如,该优化操作还可以是用户在图库展示界面中对第一目标照片的触发操作,和用户在第一目标照片的详情界面时输入的手势指令或者语音指令的组合。本申请对此不做具体限制。Here, the user's trigger operation on the first target photo in the gallery display interface and the user's trigger operation on the optimization control in the details interface of the first target photo can be regarded as the aforementioned optimization operations. In practice, the optimization operation may also be any other feasible implementation manner. For example, the optimization operation may also be a combination of a user's trigger operation on the first target photo in the gallery display interface and a gesture command or voice command input by the user in the details interface of the first target photo. This application does not specifically limit this.

需要说明的是,在本申请中,对于包括人脸图像的照片的详情界面,才会存在优化控件。It should be noted that, in this application, optimization controls only exist for the details interface of photos including face images.

S1502、手机在确定第一照片中包括人脸图像的情况下,获取第一人脸图像所属的第一人物的第一特征信息。S1502. When the mobile phone determines that the first photo includes a face image, acquire first characteristic information of the first person to whom the first face image belongs.

其中,第一特征信息至少包括第一人物的人脸特征信息。示例性的,人脸特征信息中的具体特征可以包括以下至少一种:人脸细节信息、肤色、皮肤纹理。其中,人脸细节信息则可以包括有五官相对位置和五官大小等信息。Wherein, the first feature information includes at least face feature information of the first person. Exemplarily, the specific features in the face feature information may include at least one of the following: face detail information, skin color, and skin texture. Among them, the facial detail information may include information such as relative positions and sizes of facial features.

进一步的,如果为了更准确的区分不同的人物图像,使得后续获取到更准确的三维模型,这里的第一特征信息还可以包括第一人物的体态特征信息。体态特征信息中的具体特征可以包括但不限于以下至少一种:四肢形态、身体比例。Furthermore, if in order to distinguish different person images more accurately so that a more accurate 3D model can be obtained later, the first feature information here may also include body feature information of the first person. The specific features in the body feature information may include but not limited to at least one of the following: limb shape, body proportion.

S1502的具体实现可以参照前述S305的相关表述,此处不再赘述。For the specific implementation of S1502, reference may be made to the related expression of S305 above, which will not be repeated here.

S1503、手机获取与第一特征信息匹配的第一三维模型。S1503. The mobile phone acquires a first three-dimensional model that matches the first feature information.

其中,第一三维模型用于表征第一人物图像对应的历史照片中,第一人物的三维特征。三维特征至少包括人脸三维特征。第一人物对应的历史照片中均包括有第一人物的图像。在为了后续可以更进一步的对第一人物的体态进行优化,这里的三维特征还可以包括有体态三维特征。这样后续利用第一三维模型对第一人物的图像进行融合优化时,可以使得第一人物的人脸和身体的细节都更清晰,优化效果也就更好。Wherein, the first three-dimensional model is used to represent the three-dimensional features of the first person in the historical photos corresponding to the image of the first person. The three-dimensional features include at least three-dimensional features of human face. The historical photos corresponding to the first person all include the image of the first person. In order to further optimize the posture of the first character in the follow-up, the three-dimensional features here may also include three-dimensional characteristics of the posture. In this way, when the first three-dimensional model is used to fuse and optimize the image of the first person, details of the face and body of the first person can be made clearer, and the optimization effect is also better.

S1503的具体实现方式可以按照前述实施例中S306的具体表述,此处不再赘述。The specific implementation manner of S1503 may follow the specific expression of S306 in the foregoing embodiments, which will not be repeated here.

S1504、手机将第一三维模型与第一照片中第一人物的图像进行融合,以对第一照片中的第一人物图的像进行优化,得到第二照片。S1504. The mobile phone fuses the first three-dimensional model with the image of the first person in the first photo to optimize the image of the first person in the first photo to obtain a second photo.

在手机得到第二照片后,手机可以将该第二照片存储在本地图库中,以供用户查看。同时,为了使用户可以明确知晓手机的优化效果,手机还可以将第一照片也进行存储,以方便用户比对。当然,出于节省存储空间的目的,也可以不存储第一照片。After the mobile phone obtains the second photo, the mobile phone can store the second photo in a local gallery for the user to view. At the same time, in order to enable the user to clearly know the optimization effect of the mobile phone, the mobile phone can also store the first photo to facilitate comparison by the user. Of course, for the purpose of saving storage space, the first photo may not be stored.

在手机仅存储了第二照片,或者手机存储了第一照片和第二照片的情况的具体示例,可以参照前述S307后的相关表述,此处不再赘述。For a specific example of the case where the mobile phone stores only the second photo, or the mobile phone stores both the first photo and the second photo, reference may be made to the relevant expressions after S307 above, and details will not be repeated here.

基于前述S1501-S1504对应的技术方案,手机可以在用户指示对本地图库中的第一目标照片进行优化时(即对第一目标照片实施优化操作),可以先获取到对应该照片中人脸图像所属的人物图像的三维模型。进而利用该三维模型,对该照片中的人物的图像进行优化,得到优化后的照片。因为该三维模型是表征反映出该人物对应的历史照片中,该人物的三维特征的。而多个历史照片中该人物的图像对应的人物的细节信息,则必然会比手机当前拍摄的照片中该人物的图像体现的细节更多。所以,该方案最终优化后的照片中,人物的图像的细节信息会更丰富,人物的图像也会更加清晰。这样,即便手机已存储的第一目标照片在拍摄时的环境不利于拍照,也可以通过手机后续的优化得到人物的图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the technical solution corresponding to the aforementioned S1501-S1504, when the user instructs to optimize the first target photo in the local gallery (i.e. optimize the first target photo), the mobile phone can first obtain the face image corresponding to the photo A 3D model of the character image to which it belongs. Furthermore, the three-dimensional model is used to optimize the image of the person in the photo to obtain an optimized photo. Because the three-dimensional model represents and reflects the three-dimensional features of the person in the historical photos corresponding to the person. And the detailed information of the person corresponding to the image of the person in the multiple historical photos must be more detailed than the image of the person in the current photo taken by the mobile phone. Therefore, in the finally optimized photo of the solution, the detailed information of the image of the person will be richer, and the image of the person will be clearer. In this way, even if the environment of the first target photo stored in the mobile phone is not conducive to taking pictures, the subsequent optimization of the mobile phone can obtain a photo with better imaging quality of the image of the person, which improves the user experience.

在一些实施例中,第一照片中的人物会存在多个,所说在对第一照片中的人物的图像优化时,往往需要优化不止一个人物的图像。基于此,结合图15,参照图17所示,本申请实施例提供的已存储照片的优化流程中,在S1501后,还可以包括S1505-S1507:In some embodiments, there may be more than one person in the first photo, so when optimizing the image of a person in the first photo, it is often necessary to optimize the image of more than one person. Based on this, referring to FIG. 15 and referring to FIG. 17 , in the optimization process of stored photos provided by the embodiment of the present application, after S1501, S1505-S1507 may also be included:

S1505、手机在确定第一照片中存在人脸图像的情况下,获取第二人脸图像所属的第二人物的第二特征信息。S1505. When the mobile phone determines that there is a face image in the first photo, acquire second feature information of the second person to whom the second face image belongs.

其中,第二人脸图像和第一人脸图像不同,第二特征信息至少包括第二人物的人脸特征信息。进一步的,如果为了更准确的区分不同的人物的图像,使得后续获取到更准确的三维模型,这里的第二特征信息还可以包括第二人物的体态特征信息。体态特征信息中的具体特征可以包括但不限于以下至少一种:四肢形态、身体比例。Wherein, the second face image is different from the first face image, and the second feature information includes at least face feature information of the second person. Furthermore, if in order to more accurately distinguish images of different persons so that a more accurate three-dimensional model can be acquired subsequently, the second feature information here may also include body feature information of the second person. The specific features in the body feature information may include but not limited to at least one of the following: limb shape, body proportion.

S1506、手机获取与第二特征信息匹配的第二三维模型。S1506. The mobile phone acquires a second three-dimensional model that matches the second feature information.

其中,第二三维模型用于表征第二人物对应的历史照片中,第二人物的三维特征;三维特征至少包括人脸三维特征;第二人物对应的历史照片中均包括有第二人物的图像。在为了后续可以更进一步的对第二人物图像的体态进行优化,这里的三维特征还可以包括有体态三维特征。这样后续利用第二三维模型对第二人物的图像进行融合优化时,可以使得第二人物的图像中人脸和身体的细节都更清晰,优化效果也就更好。Wherein, the second three-dimensional model is used to represent the three-dimensional features of the second person in the historical photos corresponding to the second person; the three-dimensional features include at least the three-dimensional features of the face; the historical photos corresponding to the second person all include images of the second person . In order to further optimize the posture of the second person image in the future, the three-dimensional features here may also include the three-dimensional characteristics of the posture. In this way, when the second three-dimensional model is used to fuse and optimize the image of the second person, the details of the face and body in the image of the second person can be made clearer, and the optimization effect is also better.

S1507、手机将第二三维模型与第一照片中第二人物的图像进行融合,以对第一照片中的第二人物的图像进行优化,得到第三照片。S1507. The mobile phone fuses the second three-dimensional model with the image of the second person in the first photo to optimize the image of the second person in the first photo to obtain a third photo.

本申请中,S1505-S1507可以和S1502-S1504并行执行,也可以先执行S1502-S1504后执行S1505-S1507,或者也可以是其他任意可行的执行顺序,对此本申请不做具体限制。S1505-S1507的具体实现可以参照前述S1502-S1504的相关表述,此处不再赘述。In this application, S1505-S1507 can be executed in parallel with S1502-S1504, or S1502-S1504 can be executed first and then S1505-S1507 can be executed, or any other feasible execution sequence can be used, which is not specifically limited in this application. For the specific implementation of S1505-S1507, reference may be made to the related expressions of S1502-S1504 above, which will not be repeated here.

在本申请中,在S1501后若既执行了S1502-S1504,又执行S1505-S1507,则最终得到的优化有的照片则为第二照片和第三照片的结合体,该优化后的照片中,第一人物的图像和第二人物的图像均尽心了相应的优化。In this application, if both S1502-S1504 and S1505-S1507 are executed after S1501, the finally obtained optimized photo is a combination of the second photo and the third photo. In the optimized photo, Both the image of the first person and the image of the second person have been optimized accordingly.

当然,若第一照片中还存在除第一人脸图像和第二人脸图像以外的人脸图像,则可以根据前述实施例中对第一人脸图像和第二人脸图像的优化流程,对其他人脸图像进行优化,以得到全部人物图像均被优化后的照片。具体优化流程可以参照前述实施例中的表述,此处不再赘述。Of course, if there are face images other than the first face image and the second face image in the first photo, then according to the optimization process for the first face image and the second face image in the foregoing embodiment, Optimizing other face images to obtain a photo in which all person images are optimized. For a specific optimization process, reference may be made to the expressions in the foregoing embodiments, and details are not repeated here.

基于上述S1505-S1507对应的技术方案,针对第一照片中的每个人物图像,手机均可以利用相应的三维模型进行优化。所以,该方案最终优化后的照片中,人物的图像的细节信息会更丰富,人物的图像也会更加清晰。这样,即便手机已存储的第一目标照片在拍摄时的环境不利于拍照,也可以通过手机后续的优化得到人物的图像的成像质量较好的照片,也就提高了用户的使用体验。Based on the above technical solution corresponding to S1505-S1507, for each character image in the first photo, the mobile phone can use the corresponding three-dimensional model to optimize. Therefore, in the finally optimized photo of the solution, the detailed information of the image of the person will be richer, and the image of the person will be clearer. In this way, even if the environment of the first target photo stored in the mobile phone is not conducive to taking pictures, the subsequent optimization of the mobile phone can obtain a photo with better imaging quality of the image of the person, which improves the user experience.

在一些实施例中,手机已存储的未被优化过的第一目标照片因为是直接拍摄得到的,所以其中的人物图像和其背景之间的过渡在观感上会很平滑。而优化后的第二照片(或者第三照片,或者第二照片和第三照片的结合),因为其中人物图像是经过优化的,可能会导致人物图像与背景图像(即除人物图像以外的图像)之间存在较为明显的区别,产生割裂感。这样,会带给用户不好的观感,影响用户体验。为了解决这一点,结合图17,参照图18所示,在S1504和S1507步骤之后,已存储照片的优化流程还包括S1508:In some embodiments, since the unoptimized first target photo stored in the mobile phone is directly captured, the transition between the character image and its background will be smooth in appearance. And the optimized second photo (or the third photo, or the combination of the second photo and the third photo), because the character image is optimized, may cause the character image to be different from the background image (that is, images other than the character image) ) There is a relatively obvious difference, resulting in a sense of fragmentation. In this way, it will give the user a bad impression and affect the user experience. In order to solve this point, referring to FIG. 17 and referring to FIG. 18, after steps S1504 and S1507, the optimization process of stored photos also includes S1508:

S1508、手机将第一照片和第四照片进行融合,以得到第五照片。S1508. The mobile phone fuses the first photo and the fourth photo to obtain a fifth photo.

其中,第四照片为电子设备对第一照片中的目标人物的图像进行优化后得到的;其中,目标人物包括第一人物和/或第二人物像。当然,这里目标人物的图像还可以包括手机拍摄的第一照片中的其他人物的图像。Wherein, the fourth photo is obtained after the electronic device optimizes the image of the target person in the first photo; wherein, the target person includes the image of the first person and/or the second person. Of course, the image of the target person here may also include images of other people in the first photo taken by the mobile phone.

S1508的具体实现可以参照前述实施例中S11步骤的相关表述,此处不再赘述。For the specific implementation of S1508, reference may be made to the relevant description of step S11 in the foregoing embodiments, and details are not repeated here.

基于S1508对应的技术方案,因为手机最终处理得到的第五照片是由原始的第一照片和优化后的第四照片融合得到的,所以其不仅人物的图像清晰细节多,且人物的图像和背景图像之间不存在割裂感,整个画面更加和谐。进而,用户的观感也就更好,提高了用户的使用体验。Based on the technical solution corresponding to S1508, because the fifth photo finally processed by the mobile phone is obtained by fusing the original first photo and the optimized fourth photo, not only the image of the person is clear and detailed, but also the image of the person and the background There is no sense of fragmentation between images, and the whole picture is more harmonious. Furthermore, the user's look and feel is better, and the user experience is improved.

当然,实际中为了使得最终得到的优化后的照片画面更和谐,还可以是其他不需要融合第一照片和第四照片的方式得到第五照片。例如,可以是根据第一照片中人物的图像和背景图像之间相连的部分区域的像素值的排列情况,对第四照片中相应区域的像素值进行调整得到第五照片。具体使用何种方式得到第五照片,本申请不做具体限制,只要保证最终得到的第五照片中,人物图像和背景图像之间平滑过渡、不存在割裂感、照片整体更和谐即可。下面以电子设备为手机为例,对本申请实施例提供的照片优化方法中,优化信息生成流程进行介绍。如图19所示,该优化信息生成流程可以包括S1901-S1904:Of course, in practice, in order to make the finally obtained optimized picture more harmonious, the fifth picture can also be obtained in other ways that do not need to fuse the first picture and the fourth picture. For example, the fifth photo may be obtained by adjusting the pixel values of the corresponding area in the fourth photo according to the arrangement of the pixel values of the part of the area connected between the image of the person and the background image in the first photo. The specific method used to obtain the fifth photo is not specifically limited in this application, as long as the finally obtained fifth photo has a smooth transition between the character image and the background image, there is no sense of fragmentation, and the overall photo is more harmonious. Taking the electronic device as a mobile phone as an example, the process of generating optimization information in the photo optimization method provided in the embodiment of the present application will be introduced below. As shown in Figure 19, the optimization information generation process may include S1901-S1904:

S1901、手机获取当前时刻之前至少一个历史照片集合。S1901. The mobile phone acquires at least one historical photo collection before the current moment.

其中,每个历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;历史照片集合中的每张历史照片中均存在历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联第一人物的第一历史照片集合。Wherein, each historical photo collection is associated with a person, and different historical photo collections are associated with different characters; each historical photo in the historical photo collection has an image of the person associated with the historical photo collection; at least one historical photo collection A first collection of historical photos associated with a first person is included.

一种可实现的方式中,至少一个历史照片集合可以存储在手机本地的图库中,此时手机可以从图库中获取至少一个历史照片集合。In an implementable manner, at least one historical photo collection may be stored in a local gallery of the mobile phone, and at this time, the mobile phone may obtain at least one historical photo collection from the gallery.

示例性的,手机的图库应用本身可以具备对历史照片进行人脸识别以按照人物进行分类的功能。基于此,手机中的本地图库中可以按照如图20所示的分类情况对历史照片进行分类,得到至少一个历史照片集合201并显示。图20中以至少一个历史照片集合201包括历史照片集合201-1、历史照片集合201-2、历史照片集合201-3和历史照片集合201-4为例,实际中可以更多或更少。每个历史照片集合201均会关联一个人物,即每个历史照片集合201中的每张照片中均会包括有该历史照片集合201关联的人物的图像。参照图20所示,实际中为了方便用户知晓手机中存储的多个历史照片集合关联的人物分别是谁,每个历史照片集合201的关联区域(例如右下方)均可以备注有该人物的标识,例如姓名或者昵称等。该标识可以由用户根据自身需要自由设置。Exemplarily, the gallery application of the mobile phone itself may have the function of performing face recognition on historical photos to classify them according to persons. Based on this, the historical photos can be classified in the local gallery in the mobile phone according to the classification situation shown in FIG. 20 , and at least one historical photo collection 201 can be obtained and displayed. In FIG. 20, at least one historical photo collection 201 includes historical photo collection 201-1, historical photo collection 201-2, historical photo collection 201-3, and historical photo collection 201-4 as an example, and there may be more or fewer in practice. Each historical photo collection 201 is associated with a person, that is, each photo in each historical photo collection 201 includes an image of the person associated with the historical photo collection 201 . Referring to Figure 20, in practice, in order to facilitate users to know who are the people associated with multiple historical photo collections stored in the mobile phone, the associated area (for example, the lower right) of each historical photo collection 201 can be marked with the identification of the person , such as name or nickname. This flag can be freely set by the user according to their own needs.

另一种可实现的方式中,至少一个历史照片集合可以存储在与手机关联的服务器中,此时手机可以向服务器请求至少一个历史照片集合,从而使服务器将该至少一个历史照片结合发送给该手机。具体的,服务器一般是直接接收到手机上报的历史照片,而不是历史照片结合,所以服务器在接收到某个手机上报的历史照片后,可以对历史照片进行人脸识别以按照人物进行分类,得到至少一个历史照片集合。之后,在接收到某个手机发送的请求历史照片结合的请求信息时,便可以将对应该手机的所有历史照片发送给该手机,并同时发送每个历史照片的分类结果。In another practicable manner, at least one historical photo collection can be stored in a server associated with the mobile phone, and at this time the mobile phone can request at least one historical photo collection from the server, so that the server can send the at least one historical photo combination to the cell phone. Specifically, the server generally directly receives the historical photos reported by the mobile phone, rather than combining historical photos, so after the server receives the historical photos reported by a certain mobile phone, it can perform face recognition on the historical photos to classify them according to the characters, and obtain At least one historical photo collection. Afterwards, when receiving a request message from a mobile phone for combining historical photos, all historical photos corresponding to the mobile phone can be sent to the mobile phone, and the classification results of each historical photo can be sent at the same time.

S1902、手机根据历史照片集合,确定历史照片集合关联的人物的三维特征。S1902. The mobile phone determines, according to the historical photo collection, the three-dimensional features of the person associated with the historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

一种可实现的方式中,手机可以根据任意可行的特征提取方式,从历史照片结合中的每张历史照片中提取该历史照片结合关联的人物的三维特征。最终将所有提取的三维特征进行统计去重后,得到该人物的三维特征。In an achievable manner, the mobile phone may extract, from each historical photo in the combination of historical photos, the three-dimensional features of the person associated with the combination of historical photos according to any feasible feature extraction method. Finally, after all the extracted 3D features are statistically deduplicated, the 3D features of the character are obtained.

另一种可实现的方式中,因为对于成像质量不好的历史照片而言,其中人物的图像的成像质量必然也是比较差的,所以对每个历史照片进行特征提取是较为浪费资源的。基于此,为了降低计算资源的消耗,结合图19,参照图21所示,S1902具体可以包括S19021和S19022:In another practicable manner, because for historical photos with poor imaging quality, the imaging quality of the images of the people in them must be relatively poor, so it is a waste of resources to perform feature extraction for each historical photo. Based on this, in order to reduce the consumption of computing resources, referring to FIG. 19 and referring to FIG. 21, S1902 may specifically include S19021 and S19022:

S19021、手机根据历史照片集合中每个历史照片的成像质量参数,从历史照片集合中确定至少一个第二目标照片。S19021. The mobile phone determines at least one second target photo from the historical photo collection according to the imaging quality parameters of each historical photo in the historical photo collection.

其中,成像质量参数包括:分辨率、历史照片集合关联的人物对应的人物图像的完整程度。至少一个第二第一目标照片的成像质量参数高于历史照片集合中其他照片的成像质量参数。Wherein, the imaging quality parameters include: resolution, and the completeness of the image of the person corresponding to the person associated with the historical photo collection. The imaging quality parameter of at least one second first target photo is higher than the imaging quality parameters of other photos in the historical photo collection.

示例性的,手机可以将历史照片集合中分辨率大于预设阈值,历史照片集合关联的人物对应的人物图像至少包括完整的上半身的历史照片,确定为第二目标照片。实际中也可以采用更多或更少的成像质量参数来确定第二目标照片,本申请对此不做具体限制。Exemplarily, the mobile phone may determine, as the second target photo, a historical photo in which the resolution of the historical photo collection is greater than a preset threshold and the person image corresponding to the person associated with the historical photo collection includes at least a complete upper body. In practice, more or fewer imaging quality parameters may also be used to determine the second target photo, which is not specifically limited in this application.

S19022、手机根据第二目标照片,确定历史照片集合关联的人物的三维特征。S19022. The mobile phone determines, according to the second target photo, the three-dimensional features of the person associated with the historical photo collection.

具体的,手机可以使用任意可行的特征提取方式将每个第二目标照片中,与其所属的历史照片集合关联的人物三维特征提取出来,然后进行统计去重后,得到该人物的三维特征。Specifically, the mobile phone can use any feasible feature extraction method to extract the three-dimensional features of the person associated with the historical photo set to which it belongs in each second target photo, and then perform statistical deduplication to obtain the three-dimensional features of the person.

基于上述S19021和S19022对应的技术方案中,手机可以从历史照片集合中选择成像质量参数较高的第二目标照片,作为提取三维特征的基础。这样一来,手机便可以以尽可能少的计算资源提取到历史照片集合关联的人物的三维特征,节省了电子设备的计算资源。Based on the above technical solutions corresponding to S19021 and S19022, the mobile phone may select a second target photo with a higher imaging quality parameter from the historical photo collection as a basis for extracting three-dimensional features. In this way, the mobile phone can extract the three-dimensional features of the people associated with the historical photo collection with as few computing resources as possible, saving computing resources of electronic devices.

S1903、手机根据历史照片集合关联的人物的三维特征,构建历史照片集合关联的人物的三维模型。S1903. The mobile phone constructs a 3D model of the person associated with the historical photo collection according to the 3D features of the person associated with the historical photo collection.

具体的,手机可以使用任意可行的三维重建技术,将三维特征构建成相应的三维模型。Specifically, the mobile phone may use any feasible 3D reconstruction technology to construct a 3D feature into a corresponding 3D model.

S1904、手机存储历史照片集合关联的人物的三维模型。S1904. The mobile phone stores the three-dimensional model of the person associated with the historical photo collection.

需要说明的是,在拍摄照片的优化流程中,上述S1901-S1904是在S306步骤前执行的;在已存储照片的优化流程中,上述S1901-S1904是在S1503步骤前执行的。这样,手机才可以顺利获取到第一三维模型。具体S1901-S1904在S306步骤或者S1503步骤前的什么时候执行,可以根据实际需求而定。It should be noted that, in the photo optimization process, the above steps S1901-S1904 are executed before step S306; in the stored photo optimization process, the above S1901-S1904 are executed before step S1503. In this way, the mobile phone can successfully obtain the first three-dimensional model. Specifically, when to execute S1901-S1904 before step S306 or step S1503 may be determined according to actual requirements.

基于上述S1902-S1904对应的技术方案,手机可以提前构建好历史照片中对应的各个人物的三维模型,乃至在本地中存储各个人物的三维模型,方便后续需要对拍摄的照片进行优化时使用。这样一来,可以使得手机在对拍摄照片进行优化时,可以顺利快捷的获取到需要的三维模型,提高了照片优化的效率。Based on the above-mentioned technical solutions corresponding to S1902-S1904, the mobile phone can build the 3D models of the corresponding characters in the historical photos in advance, and even store the 3D models of the characters locally, so as to facilitate the subsequent use when optimizing the photos taken. In this way, the mobile phone can smoothly and quickly obtain the required three-dimensional model when optimizing the photo taken, which improves the efficiency of photo optimization.

在本申请提供的照片优化方法中的照片优化流程中(包括拍摄照片的优化流程和已存储照片的优化流程),若手机获取第一三维模型是通过先获取第一三维特征而后构建得到第一历史三维模型的方式。则结合图19,参照图22所示,S1902步骤后执行S1905步骤:In the photo optimization process in the photo optimization method provided in this application (including the optimization process of taking photos and the optimization process of stored photos), if the mobile phone obtains the first 3D model by first obtaining the first 3D features and then constructing the first way of historical 3D models. Then in combination with FIG. 19, referring to FIG. 22, step S1905 is executed after step S1902:

S1905、手机存储历史照片集合关联的人物的三维特征。S1905. The mobile phone stores the three-dimensional features of the people associated with the historical photo collection.

基于该方案,手机可以提前构建好历史照片中对应的各个人物的三维模型,乃至在本地中存储的是历史照片中关联的各个人物的三维特征,方便后续手机需要对照片进行优化时从本地获取第一三维特征,进而构建得到第一三维模型。这样,也就使得手机在对拍摄照片进行优化时,可以顺利快捷的获取到需要的三维模型,提高了照片优化的效率。Based on this solution, the mobile phone can build the 3D models of the corresponding characters in the historical photos in advance, and even store locally the 3D features of the related characters in the historical photos, which is convenient for the mobile phone to obtain from the local when it needs to optimize the photos. The first three-dimensional feature is further constructed to obtain the first three-dimensional model. In this way, the mobile phone can smoothly and quickly obtain the required three-dimensional model when optimizing the photo taken, which improves the efficiency of photo optimization.

另外,上述S1901-S1905中的每个步骤均可以由服务器执行,即执行主体由手机变为服务器。在这种情况下,S1901-S1905中由服务器执行的步骤越多,就越能降低该方案对手机的计算能力和/或存储能力的需求。当然,同时如果最终手机在进行照片优化时需要从服务器中获取三维模型或三维特征,由于需要来回信令和数据的交互,所以会在一定程度上增加照片优化的延迟。具体选择由服务器还是手机作为执行主体,则可以根据实际需求而定,本申请对此不做具体限制。In addition, each step in the above S1901-S1905 can be executed by the server, that is, the execution subject changes from the mobile phone to the server. In this case, the more steps performed by the server in S1901-S1905, the more the requirement of the solution on the computing power and/or storage capacity of the mobile phone can be reduced. Of course, at the same time, if the final mobile phone needs to obtain the 3D model or 3D features from the server when performing photo optimization, the delay of photo optimization will be increased to a certain extent due to the need for back-and-forth signaling and data interaction. The specific selection of whether to use the server or the mobile phone as the execution body may be determined according to actual needs, and this application does not make specific restrictions on this.

在一些实施例中,为了使得手机在需要对某个人物的图像进行优化时,能够获取到的优化信息(三维模型或三维特征)是结合了所有历史照片得到的。手机需要在每次对照片中的人物的图像进行优化后,将当前未优化前的照片也作为下一次优化时的历史照片并对相应的优化信息进行更新。In some embodiments, in order for the mobile phone to optimize an image of a person, the obtained optimization information (3D model or 3D feature) is obtained by combining all historical photos. The mobile phone needs to use the current unoptimized photo as the historical photo for the next optimization after each optimization of the image of the person in the photo and update the corresponding optimization information.

基于此,在优化信息为三维模型的情况下,基于S1901-S1904对应的技术方案,结合图3,参照图23所示,该拍摄照片的优化流程中,S304步骤之后还可以包括S312-S315:Based on this, in the case that the optimization information is a three-dimensional model, based on the technical solution corresponding to S1901-S1904, in combination with FIG. 3, referring to FIG. 23, in the optimization process for taking photos, S312-S315 may also be included after step S304:

S312、手机将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合。S312. The mobile phone adds the first photo to the first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection.

当然,结合前述实施例中S1921和S1922对应的技术方案,如果手机在确定三维特征时,仅为提取历史照片集合中的第二目标照片的三维特征。那么本申请中,S312执行前,手机可以先确定第一照片是否是第二目标照片,若不是,则不再执行S312-S315;若是,则执行S312-S315。这样一来,因为对于不是第二目标照片的第一照片,不需要额外执行S312-S315步骤,也就节省了这部分流程造成的手机计算和存储资源的消耗。后续类似步骤同理,后续不再赘述。Of course, in combination with the technical solutions corresponding to S1921 and S1922 in the foregoing embodiments, if the mobile phone determines the 3D features, it only extracts the 3D features of the second target photo in the historical photo collection. In this application, before executing S312, the mobile phone may first determine whether the first photo is the second target photo, if not, then do not execute S312-S315; if yes, execute S312-S315. In this way, for the first photo that is not the second target photo, there is no need to additionally perform steps S312-S315, which saves the consumption of computing and storage resources of the mobile phone caused by this part of the process. Subsequent similar steps are the same, and will not be repeated in the future.

S313、手机根据第二历史照片集合,重新确定第一人物的三维特征。S313. The mobile phone re-determines the three-dimensional features of the first person according to the second historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。本申请中的第一人物的三维特征即为前述实施例提到的第一三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features. The three-dimensional features of the first person in the present application are the first three-dimensional features mentioned in the foregoing embodiments.

其中,S313的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S313, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S314、手机根据重新确定的第一人物的三维特征,重新构建第一人物的三维模型。S314. The mobile phone reconstructs a three-dimensional model of the first person according to the re-determined three-dimensional features of the first person.

其中,S314的具体实现可以参照前述S193的相关表述,此处不再赘述。本申请中的第一人物的三维模型即为前述实施例提到的第一三维模型。Wherein, for the specific implementation of S314, reference may be made to the relevant expression of the aforementioned S193, which will not be repeated here. The three-dimensional model of the first person in this application is the first three-dimensional model mentioned in the foregoing embodiments.

S315、手机存储重新构建的第一人物的三维模型。S315. The mobile phone stores the reconstructed three-dimensional model of the first person.

示例性的,出于节省存储资源的目的,S315具体可以是用重新构建的第一人物的三维模型,替换之前存储的第一人物的三维模型。Exemplarily, for the purpose of saving storage resources, S315 may specifically replace the previously stored 3D model of the first character with the reconstructed 3D model of the first character.

需要说明的是,S312-S315在S304后的什么时刻进行,可以根据实际需求而定,本申请对此不做具体限制。It should be noted that when S312-S315 is performed after S304 may be determined according to actual needs, and this application does not specifically limit this.

当然,上述S312-S315中的任意步骤均可以由手机对应的服务器执行,以降低本申请提供的技术方案对手机的计算资源和/或存储资源的需求。具体由手机还是服务器执行,根据实际需求而定,本申请不做具体限制。Of course, any of the steps in S312-S315 above can be executed by the server corresponding to the mobile phone, so as to reduce the demand for computing resources and/or storage resources of the mobile phone in the technical solution provided by this application. Whether it is executed by the mobile phone or the server depends on actual needs, and this application does not make specific limitations.

基于S312-S315对应的技术方案,手机在对拍摄的照片中的某个人物图像(例如第一人物图像)进行优化后,可以将拍摄的照片作为历史照片添加进该人物关联的历史照片集合中。进而得到该人物图像所属人物的更新后的三维模型,使得后续再需要对该人物的图像进行优化时的优化效果更好。Based on the technical solution corresponding to S312-S315, after the mobile phone optimizes a person image (such as the first person image) in the captured photo, it can add the captured photo as a historical photo to the historical photo collection associated with the person . Furthermore, an updated three-dimensional model of the character to which the character image belongs is obtained, so that the optimization effect is better when the image of the character needs to be optimized later.

同理,在优化信息为三维模型的情况下,基于S1901-S1904对应的技术方案,结合图15,参照图24所示,该已存储照片的优化流程中,S1501步骤之后还可以包括S1509-S1512:Similarly, when the optimization information is a 3D model, based on the technical solution corresponding to S1901-S1904, referring to FIG. 15 and referring to FIG. 24, in the optimization process of the stored photos, S1509-S1512 may also be included after step S1501 :

S1509、手机将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合。S1509. The mobile phone adds the first photo to the first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection.

S1510、手机根据第二历史照片集合,重新确定第一人物的三维特征。S1510. The mobile phone re-determines the three-dimensional features of the first person according to the second historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。这里的第一人物的三维特征即为前述实施例提到的第一三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features. The three-dimensional features of the first person here are the first three-dimensional features mentioned in the foregoing embodiments.

其中,S1510的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S1510, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S1511、手机根据重新确定的第一人物的三维特征,重新构建第一人物的三维模型。S1511. The mobile phone reconstructs a three-dimensional model of the first person according to the re-determined three-dimensional features of the first person.

其中,S1511的具体实现可以参照前述S193的相关表述,此处不再赘述。这里的第一人物的三维模型即为前述实施例提到的第一三维模型。Wherein, for the specific implementation of S1511, reference may be made to the relevant expression of the aforementioned S193, which will not be repeated here. The three-dimensional model of the first person here is the first three-dimensional model mentioned in the foregoing embodiments.

S1512、手机存储重新构建的第一人物的三维模型。S1512. The mobile phone stores the reconstructed three-dimensional model of the first character.

示例性的,出于节省存储资源的目的,S1512具体可以是用重新构建的第一人物的三维模型,替换之前存储的第一人物的三维模型。Exemplarily, for the purpose of saving storage resources, S1512 may specifically replace the previously stored 3D model of the first character with the reconstructed 3D model of the first character.

需要说明的是,S1509-S1512在S1501后的什么时刻进行,可以根据实际需求而定,本申请对此不做具体限制。It should be noted that when S1509-S1512 is performed after S1501 may be determined according to actual needs, and this application does not specifically limit this.

当然,上述S1509-S1512中的任意步骤均可以由手机对应的服务器执行,以降低本申请提供的技术方案对手机的计算资源和/或存储资源的需求。具体由手机还是服务器执行,根据实际需求而定,本申请不做具体限制。Of course, any of the steps in S1509-S1512 above can be executed by the server corresponding to the mobile phone, so as to reduce the demand for computing resources and/or storage resources of the mobile phone in the technical solution provided by this application. Whether it is executed by the mobile phone or the server depends on actual needs, and this application does not make specific limitations.

基于S1509-S1512对应的技术方案,手机在对已存储的照片中的某个人物图像(例如第一人物图像)进行优化后,可以将该照片作为历史照片添加进该人物图像对应的历史照片集合中。进而得到该人物图像所属人物的更新后的三维模型,使得后续再需要对该人物的图像进行优化时的优化效果更好。Based on the technical solution corresponding to S1509-S1512, after the mobile phone optimizes a person image (such as the first person image) in the stored photos, it can add the photo as a historical photo to the historical photo collection corresponding to the person image middle. Furthermore, an updated three-dimensional model of the character to which the character image belongs is obtained, so that the optimization effect is better when the image of the character needs to be optimized later.

同理,在优化信息为三维特征的情况下,基于S1901、S1902和S1905对应的技术方案,结合图9,参照图25所示,S304之后,拍摄照片的优化方法还可以包括S316-S318:Similarly, in the case where the optimization information is a three-dimensional feature, based on the technical solutions corresponding to S1901, S1902 and S1905, combined with FIG. 9, referring to FIG. 25, after S304, the optimization method for taking photos may also include S316-S318:

S316、手机将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合。S316. The mobile phone adds the first photo to the first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection.

S317、手机根据第二历史照片集合,重新确定第一人物的三维特征。S317. The mobile phone re-determines the three-dimensional features of the first person according to the second historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S317的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S317, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S318、手机存储重新确定的第一人物的三维特征。S318. The mobile phone stores the re-determined three-dimensional features of the first person.

示例性的,出于节省存储资源的目的,S318具体可以是用重新构建的第一人物的三维特征,替换之前存储的第一人物的三维特征。Exemplarily, for the purpose of saving storage resources, S318 may specifically replace the previously stored three-dimensional features of the first character with the reconstructed three-dimensional features of the first character.

需要说明的是,S316-S318在S304后的什么时刻进行,可以根据实际需求而定,本申请对此不做具体限制。It should be noted that when S316-S318 is performed after S304 may be determined according to actual needs, and this application does not specifically limit this.

当然,上述S316-S318中的任意步骤均可以由手机对应的服务器执行,以降低本申请提供的技术方案对手机的计算资源和/或存储资源的需求。具体由手机还是服务器执行,根据实际需求而定,本申请不做具体限制。Of course, any of the steps in S316-S318 above can be executed by the server corresponding to the mobile phone, so as to reduce the demand for computing resources and/or storage resources of the mobile phone in the technical solution provided by this application. Whether it is executed by the mobile phone or the server depends on actual needs, and this application does not make specific limitations.

基于S316-S318对应的技术方案,手机在对拍摄的照片中的某个人物图像(例如第一人物图像)进行优化后,可以将拍摄的照片作为历史照片添加进该人物图像对应的历史照片集合中。进而得到该人物图像所属人物的更新后的三维特征,使得后续再需要对该人物的图像进行优化时的优化效果更好。Based on the technical solution corresponding to S316-S318, after the mobile phone optimizes a certain person image (such as the first person image) in the captured photo, it can add the captured photo as a historical photo to the historical photo collection corresponding to the person image middle. Further, the updated three-dimensional features of the character to which the character image belongs are obtained, so that the subsequent optimization of the image of the character will have a better optimization effect.

同理,在优化信息为三维特征的情况下,基于S1901、S1902和S1905对应的技术方案,结合图15,若S1506具体是先获取与第一特征信息匹配的第一三维特征,进而构建第一历史三维模型,则参照图26所示,S1501之后,已存储照片的优化方法还可以包括S1513-S1515:Similarly, when the optimization information is a three-dimensional feature, based on the technical solutions corresponding to S1901, S1902, and S1905, combined with Figure 15, if S1506 specifically obtains the first three-dimensional feature that matches the first feature information, and then constructs the first For the historical 3D model, refer to Figure 26. After S1501, the optimization method for stored photos may also include S1513-S1515:

S1513、手机将第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合。S1513. The mobile phone adds the first photo to the first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection.

S1514、手机根据第二历史照片集合,重新确定第一人物的三维特征。S1514. The mobile phone re-determines the three-dimensional features of the first person according to the second historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S1514的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S1514, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S1515、手机存储重新确定的第一人物的三维特征。S1515. The mobile phone stores the re-determined three-dimensional features of the first person.

示例性的,出于节省存储资源的目的,S1515具体可以是用重新构建的第一人物的三维特征,替换之前存储的第一人物的三维特征。Exemplarily, for the purpose of saving storage resources, S1515 may specifically replace the previously stored three-dimensional features of the first character with the reconstructed three-dimensional features of the first character.

需要说明的是,S1513-S1515在S1501后的什么时刻进行,可以根据实际需求而定,本申请对此不做具体限制。It should be noted that when S1513-S1515 is performed after S1501 may be determined according to actual needs, and this application does not specifically limit this.

当然,上述S1513-S1515中的任意步骤均可以由手机对应的服务器执行,以降低本申请提供的技术方案对手机的计算资源和/或存储资源的需求。具体由手机还是服务器执行,根据实际需求而定,本申请不做具体限制。Of course, any of the above steps in S1513-S1515 can be executed by the server corresponding to the mobile phone, so as to reduce the requirement of the technical solution provided by this application on the computing resources and/or storage resources of the mobile phone. Whether it is executed by the mobile phone or the server depends on actual needs, and this application does not make specific limitations.

基于S1513-S1515对应的技术方案,手机在对已存储照片中的某个人物图像(例如第一人物图像)进行优化后,可以将已存储的照片作为历史照片添加进该人物图像对应的历史照片集合中。进而得到该人物图像所属人物的更新后的三维特征,使得后续再需要对该人物的图像进行优化时的优化效果更好。Based on the technical solution corresponding to S1513-S1515, after the mobile phone optimizes a person image (such as the first person image) in the stored photo, it can add the stored photo as a historical photo to the historical photo corresponding to the person image set. Further, the updated three-dimensional features of the character to which the character image belongs are obtained, so that the subsequent optimization of the image of the character will have a better optimization effect.

在一些实施例中,对于第一人物而言,手机可能之前并未对其进行拍摄过,所以手机中可能并为存储有对应该第一人物的优化信息(第一三维模型或者第一三维特征);或者,手机虽然之前对第一人物拍摄过,但是由于其他可能的原因,并未在存储有对应该第一人物的优化信息。这种情况下,当前则无法对拍摄的照片中的第一人物的图像进行优化。但是,为了下一次可以对拍摄的照片中的第一人物的图像进行优化,可以提取当前第一照片中的第一人物的三维特征作为后续使用的第一人物的第一三维特征,乃至利用该三维特征构建三维模型作为后续使用的第一人物的第一三维模型。In some embodiments, for the first person, the mobile phone may not have photographed it before, so the optimization information (first 3D model or first 3D feature) corresponding to the first person may not be stored in the mobile phone. ); or, although the mobile phone has photographed the first person before, due to other possible reasons, the optimization information corresponding to the first person is not stored. In this case, currently, the image of the first person in the captured photo cannot be optimized. However, in order to optimize the image of the first person in the photo taken next time, the three-dimensional feature of the first person in the current first photo can be extracted as the first three-dimensional feature of the first person used subsequently, and even use the The three-dimensional feature constructs the three-dimensional model as the first three-dimensional model of the first person for subsequent use.

基于此,在优化信息为第一三维模型的情况下,基于S1901-S1904对应的技术方案,结合图3,参照图27所示,该拍摄照片的优化流程中,S305步骤之后还可以包括S319-S322:Based on this, in the case where the optimization information is the first three-dimensional model, based on the technical solution corresponding to S1901-S1904, in combination with FIG. 3, referring to FIG. S322:

S319、手机在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合。S319. When the mobile phone has not acquired the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person.

当然,结合前述实施例中S1921和S1922对应的技术方案,如果手机在确定三维特征时,仅为提取历史照片集合中的第二目标照片的三维特征。那么本申请中,S319执行前,手机可以先确定第一照片是否是第二目标照片,若不是,则不再执行S319-S322;若是,则执行S319-S322。这样一来,因为对于不是第二目标照片的第一照片,不需要额外执行S319-S322步骤,也就节省了这部分流程造成的手机计算和存储资源的消耗。后续类似步骤同理,后续不再赘述。Of course, in combination with the technical solutions corresponding to S1921 and S1922 in the foregoing embodiments, if the mobile phone determines the 3D features, it only extracts the 3D features of the second target photo in the historical photo collection. Then in this application, before executing S319, the mobile phone can first determine whether the first photo is the second target photo, if not, then do not execute S319-S322; if yes, execute S319-S322. In this way, because for the first photo that is not the second target photo, there is no need to perform steps S319-S322 additionally, which saves the consumption of computing and storage resources of the mobile phone caused by this part of the process. Subsequent similar steps are the same, and will not be repeated in the future.

S320、手机根据第一历史照片集合,确定第一人物的三维特征。S320. The mobile phone determines the three-dimensional features of the first person according to the first historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S320的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S320, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S321、手机根据第一人物的三维特征,构建第一人物的三维模型。S321. The mobile phone constructs a three-dimensional model of the first person according to the three-dimensional features of the first person.

当然,实际中若第一历史照片集合仅第一照片一张照片,则可能会因为手机本身的限制(例如无深度摄像头)和第一照片的限制(例如角度唯一),导致无法得到合适的第一人物的三维模型。此时,则可以不执行S321和S322,在S320后仅存储第一人物的三维特征。在之后获取到多个存在第一人物的图像的照片,并获取到第一人物更多的三维特征的情况下,再执行S321和S322。这种情况下,在收集未获取到足够构建第一人物的历史三维模型的三维特征前,S319步骤则具体可以是手机先将拍摄的照片作为历史照片添加进第一人物关联的第一历史照片集合中。Of course, in practice, if the first historical photo collection only has one photo, it may not be possible to obtain a suitable first photo due to limitations of the phone itself (such as no depth camera) and limitations of the first photo (such as a unique angle). A three-dimensional model of a character. In this case, S321 and S322 may not be executed, and only the three-dimensional features of the first person are stored after S320. In the case that multiple pictures of the first person are obtained later, and more three-dimensional features of the first person are obtained, S321 and S322 are executed again. In this case, before collecting enough 3D features to construct the historical 3D model of the first person, step S319 may specifically be that the mobile phone first adds the photograph taken as a historical photo to the first historical photo associated with the first person set.

其中,S321的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S321, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S322、手机存储第一人物的三维模型。S322. The mobile phone stores the three-dimensional model of the first person.

基于S319-S322对应的技术方案,手机在无法获取到拍摄的照片中的某个人物的三维模型的情况下,可以利用该照片建立相应的历史照片集合,进而得到该人物的三维模型。从而使得手机后续在需要对该人物的图像进行优化时,可以顺利得到相应的三维模型,完成相应的优化流程,提高用户使用体验。Based on the technical solution corresponding to S319-S322, if the mobile phone cannot obtain the 3D model of a certain person in the photographed photo, it can use the photo to create a corresponding historical photo collection, and then obtain the 3D model of the person. In this way, when the mobile phone needs to optimize the image of the character in the future, the corresponding three-dimensional model can be obtained smoothly, and the corresponding optimization process can be completed to improve the user experience.

同理,在优化信息为第一三维特征的情况下,基于S1901、S1902和S1905对应的技术方案,结合图9,参照图28所示,该拍摄照片的优化流程中,S305步骤之后还可以包括S323-S325:Similarly, in the case where the optimization information is the first three-dimensional feature, based on the technical solutions corresponding to S1901, S1902 and S1905, in combination with FIG. 9, referring to FIG. 28, in the photo optimization process, after step S305, it may also include S323-S325:

S323、手机在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合。S323. When the mobile phone has not acquired the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person.

S324、手机根据第一历史照片集合,确定第一人物的三维特征。S324. The mobile phone determines the three-dimensional features of the first person according to the first historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S324的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S324, reference may be made to the above-mentioned related expression of S192, which will not be repeated here.

S325、手机存储第一人物的三维特征。S325. The mobile phone stores the three-dimensional features of the first person.

基于S323-S325对应的技术方案,手机在因为无法获取到拍摄的照片中的某个人物的三维特征,而无法构建相应的三维模型的情况下,可以利用该照片建立相应的历史照片集合,进而得到相应的三维特征。从而使得手机后续在需要对该人物的图像进行优化时,可以顺利得到该人物的三维特征,进而构建相应的三维模型,从而完成相应的优化流程,提高用户使用体验。Based on the technical solution corresponding to S323-S325, when the mobile phone cannot obtain the 3D features of a person in the photographed photo and cannot build the corresponding 3D model, it can use the photo to create a corresponding historical photo collection, and then Get the corresponding three-dimensional features. Therefore, when the mobile phone needs to optimize the image of the character in the future, the three-dimensional features of the character can be obtained smoothly, and then the corresponding three-dimensional model can be constructed, so as to complete the corresponding optimization process and improve the user experience.

在一些实施例中,对于第一人物而言,手机可能是第一次存储了包含第一人物图像的照片,所以可能未存储有该第一人物的优化信息(第一三维模型或者第一三维特征)。这种情况下,当前则无法对该已存储的照片中的第一人物的图像进行优化。但是,为了之后可以对拍摄的照片或者后续存储的未优化的照片中的第一人物的图像进行优化,可以提取当前第一照片中的第一人物的三维特征作为后续使用的第一人物的第一三维特征,乃至利用该三维特征构建三维模型作为后续使用的第一人物的第一三维模型。In some embodiments, for the first person, the mobile phone may store a photo containing the image of the first person for the first time, so the optimization information (the first 3D model or the first 3D model) of the first person may not be stored. feature). In this case, currently, the image of the first person in the stored photo cannot be optimized. However, in order to optimize the image of the first person in the captured photo or the subsequently stored unoptimized photo, the three-dimensional features of the first person in the current first photo can be extracted as the first person's image for subsequent use. A 3D feature, and even use the 3D feature to construct a 3D model as the first 3D model of the first character for subsequent use.

基于此,在优化信息为第一三维模型的情况下,基于S1901-S1904对应的技术方案,结合图15,参照图29所示,该已存储照片的优化流程中,S1502步骤之后还可以包括S1516-S1519:Based on this, in the case where the optimization information is the first 3D model, based on the technical solution corresponding to S1901-S1904, referring to FIG. 15, referring to FIG. 29, in the optimization process of the stored photos, S1516 may be included after step S1502 -S1519:

S1516、手机在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合。S1516. When the mobile phone has not acquired the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person.

S1517、手机根据第一历史照片集合,确定第一人物的三维特征。S1517. The mobile phone determines the three-dimensional features of the first person according to the first historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S1517的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S1517, reference may be made to the above-mentioned related expression of S192, which will not be repeated here.

S1518、手机根据第一人物的三维特征,构建第一人物的三维模型。S1518. The mobile phone constructs a three-dimensional model of the first person according to the three-dimensional features of the first person.

当然,实际中若第一历史照片集合仅第一照片一张照片,则可能会因为手机本身的限制(例如无深度摄像头)和第一照片的限制(例如角度唯一),导致无法得到合适的第一人物的三维模型。此时,则可以不执行S1518和S1519,在S1517后仅存储第一人物的三维特征。在之后获取到多个存在第一人物的图像的照片,并获取到第一人物更多的三维特征的情况下,再执行S1518和S1519。这种情况下,在收集未获取到足够构建第一人物的历史三维模型的三维特征前,S1516步骤则具体可以是手机先该已存储的照片作为历史照片添加进第一人物关联的第一历史照片集合中。Of course, in practice, if the first historical photo collection only has one photo, it may not be possible to obtain a suitable first photo due to limitations of the phone itself (such as no depth camera) and limitations of the first photo (such as a unique angle). A three-dimensional model of a character. In this case, S1518 and S1519 may not be executed, and only the three-dimensional features of the first person are stored after S1517. In the case that multiple pictures of the first person are obtained later, and more three-dimensional features of the first person are obtained, S1518 and S1519 are executed again. In this case, before collecting enough 3D features to construct the historical 3D model of the first person, step S1516 may be specifically to add the stored photos as historical photos to the first history associated with the first person. in the photo collection.

其中,S1518的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S1518, reference may be made to the above-mentioned related expression of S192, which will not be repeated here.

S1519、手机存储第一人物的三维模型。S1519. The mobile phone stores the three-dimensional model of the first person.

基于S1516-S1519对应的技术方案,手机在无法获取到已存储的照片中的某个人物的三维模型的情况下,可以利用该照片建立相应的历史照片集合,进而得到三维模型。从而使得手机后续在需要对该人物的图像进行优化时,可以顺利得到三维模型,完成相应的优化流程,提高用户使用体验。Based on the technical solution corresponding to S1516-S1519, when the mobile phone cannot obtain the 3D model of a person in the stored photos, it can use the photos to create a corresponding historical photo collection, and then obtain the 3D model. Therefore, when the mobile phone needs to optimize the image of the character in the future, the three-dimensional model can be obtained smoothly, and the corresponding optimization process can be completed to improve the user experience.

同理,在优化信息为第一三维特征的情况下,基于S1901、S1902和S1905对应的技术方案,结合图15,若S1506具体是先获取与第一特征信息匹配的第一三维特征,进而构建第一历史三维模型,参照图30所示,该已存储照片的优化流程中,S1502步骤之后还可以包括S1520-S1522:Similarly, when the optimization information is the first three-dimensional feature, based on the technical solutions corresponding to S1901, S1902 and S1905, combined with Figure 15, if S1506 is to first obtain the first three-dimensional feature that matches the first feature information, and then construct The first historical 3D model, as shown in FIG. 30 , in the optimization process of the stored photos, S1520-S1522 may also be included after step S1502:

S1520、手机在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合。S1520. When the mobile phone has not acquired the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person.

S1521、手机根据第一历史照片集合,确定第一人物的三维特征。S1521. The mobile phone determines the three-dimensional features of the first person according to the first historical photo collection.

其中,三维特征至少包括人脸三维特征。进一步的,为了使得手机可以利用三维特征得到更完整的三维模型,三维特征还可以包括体态三维特征。Wherein, the three-dimensional features include at least three-dimensional features of human face. Further, in order to enable the mobile phone to obtain a more complete 3D model by using the 3D features, the 3D features may also include body 3D features.

其中,S1521的具体实现可以参照前述S192的相关表述,此处不再赘述。Wherein, for the specific implementation of S1521, reference may be made to the relevant expression of the aforementioned S192, which will not be repeated here.

S1522、手机存储第一人物的三维特征。S1522. The mobile phone stores the three-dimensional features of the first person.

基于S1520-S1522对应的技术方案,手机在因为无法获取到已存储的照片中的某个人物的三维特征,而无法构建相应的三维模型的情况下,可以利用该照片建立相应的历史照片集合,进而得到三维特征。从而使得手机后续在需要对该人物的图像进行优化时,可以顺利得到三维特征,进而构建相应的三维模型,从而完成相应的优化流程,提高用户使用体验。Based on the technical solution corresponding to S1520-S1522, when the mobile phone cannot build a corresponding 3D model because it cannot obtain the 3D features of a person in the stored photo, it can use the photo to create a corresponding historical photo collection. Then three-dimensional features are obtained. In this way, when the mobile phone needs to optimize the image of the person in the future, the three-dimensional features can be obtained smoothly, and then the corresponding three-dimensional model can be constructed, so as to complete the corresponding optimization process and improve the user experience.

可以理解的是,上述设备等为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本发明实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。It can be understood that, in order to realize the above-mentioned functions, the above-mentioned devices and the like include corresponding hardware structures and/or software modules for performing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the embodiments of the present application.

本申请实施例可以根据上述方法示例对上述电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本发明实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiments of the present application may divide the above-mentioned electronic device into functional modules according to the above-mentioned method examples. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. It should be noted that the division of modules in the embodiment of the present invention is schematic, and is only a logical function division, and there may be another division manner in actual implementation.

在采用对应各个功能划分各个功能模块的情况下,参照图31所示,本申请实施例提供一种电子设备,包括:获取模块3101、特征提取模块3102、模型匹配模块3103和优化模块3104。In the case of dividing each functional module corresponding to each function, as shown in FIG. 31 , the embodiment of the present application provides an electronic device, including: an acquisition module 3101 , a feature extraction module 3102 , a model matching module 3103 and an optimization module 3104 .

其中,获取模块3101被配置为获取第一照片。特征提取模块3102被配置为在获取模块3101获取的第一照片中包括人脸图像的情况下,获取第一照片中第一人脸图像所属的第一人物的第一特征信息;其中,第一特征信息至少包括第一人物的人脸特征信息。模型匹配模块3103被配置为获取与特征提取模块3102获取的第一特征信息匹配的第一三维模型;其中,第一三维模型用于表征第一人物对应的历史照片中,第一人物的三维特征;三维特征至少包括人脸三维特征。优化模块3104被配置为将模型匹配模块3103获取的第一三维模型与获取模块3101获取的第一照片中第一人物的图像进行融合,以对第一照片中第一人物的图像进行优化,得到第二照片。Wherein, the acquiring module 3101 is configured to acquire the first photo. The feature extraction module 3102 is configured to acquire the first feature information of the first person to whom the first face image in the first photo belongs when the first photo acquired by the acquisition module 3101 includes a face image; wherein, the first The feature information includes at least face feature information of the first person. The model matching module 3103 is configured to obtain a first 3D model that matches the first feature information obtained by the feature extraction module 3102; wherein, the first 3D model is used to characterize the 3D features of the first person in the historical photos corresponding to the first person ; The three-dimensional features include at least three-dimensional features of human face. The optimization module 3104 is configured to fuse the first three-dimensional model acquired by the model matching module 3103 with the image of the first person in the first photo acquired by the acquisition module 3101, so as to optimize the image of the first person in the first photo, and obtain Second photo.

可选的,获取模块3101具体被配置为:接收拍照操作;响应于拍照操作,获取第一照片。Optionally, the acquiring module 3101 is specifically configured to: receive a photographing operation; and acquire a first photograph in response to the photographing operation.

进一步可选的,该电子设备还包括显示模块3105;获取模块3101响应于拍照操作,获取第一照片之前,显示模块3105被配置为:响应于用户对相机应用图标的触发操作,显示相机预览界面,并实时确定相机预览界面中是否包括人脸图像;其中,相机预览界面用于预览电子设备的摄像头的拍摄画面;其中,第一照片中是否包括人脸图像,是获取模块3101接收拍照操作前显示模块3105最新一次对相机预览界面中是否包括人脸图像的确定结果。Further optionally, the electronic device further includes a display module 3105; the obtaining module 3101 responds to the photographing operation, and before obtaining the first photo, the display module 3105 is configured to: display a camera preview interface in response to a user's trigger operation on the camera application icon , and determine in real time whether a face image is included in the camera preview interface; wherein, the camera preview interface is used to preview the shooting picture of the camera of the electronic device; wherein, whether the first photo includes a face image is determined before the acquisition module 3101 receives the photographing operation The display module 3105 determines the latest result of whether the face image is included in the camera preview interface.

可选的,获取模块3101还具体被配置为:响应于用户对图库展示界面中第一目标照片的优化操作,将第一目标照片确定为第一照片。Optionally, the obtaining module 3101 is also specifically configured to: determine the first target photo as the first photo in response to the user's optimization operation on the first target photo in the gallery display interface.

可选的,模型匹配模块3103获取第一三维模型之前,模型匹配模块3103还被配置为:获取当前时刻之前至少一个历史照片集合;其中,每个历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;历史照片集合中的每张历史照片中均包括历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联第一人物的第一历史照片集合。根据历史照片集合,确定历史照片集合关联的人物的三维特征;其中,三维特征至少包括人脸三维特征。根据历史照片集合关联的人物的三维特征,构建历史照片集合关联的人物的三维模型。Optionally, before the model matching module 3103 acquires the first 3D model, the model matching module 3103 is further configured to: acquire at least one historical photo collection before the current moment; wherein, each historical photo collection is associated with a person, and different historical The people associated with the photo collections are different; each historical photo in the historical photo collection includes an image of the person associated with the historical photo collection; at least one historical photo collection includes a first historical photo collection associated with the first person. According to the historical photo collection, determine the three-dimensional features of the people associated with the historical photo collection; wherein, the three-dimensional features include at least three-dimensional features of human faces. A three-dimensional model of the person associated with the historical photo collection is constructed according to the three-dimensional features of the person associated with the historical photo collection.

进一步可选的,模型匹配模块3103具体被配置为:根据历史照片集合中每个历史照片的成像质量参数,从历史照片集合中选择出至少一个第二目标照片;成像质量参数包括:分辨率、历史照片集合关联的人物的图像的完整程度;至少一个第二第一目标照片的成像质量参数高于历史照片集合中其他照片的成像质量参数。从第二目标照片,提取历史照片集合关联的人物的三维特征。Further optionally, the model matching module 3103 is specifically configured to: select at least one second target photo from the historical photo collection according to the imaging quality parameters of each historical photo in the historical photo collection; the imaging quality parameters include: resolution, Completeness of images of people associated with the historical photo collection; imaging quality parameters of at least one second first target photo are higher than imaging quality parameters of other photos in the historical photo collection. From the second target photo, the three-dimensional features of the person associated with the historical photo collection are extracted.

进一步可选的,获取模块3101获取第一照片之后,模型匹配模块3103还被配置为:将获取模块3101获取的第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合;根据第二历史照片集合,重新确定第一人物的三维特征。根据重新确定的第一人物的三维特征,重新构建第一人物的三维模型。Further optionally, after the obtaining module 3101 obtains the first photo, the model matching module 3103 is further configured to: add the first photo obtained by the obtaining module 3101 to the first historical photo collection associated with the first person, so as to update the first A set of historical photos is used to obtain a second set of historical photos; according to the second set of historical photos, the three-dimensional features of the first person are re-determined. A three-dimensional model of the first person is reconstructed according to the re-determined three-dimensional features of the first person.

进一步可选的,在特征提取模块3102获取第一特征信息之后,模型匹配模块3103还被配置为:在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合;根据第一历史照片集合,确定第一人物的三维特征;根据第一人物的三维特征,构建第一人物的三维模型。Further optionally, after the feature extraction module 3102 acquires the first feature information, the model matching module 3103 is further configured to: use the first photo to construct the first person-associated first 3D model when the first 3D model is not acquired. A collection of historical photos; according to the first collection of historical photos, determine the 3D features of the first person; and build a 3D model of the first person according to the 3D features of the first person.

可选的,模型匹配模块3103具体被配置为:获取与特征提取模块3102获取的第一特征信息匹配的第一三维特征;第一三维特征为第一人物对应的历史照片中,第一人物的三维特征。利用第一三维特征,构建第一三维模型。Optionally, the model matching module 3103 is specifically configured to: acquire a first three-dimensional feature that matches the first feature information acquired by the feature extraction module 3102; 3D features. Using the first three-dimensional features, a first three-dimensional model is constructed.

进一步可选的,在模型匹配模块3103获取第一三维模型之前,模型匹配模块3103还被配置为:获取当前时刻之前至少一个历史照片集合;其中,每个历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;历史照片集合中的每张历史照片中均存在历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联第一人物的第一历史照片集合。根据历史照片集合,确定历史照片集合关联的人物的三维特征;其中,三维特征至少包括人脸三维特征。Further optionally, before the model matching module 3103 acquires the first 3D model, the model matching module 3103 is also configured to: acquire at least one historical photo collection before the current moment; wherein, each historical photo collection is associated with a person, different The people associated with the historical photo collections are different; each historical photo in the historical photo collection has an image of the person associated with the historical photo collection; at least one historical photo collection includes the first historical photo collection associated with the first person. According to the historical photo collection, determine the three-dimensional features of the people associated with the historical photo collection; wherein, the three-dimensional features include at least three-dimensional features of human faces.

进一步可选的,获取模块3101获取第一照片之后,模型匹配模块3103还被配置为:将获取模块3101获取的第一照片添加进与第一人物关联的第一历史照片集合中,以更新第一历史照片集合,得到第二历史照片集合;根据第二历史照片集合,重新确定第一人物的三维特征。Further optionally, after the obtaining module 3101 obtains the first photo, the model matching module 3103 is further configured to: add the first photo obtained by the obtaining module 3101 to the first historical photo collection associated with the first person, so as to update the first A set of historical photos is used to obtain a second set of historical photos; according to the second set of historical photos, the three-dimensional features of the first person are re-determined.

进一步可选的,在特征提取模块3102获取第一特征信息之后,模型匹配模块3103还被配置为:在未获取到第一三维模型的情况下,利用第一照片构建第一人物关联的第一历史照片集合。根据第一历史照片集合,确定第一人物的三维特征。Further optionally, after the feature extraction module 3102 acquires the first feature information, the model matching module 3103 is further configured to: use the first photo to construct the first person-associated first 3D model when the first 3D model is not acquired. Collection of historical photos. Based on the first set of historical photos, three-dimensional features of the first person are determined.

可选的,获取模块3101获取第一照片之后,特征提取模块3102还被配置为在获取模块3101获取的第一照片中包括人脸图像的情况下,获取第二人脸图像所属的第二人物的第二特征信息;其中,第二人物和第一人物不同,第二特征信息至少包括第二人物的人脸特征信息。模型匹配模块3103还被配置为获取与特征提取模块3102获取的第二特征信息匹配的第二三维模型;其中,第二三维模型用于表征第二人物对应的历史照片中,第二人物的三维特征。优化模块3104还被配置为将模型匹配模块3103获取的第二三维模型与获取模块3101获取的第一照片中第二人物的图像进行融合,以对第一照片中第二人物的图像进行优化,得到第三照片。Optionally, after the acquisition module 3101 acquires the first photo, the feature extraction module 3102 is further configured to acquire the second person to which the second facial image belongs when the first photo acquired by the acquisition module 3101 includes a face image The second feature information; wherein, the second character is different from the first character, and the second feature information includes at least facial feature information of the second character. The model matching module 3103 is also configured to obtain a second 3D model that matches the second feature information obtained by the feature extraction module 3102; wherein, the second 3D model is used to represent the 3D model of the second person in the historical photos corresponding to the second person feature. The optimization module 3104 is further configured to fuse the second three-dimensional model obtained by the model matching module 3103 with the image of the second person in the first photo obtained by the obtaining module 3101, so as to optimize the image of the second person in the first photo, Get the third photo.

进一步可选的,优化模块3104还被配置为:将第一照片和第四照片进行融合,以得到第五照片。其中,第四照片为对第一照片中的目标人物的图像进行优化后得到的;其中,目标人物包括第一人物和/或第二人物。Further optionally, the optimization module 3104 is further configured to: fuse the first photo and the fourth photo to obtain a fifth photo. Wherein, the fourth photo is obtained after optimizing the image of the target person in the first photo; wherein, the target person includes the first person and/or the second person.

关于上述实施例中的电子设备,其中各个模块执行操作的具体方式已经在前述实施例中的照片优化方法的实施例中进行了详细描述,此处不再具体阐述。其相关的有益效果也可参照前述照片优化方法的相关有益效果,此处不再赘述。With regard to the electronic device in the above embodiment, the specific manner of performing operations by each module has been described in detail in the embodiment of the photo optimization method in the foregoing embodiment, and will not be elaborated here again. For its related beneficial effects, reference may also be made to the related beneficial effects of the aforementioned photo optimization method, which will not be repeated here.

本申请实施例还提供一种电子设备,该电子设备包括:摄像头、显示屏、存储器和一个或多个处理器;摄像头、显示屏、存储器与处理器耦合;其中,存储器中存储有计算机程序代码,计算机程序代码包括计算机指令,当计算机指令被处理器执行时,使得电子设备执行如前述实施例提供的照片优化方法。该电子设备的具体结构可参照图2中所示的电子设备的结构。The embodiment of the present application also provides an electronic device, which includes: a camera, a display screen, a memory, and one or more processors; the camera, a display screen, and a memory are coupled to the processor; wherein, computer program codes are stored in the memory The computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the photo optimization method provided in the foregoing embodiments. For a specific structure of the electronic device, reference may be made to the structure of the electronic device shown in FIG. 2 .

本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行如前述实施例提供的照片优化方法。The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes computer instructions, and when the computer instructions are run on the electronic device, the electronic device executes the photo optimization method provided in the foregoing embodiments.

本申请实施例还提供一种计算机程序产品,该计算机程序产品包含可执行指令,当该计算机程序产品在电子设备上运行时,使得电子设备执行如前述实施例提供的照片优化方法。The embodiment of the present application also provides a computer program product, the computer program product includes executable instructions, and when the computer program product is run on the electronic device, the electronic device is made to execute the photo optimization method provided in the foregoing embodiments.

通过以上实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned by Completion of different functional modules means that the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置/设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device/device and method can be implemented in other ways. For example, the device/device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or Components may be combined or integrated into another device, or some features may be omitted, 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, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or may be distributed to multiple different places . 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 application 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.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially 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 software product is stored in a storage medium Among them, several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk, and other media capable of storing program codes.

以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above content is only the specific implementation of the application, but the protection scope of the application is not limited thereto, and any changes or replacements within the technical scope disclosed in the application shall be covered within the protection scope of the application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (15)

Translated fromChinese
1.一种照片优化方法,应用于电子设备,其特征在于,包括:1. A photo optimization method applied to electronic equipment, characterized in that, comprising:所述电子设备获取第一照片;The electronic device acquires a first photo;所述电子设备在所述第一照片中包括人脸图像的情况下,获取所述第一照片中第一人脸图像所属的第一人物的第一特征信息;其中,所述第一特征信息至少包括所述第一人物的人脸特征信息;In the case that the first photo includes a face image, the electronic device acquires first feature information of a first person to whom the first face image in the first photo belongs; wherein, the first feature information including at least facial feature information of the first person;所述电子设备获取与所述第一特征信息匹配的第一三维模型;其中,所述第一三维模型用于表征所述第一人物对应的历史照片中,所述第一人物的三维特征;所述三维特征至少包括人脸三维特征;The electronic device acquires a first three-dimensional model that matches the first feature information; wherein the first three-dimensional model is used to characterize the three-dimensional features of the first person in the historical photos corresponding to the first person; The three-dimensional features include at least three-dimensional features of human face;所述电子设备将所述第一三维模型与所述第一照片中所述第一人物的图像进行融合,以对所述第一照片中所述第一人物的图像进行优化,得到第二照片,其中,所述第一三维模型包括人脸三维特征,所述人脸三维特征用于优化所述第一照片中所述第一人物的人脸细节;The electronic device fuses the first three-dimensional model with the image of the first person in the first photo to optimize the image of the first person in the first photo to obtain a second photo , wherein the first three-dimensional model includes three-dimensional features of the face, and the three-dimensional features of the face are used to optimize the details of the face of the first person in the first photo;所述方法还包括:所述电子设备将所述第一照片和第四照片进行融合,以得到第五照片;The method further includes: the electronic device fuses the first photo and the fourth photo to obtain a fifth photo;其中,所述第四照片为所述电子设备对所述第一照片中的目标人物的图像进行优化后得到的;其中,所述目标人物包括所述第一人物和/或所述第一照片中的第二人物。Wherein, the fourth photo is obtained after the electronic device optimizes the image of the target person in the first photo; wherein, the target person includes the first person and/or the first photo The second character in .2.根据权利要求1所述的方法,其特征在于,所述电子设备获取第一照片,包括:2. The method according to claim 1, wherein the acquiring the first photo by the electronic device comprises:所述电子设备接收拍照操作;The electronic device receives a camera operation;所述电子设备响应于所述拍照操作,获取所述第一照片。The electronic device acquires the first photo in response to the photographing operation.3.根据权利要求2所述的方法,其特征在于,所述电子设备响应于拍照操作,获取所述第一照片之前,所述方法还包括:3. The method according to claim 2, wherein the electronic device responds to a photographing operation, and before acquiring the first photo, the method further comprises:所述电子设备响应于用户对相机应用图标的触发操作,显示相机预览界面,并实时确定所述相机预览界面中是否包括人脸图像;其中,所述相机预览界面用于预览所述电子设备的摄像头的拍摄画面;The electronic device displays a camera preview interface in response to a user's trigger operation on the camera application icon, and determines in real time whether the camera preview interface includes a face image; wherein the camera preview interface is used to preview the image of the electronic device The image captured by the camera;其中,所述第一照片中是否包括人脸图像,是所述电子设备接收所述拍照操作前最新一次对所述相机预览界面中是否包括所述人脸图像的确定结果。Wherein, whether the first photo includes a human face image is the latest determination result of whether the camera preview interface includes the human face image before the electronic device receives the photographing operation.4.根据权利要求1所述的方法,其特征在于,所述电子设备获取第一照片,包括:4. The method according to claim 1, wherein said electronic device acquiring the first photo comprises:所述电子设备响应于用户对图库展示界面中第一目标照片的优化操作,将所述第一目标照片确定为所述第一照片。The electronic device determines the first target photo as the first photo in response to the user's optimization operation on the first target photo in the gallery display interface.5.根据权利要求1-4任一项所述的方法,其特征在于,所述电子设备获取与所述第一特征信息匹配的第一三维模型之前,所述方法还包括:5. The method according to any one of claims 1-4, wherein before the electronic device acquires the first three-dimensional model matching the first feature information, the method further comprises:所述电子设备获取当前时刻之前至少一个历史照片集合;其中,每个所述历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;所述历史照片集合中的每张历史照片中均包括所述历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联所述第一人物的第一历史照片集合;The electronic device acquires at least one historical photo collection before the current moment; wherein, each of the historical photo collections is associated with a character, and different historical photo collections have different associated characters; each historical photo in the historical photo collection Each of the historical photo collections includes an image of a person associated with the historical photo collection; at least one historical photo collection includes a first historical photo collection associated with the first person;所述电子设备根据所述历史照片集合,确定所述历史照片集合关联的人物的三维特征;其中,所述三维特征至少包括人脸三维特征;The electronic device determines the three-dimensional features of the people associated with the historical photo collection according to the historical photo collection; wherein, the three-dimensional features include at least the three-dimensional features of human faces;所述电子设备根据所述历史照片集合关联的人物的三维特征,构建所述历史照片集合关联的人物的三维模型。The electronic device constructs a three-dimensional model of the person associated with the historical photo collection according to the three-dimensional features of the person associated with the historical photo collection.6.根据权利要求5所述的方法,其特征在于,所述电子设备根据所述历史照片集合,确定所述历史照片集合对应的人物的三维特征,包括:6. The method according to claim 5, wherein the electronic device determines the three-dimensional features of the person corresponding to the historical photo collection according to the historical photo collection, including:所述电子设备根据所述历史照片集合中每个历史照片的成像质量参数,从所述历史照片集合中选择出至少一个第二目标照片;所述成像质量参数包括:分辨率、所述历史照片集合关联的人物的图像的完整程度;所述至少一个第二第一目标照片的成像质量参数高于所述历史照片集合中其他照片的成像质量参数;The electronic device selects at least one second target photo from the historical photo collection according to the imaging quality parameters of each historical photo in the historical photo collection; the imaging quality parameters include: resolution, the historical photo The degree of completeness of the image of the person associated with the collection; the imaging quality parameter of the at least one second first target photo is higher than the imaging quality parameters of other photos in the historical photo collection;所述电子设备从所述第二目标照片,提取所述历史照片集合关联的人物的三维特征。The electronic device extracts, from the second target photo, the three-dimensional features of the person associated with the historical photo set.7.根据权利要求5所述的方法,其特征在于,所述电子设备获取第一照片之后,所述方法还包括:7. The method according to claim 5, wherein after the electronic device obtains the first photo, the method further comprises:所述电子设备将所述第一照片添加进与所述第一人物关联的第一历史照片集合中,以更新所述第一历史照片集合,得到第二历史照片集合;The electronic device adds the first photo to a first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection;所述电子设备根据所述第二历史照片集合,重新确定所述第一人物的三维特征;The electronic device re-determines the three-dimensional features of the first person according to the second historical photo collection;所述电子设备根据所述重新确定的所述第一人物的三维特征,重新构建所述第一人物的三维模型。The electronic device reconstructs a three-dimensional model of the first character according to the re-determined three-dimensional features of the first character.8.根据权利要求5所述的方法,其特征在于,所述电子设备在所述第一照片中包括人脸图像的情况下,获取所述第一照片中第一人脸图像所属的第一人物的第一特征信息之后,所述方法还包括:8. The method according to claim 5, wherein, if the first photo includes a human face image, the electronic device acquires the first After the first characteristic information of the person, the method also includes:所述电子设备在未获取到所述第一三维模型的情况下,利用所述第一照片构建所述第一人物关联的第一历史照片集合;When the electronic device does not acquire the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person;所述电子设备根据所述第一历史照片集合,确定所述第一人物的三维特征;The electronic device determines the three-dimensional features of the first person according to the first historical photo collection;所述电子设备根据所述第一人物的三维特征,构建所述第一人物的三维模型。The electronic device constructs a three-dimensional model of the first character according to the three-dimensional features of the first character.9.根据权利要求1-4中任一项所述的方法,其特征在于,所述电子设备获取与所述第一特征信息匹配的第一三维模型,包括:9. The method according to any one of claims 1-4, wherein the electronic device acquires the first three-dimensional model matching the first feature information, comprising:所述电子设备获取与所述第一特征信息匹配的第一三维特征;所述第一三维特征为所述第一人物对应的历史照片中,所述第一人物的所述三维特征;The electronic device acquires a first three-dimensional feature that matches the first feature information; the first three-dimensional feature is the three-dimensional feature of the first person in a historical photo corresponding to the first person;所述电子设备利用所述第一三维特征,构建所述第一三维模型。The electronic device constructs the first three-dimensional model by using the first three-dimensional feature.10.根据权利要求9所述的方法,其特征在于,所述电子设备获取与所述第一特征信息匹配的第一三维模型之前,所述方法还包括:10. The method according to claim 9, wherein before the electronic device obtains the first three-dimensional model matching the first feature information, the method further comprises:所述电子设备获取当前时刻之前至少一个历史照片集合;其中,每个所述历史照片集合均关联有一个人物,不同的历史照片集合关联的人物不同;所述历史照片集合中的每张历史照片中均存在所述历史照片集合关联的人物的图像;至少一个历史照片集合中包括关联所述第一人物的第一历史照片集合;The electronic device acquires at least one historical photo collection before the current moment; wherein, each of the historical photo collections is associated with a character, and different historical photo collections have different associated characters; each historical photo in the historical photo collection There are images of people associated with the historical photo collection; at least one historical photo collection includes a first historical photo collection associated with the first person;所述电子设备根据所述历史照片集合,确定所述历史照片集合关联的人物的三维特征;其中,所述三维特征至少包括人脸三维特征。The electronic device determines, according to the historical photo collection, the three-dimensional features of the people associated with the historical photo collection; wherein, the three-dimensional features include at least three-dimensional features of human faces.11.根据权利要求9所述的方法,其特征在于,所述电子设备获取第一照片之后,所述方法还包括:11. The method according to claim 9, wherein after the electronic device obtains the first photo, the method further comprises:所述电子设备将所述第一照片添加进与所述第一人物关联的第一历史照片集合中,以更新所述第一历史照片集合,得到第二历史照片集合;The electronic device adds the first photo to a first historical photo collection associated with the first person, so as to update the first historical photo collection to obtain a second historical photo collection;所述电子设备根据所述第二历史照片集合,重新确定所述第一人物的三维特征。The electronic device re-determines the three-dimensional features of the first person according to the second historical photo collection.12.根据权利要求9所述的方法,其特征在于,所述电子设备在所述第一照片中包括人脸图像的情况下,获取所述第一照片中第一人脸图像所属的第一人物的第一特征信息之后,所述方法还包括:12. The method according to claim 9, wherein, if the first photo includes a human face image, the electronic device obtains the first photo to which the first human face image belongs. After the first characteristic information of the person, the method also includes:所述电子设备在未获取到所述第一三维模型的情况下,利用所述第一照片构建所述第一人物关联的第一历史照片集合;When the electronic device does not acquire the first three-dimensional model, use the first photo to construct a first historical photo collection associated with the first person;所述电子设备根据所述第一历史照片集合,确定所述第一人物的三维特征。The electronic device determines the three-dimensional features of the first person according to the first historical photo collection.13.根据权利要求1-4任一项所述的方法,其特征在于,所述电子设备获取第一照片之后,所述方法还包括:13. The method according to any one of claims 1-4, characterized in that, after the electronic device obtains the first photo, the method further comprises:所述电子设备在所述第一照片中包括人脸图像的情况下,获取第二人脸图像所属的第二人物的第二特征信息;其中,所述第二人物和所述第一人物不同,所述第二特征信息至少包括所述第二人物的人脸特征信息;In the case that the first photo includes a face image, the electronic device acquires second feature information of a second person to whom the second face image belongs; wherein the second person is different from the first person , the second feature information includes at least face feature information of the second person;所述电子设备获取与所述第二特征信息匹配的第二三维模型;其中,所述第二三维模型用于表征所述第二人物对应的历史照片中,所述第二人物的所述三维特征;The electronic device acquires a second three-dimensional model that matches the second characteristic information; wherein, the second three-dimensional model is used to characterize the historical photos corresponding to the second person, the three-dimensional model of the second person feature;所述电子设备将所述第二三维模型与所述第一照片中所述第二人物的图像进行融合,以对所述第一照片中所述第二人物的图像进行优化,得到第三照片。The electronic device fuses the second three-dimensional model with the image of the second person in the first photo to optimize the image of the second person in the first photo to obtain a third photo .14.一种电子设备,其特征在于,包括:摄像头、显示屏、存储器和一个或多个处理器;所述摄像头、所述显示屏、所述存储器与所述处理器耦合;其中,所述存储器中存储有计算机程序代码,所述计算机程序代码包括计算机指令,当所述计算机指令被所述处理器执行时,使得所述电子设备执行如权利要求1-13任一项所述的照片优化方法。14. An electronic device, comprising: a camera, a display screen, a memory, and one or more processors; the camera, the display screen, and the memory are coupled to the processor; wherein, the A computer program code is stored in the memory, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device performs the photo optimization according to any one of claims 1-13 method.15.一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-13任一项所述的照片优化方法。15. A computer-readable storage medium, characterized in that it includes computer instructions, and when the computer instructions are run on an electronic device, the electronic device is made to perform the photo optimization according to any one of claims 1-13. method.
CN202210682176.4A2022-06-152022-06-15Photo optimization method, electronic equipment and storage mediumActiveCN115239576B (en)

Priority Applications (2)

Application NumberPriority DateFiling DateTitle
CN202210682176.4ACN115239576B (en)2022-06-152022-06-15Photo optimization method, electronic equipment and storage medium
CN202310924224.0ACN117237204A (en)2022-06-152022-06-15Image processing method, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210682176.4ACN115239576B (en)2022-06-152022-06-15Photo optimization method, electronic equipment and storage medium

Related Child Applications (1)

Application NumberTitlePriority DateFiling Date
CN202310924224.0ADivisionCN117237204A (en)2022-06-152022-06-15Image processing method, electronic equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN115239576A CN115239576A (en)2022-10-25
CN115239576Btrue CN115239576B (en)2023-08-04

Family

ID=83669075

Family Applications (2)

Application NumberTitlePriority DateFiling Date
CN202210682176.4AActiveCN115239576B (en)2022-06-152022-06-15Photo optimization method, electronic equipment and storage medium
CN202310924224.0APendingCN117237204A (en)2022-06-152022-06-15Image processing method, electronic equipment and storage medium

Family Applications After (1)

Application NumberTitlePriority DateFiling Date
CN202310924224.0APendingCN117237204A (en)2022-06-152022-06-15Image processing method, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (2)CN115239576B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108876709A (en)*2018-05-312018-11-23Oppo广东移动通信有限公司Method for beautifying faces, device, electronic equipment and readable storage medium storing program for executing
CN108921795A (en)*2018-06-042018-11-30腾讯科技(深圳)有限公司A kind of image interfusion method, device and storage medium
CN109767487A (en)*2019-01-042019-05-17北京达佳互联信息技术有限公司Face three-dimensional rebuilding method, device, electronic equipment and storage medium
CN110096925A (en)*2018-01-302019-08-06普天信息技术有限公司Enhancement Method, acquisition methods and the device of Facial Expression Image
CN112967212A (en)*2021-02-012021-06-15北京字节跳动网络技术有限公司Virtual character synthesis method, device, equipment and storage medium
WO2021238351A1 (en)*2020-05-292021-12-02华为技术有限公司Image correction method and electronic apparatus

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104484858B (en)*2014-12-312018-05-08小米科技有限责任公司Character image processing method and processing device
CN107948499A (en)*2017-10-312018-04-20维沃移动通信有限公司A kind of image capturing method and mobile terminal
CN108229369B (en)*2017-12-282020-06-02Oppo广东移动通信有限公司 Image capturing method, device, storage medium and electronic device
CN108510437B (en)*2018-04-042022-05-17科大讯飞股份有限公司Virtual image generation method, device, equipment and readable storage medium
CN109600550B (en)*2018-12-182022-05-31维沃移动通信有限公司Shooting prompting method and terminal equipment
CN112233212A (en)*2019-06-282021-01-15微软技术许可有限责任公司 Portrait Editing and Compositing
CN110602403A (en)*2019-09-232019-12-20华为技术有限公司Method for taking pictures under dark light and electronic equipment
CN112785488A (en)*2019-11-112021-05-11宇龙计算机通信科技(深圳)有限公司Image processing method and device, storage medium and terminal
CN111210510B (en)*2020-01-162021-08-06腾讯科技(深圳)有限公司 Three-dimensional face model generation method, device, computer equipment and storage medium
CN113850709B (en)*2020-06-282025-07-15华为技术有限公司 Image transformation method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110096925A (en)*2018-01-302019-08-06普天信息技术有限公司Enhancement Method, acquisition methods and the device of Facial Expression Image
CN108876709A (en)*2018-05-312018-11-23Oppo广东移动通信有限公司Method for beautifying faces, device, electronic equipment and readable storage medium storing program for executing
CN108921795A (en)*2018-06-042018-11-30腾讯科技(深圳)有限公司A kind of image interfusion method, device and storage medium
CN109767487A (en)*2019-01-042019-05-17北京达佳互联信息技术有限公司Face three-dimensional rebuilding method, device, electronic equipment and storage medium
WO2021238351A1 (en)*2020-05-292021-12-02华为技术有限公司Image correction method and electronic apparatus
CN112967212A (en)*2021-02-012021-06-15北京字节跳动网络技术有限公司Virtual character synthesis method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A 2D face image texture synthesis and 3D model reconstruction based on the Unity platform;Bowen Li等;《2020 IEEE International Conference on Artificial Intelligence and Computer Applications (ICAICA)》;870-873*
基于图片的三维人脸自动生成与编辑算法研究;司徒亨哥;《中国优秀硕士学位论文全文数据库_信息科技辑》;I138-1741*

Also Published As

Publication numberPublication date
CN115239576A (en)2022-10-25
CN117237204A (en)2023-12-15

Similar Documents

PublicationPublication DateTitle
CN110569095B (en) Method and electronic device for displaying page elements
CN111612873B (en) GIF image generation method, device and electronic equipment
CN113298845A (en)Image processing method, device and equipment
EP4047495A1 (en)Method for verifying user identity and electronic device
WO2022062808A1 (en)Portrait generation method and device
CN108200337A (en)photographing processing method, device, terminal and storage medium
CN112422817B (en)Image processing method and device
CN110798615A (en)Shooting method, shooting device, storage medium and terminal
CN111818263A (en) Processing method, device, mobile terminal and storage medium for shooting parameters
CN110536095A (en)Call method, device, terminal and storage medium
CN112989092A (en)Image processing method and related device
CN115423752B (en) Image processing method, electronic device and readable storage medium
CN117132515A (en) Image processing method and electronic device
CN110502959A (en)Gender judgment method, gender judgment device, storage medium and electronic equipment
WO2023197648A1 (en)Screenshot processing method and apparatus, electronic device, and computer readable medium
CN115439307A (en)Style conversion method, style conversion model generation method, and style conversion system
CN115239576B (en)Photo optimization method, electronic equipment and storage medium
WO2024245248A1 (en)Virtual image generation method and related device
US12254572B2 (en)Facial expression editing method and electronic device
CN116320721A (en)Shooting method, shooting device, terminal and storage medium
CN108447035A (en)Image optimization method, electronic device and computer-readable storage medium
CN113269072A (en)Picture processing method, device, equipment and computer program
CN114124879A (en)Multimedia file sharing method and device, terminal equipment and storage medium
CN115170441B (en)Image processing method and electronic equipment
CN118096498B (en) Image generation method and electronic device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CP03Change of name, title or address

Address after:Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after:Honor Terminal Co.,Ltd.

Country or region after:China

Address before:3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before:Honor Device Co.,Ltd.

Country or region before:China

CP03Change of name, title or address

[8]ページ先頭

©2009-2025 Movatter.jp