技术领域Technical Field
本申请实施例涉及图像处理技术领域,尤其涉及一种图像生成方法及其装置。The embodiments of the present application relate to the field of image processing technology, and in particular to an image generation method and device thereof.
背景技术Background technique
随着电子设备的普及,越来越多的用户使用电子设备进行拍照或者录像,以记录或分享生活。在拍摄过程中,由于拍摄角度或拍摄远近关系等因素,容易导致拍摄得到的图像中的目标对象的比例信息不符合用户期望,造成图像的成像效果较差。With the popularization of electronic devices, more and more users use electronic devices to take photos or videos to record or share their lives. During the shooting process, due to factors such as shooting angle or shooting distance, it is easy to cause the proportion information of the target object in the captured image to not meet the user's expectations, resulting in poor imaging effect.
发明内容Summary of the invention
本申请实施例提供一种图像生成方法及其装置,能够解决现有技术中因拍摄得到的图像中的目标对象的比例信息不符合用户期望,造成图像的成像效果较差的问题。The embodiments of the present application provide an image generation method and device thereof, which can solve the problem in the prior art that the proportion information of the target object in the captured image does not meet the user's expectations, resulting in poor imaging effect of the image.
第一方面,本申请实施例提供了一种图像生成方法,包括:In a first aspect, an embodiment of the present application provides an image generation method, comprising:
获取与第一位姿信息对应的第一图像;Acquire a first image corresponding to the first pose information;
在所述第一图像包括目标对象的情况下,获取所述第一图像中所述目标对象对应的第一区域信息;In a case where the first image includes a target object, obtaining first region information corresponding to the target object in the first image;
根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息;Determining target area information corresponding to the target object according to the first area information and target ratio information corresponding to the target object;
根据所述目标区域信息,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。A target image is generated according to the target area information, wherein the scale information of the target object in the target image matches the target scale information.
第二方面,本申请实施例还提供一种图像生成装置,包括:In a second aspect, an embodiment of the present application further provides an image generating device, including:
第一获取模块,用于获取与第一位姿信息对应的第一图像;A first acquisition module, used to acquire a first image corresponding to the first pose information;
第二获取模块,用于在所述第一图像包括目标对象的情况下,获取所述第一图像中所述目标对象对应的第一区域信息;A second acquisition module, configured to acquire first region information corresponding to the target object in the first image when the first image includes the target object;
确定模块,用于根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息;a determination module, configured to determine target area information corresponding to the target object according to the first area information and target ratio information corresponding to the target object;
生成模块,用于根据所述目标区域信息,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。A generating module is used to generate a target image according to the target area information, wherein the scale information of the target object in the target image matches the target scale information.
第三方面,本申请实施例还提供一种电子设备,该电子设备包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的图像生成方法。In a third aspect, an embodiment of the present application further provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the image generation method as described in the first aspect.
第四方面,本申请实施例还提供一种可读存储介质,该可读存储介质上存储有程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的图像生成方法。In a fourth aspect, an embodiment of the present application further provides a readable storage medium having a program or instruction stored thereon, wherein the program or instruction, when executed by a processor, implements the image generation method as described in the first aspect.
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的图像生成方法。In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the image generation method as described in the first aspect.
第六方面,本申请实施例提供一种计算机程序产品,该程序产品被存储在存储介质中,该程序产品被至少一个处理器执行以实现如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
在本申请实施例中,在获取到与第一位姿信息对应的第一图像之后,电子设备识别所述第一图像中的目标对象,并获取所述第一图像中所述目标对象对应的区域信息,即第一区域信息。之后,可以根据所述第一区域信息和预先获取的所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息,以根据所述目标区域信息生成目标图像,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。这样,可以使得目标图像中目标对象的比例信息符合用户期望,从而可以提高目标图像的成像效果。In an embodiment of the present application, after acquiring the first image corresponding to the first pose information, the electronic device identifies the target object in the first image and acquires the region information corresponding to the target object in the first image, i.e., the first region information. Afterwards, the target region information corresponding to the target object can be determined based on the first region information and the target ratio information corresponding to the target object acquired in advance, so as to generate a target image based on the target region information, and the ratio information of the target object in the target image matches the target ratio information. In this way, the ratio information of the target object in the target image can meet the user's expectations, thereby improving the imaging effect of the target image.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
图1是本申请实施例提供的图像生成方法的流程图;FIG1 is a flow chart of an image generation method provided in an embodiment of the present application;
图2a是本申请实施例提供的图像预览界面的示意图之一;FIG2a is a schematic diagram of an image preview interface provided in an embodiment of the present application;
图2b是本申请实施例提供的图像预览界面的示意图之二;FIG2b is a second schematic diagram of an image preview interface provided in an embodiment of the present application;
图2c是本申请实施例提供的图像预览界面的示意图之三;FIG2c is a third schematic diagram of an image preview interface provided in an embodiment of the present application;
图2d是本申请实施例提供的电子设备的位姿调整示意图;FIG2d is a schematic diagram of posture adjustment of an electronic device provided in an embodiment of the present application;
图2e是本申请实施例提供的图像预览界面的示意图之四;FIG2e is a fourth schematic diagram of the image preview interface provided in an embodiment of the present application;
图3是本申请实施例提供的图像生成装置的结构图;FIG3 is a structural diagram of an image generating device provided in an embodiment of the present application;
图4是本申请实施例提供的电子设备的结构图之一;FIG4 is one of the structural diagrams of an electronic device provided in an embodiment of the present application;
图5是本申请实施例提供的电子设备的结构图之二。FIG. 5 is a second structural diagram of the electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and/or" in the specification and claims represents at least one of the connected objects, and the character "/" generally indicates that the objects associated with each other are in an "or" relationship.
下面结合附图,通过一些实施例及其应用场景对本申请实施例提供的图像生成方法进行详细地说明。The image generation method provided in the embodiment of the present application is described in detail below through some embodiments and their application scenarios in combination with the accompanying drawings.
本申请实施例的图像生成方法可以应用于电子设备,或,由电子设备执行。在实际应用中,电子设备可以是手机、平板电脑(Tablet Personal Computer)、膝上型电脑(Laptop Computer)或称为笔记本电脑、个人数字助理(Personal Digital Assistant,PDA)、掌上电脑、上网本、超级移动个人计算机(Ultra-Mobile Personal Computer,UMPC)、移动上网装置(Mobile Internet Device,MID)、增强现实(Augmented Reality,AR)/虚拟现实(Virtual Reality,VR)设备、机器人、可穿戴式设备(Wearable Device)、车载设备(VUE)、行人终端(PUE)、智能家居(具有无线通信功能的家居设备,如冰箱、电视、洗衣机或者家具等)等设备。The image generation method of the embodiment of the present application can be applied to an electronic device, or, executed by an electronic device. In practical applications, the electronic device can be a mobile phone, a tablet computer (Tablet Personal Computer), a laptop computer (Laptop Computer) or a notebook computer, a personal digital assistant (Personal Digital Assistant, PDA), a handheld computer, a netbook, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR)/virtual reality (Virtual Reality, VR) device, a robot, a wearable device (Wearable Device), a vehicle-mounted device (VUE), a pedestrian terminal (PUE), a smart home (home appliances with wireless communication functions, such as refrigerators, televisions, washing machines or furniture, etc.) and other devices.
本申请实施例的图像生成方法可以但不仅限于适用以下场景:The image generation method of the embodiment of the present application can be applied to but not limited to the following scenarios:
场景一:在拍摄过程中,基于采集到的包括目标对象的图像,确定是否需要提示用户调整电子设备的位姿,以使得调整了位姿后的电子设备采集到的目标对象符合目标比例。Scenario 1: During the shooting process, based on the captured image including the target object, determine whether it is necessary to prompt the user to adjust the posture of the electronic device so that the target object captured by the electronic device after the adjusted posture meets the target ratio.
场景二、对于获取到的包括目标对象的图像,可以通过将该图像中的目标对象的比例调整为目标比例,使得图像中的目标对象符合目标比例。Scenario 2: For an acquired image including a target object, the proportion of the target object in the image may be adjusted to a target proportion so that the target object in the image meets the target proportion.
参见图1,图1是本申请实施例提供的图像生成方法的流程图。如图1所示,图像生成方法可以包括以下步骤:Referring to Figure 1, Figure 1 is a flow chart of an image generation method provided in an embodiment of the present application. As shown in Figure 1, the image generation method may include the following steps:
步骤101、获取与第一位姿信息对应的第一图像。Step 101: Acquire a first image corresponding to a first pose information.
对于上述场景一,所述第一图像可以理解为:在拍摄过程中,电子设备处于第一位姿采集到的图像,所述第一位姿信息为所述第一位姿的位姿信息。For the above scenario one, the first image can be understood as: an image captured when the electronic device is in the first posture during the shooting process, and the first posture information is the posture information of the first posture.
一些实施例中,所述第一图像可以为电子设备的摄像头工作于目标模式采集到的图像。在这些实施例中,在电子设备的摄像头工作于目标模式的情况下,电子设备可以基于摄像头采集到的图像确定是否提示用户调整电子设备的位姿,以获取到目标图像;在电子设备的摄像头工作于其他模式,如普通拍照模式、夜景拍照模式或大光圈拍摄模式等的情况下,电子设备可以不执行上述操作。这样,用户可以在需要提示电子设备的位姿时,触发电子设备进入所述目标模式,否则,可以触发电子设备进入其他模式,即用户可以基于自身需求触发电子设备进入相应模式,以使电子设备的响应操作符合用户需求,从而可以提高图像生成的灵活性和可靠性,使得用户获取到的图像符合用户期望。In some embodiments, the first image may be an image captured by the camera of the electronic device operating in the target mode. In these embodiments, when the camera of the electronic device operates in the target mode, the electronic device may determine whether to prompt the user to adjust the posture of the electronic device based on the image captured by the camera to obtain the target image; when the camera of the electronic device operates in other modes, such as normal photo mode, night scene photo mode or large aperture photo mode, the electronic device may not perform the above operation. In this way, the user can trigger the electronic device to enter the target mode when the posture of the electronic device needs to be prompted, otherwise, the electronic device can be triggered to enter other modes, that is, the user can trigger the electronic device to enter the corresponding mode based on his own needs, so that the response operation of the electronic device meets the user's needs, thereby improving the flexibility and reliability of image generation, so that the image obtained by the user meets the user's expectations.
在实际应用中,所述目标模式可以为新增模式或现有模式,如图2a中的“人像拍照”模式,但不仅限于此。In practical applications, the target mode may be a newly added mode or an existing mode, such as the "portrait photography" mode in FIG. 2a , but is not limited thereto.
对于上述场景二,所述第一图像可以理解为:电子设备保存的图像,如:电子设备历史拍摄得到的图像,或,电子设备下载的图像,或,电子设备通过网络接收的图像等。所述第一位姿信息为所述第一图像的采集设备在采集所述第一图像时的位姿信息。For the above scenario 2, the first image can be understood as: an image saved by the electronic device, such as: an image captured by the electronic device in the past, or an image downloaded by the electronic device, or an image received by the electronic device through the network, etc. The first posture information is the posture information of the acquisition device of the first image when acquiring the first image.
步骤102、在所述第一图像包括目标对象的情况下,获取所述第一图像中所述目标对象对应的第一区域信息。Step 102: When the first image includes a target object, obtain first region information corresponding to the target object in the first image.
在本申请实施例中,所述目标对象可以理解为:为满足预期成像效果,图像中需要进行优化或调整的对象,如图2a中的全身人像,但不仅限于此。In the embodiment of the present application, the target object can be understood as: an object in the image that needs to be optimized or adjusted to meet the expected imaging effect, such as the full-body portrait in Figure 2a, but not limited to this.
具体实现时,电子设备在获取到所述第一图像之后,可以对所述第一图像进行内容识别,确定所述第一图像中是否包括目标对象。In a specific implementation, after acquiring the first image, the electronic device may perform content recognition on the first image to determine whether the first image includes a target object.
在所述第一图像不包括目标对象的情况下,电子设备可以结束流程,或,获取新的图像作为第一图像,重新执行流程。In the case that the first image does not include the target object, the electronic device may end the process, or acquire a new image as the first image and re-execute the process.
在所述第一图像包括目标对象的情况下,可以包括:所述第一图像包括仅一个目标对象的情况一,以及所述第一图像中包括多个目标对象的情况二。In the case where the first image includes a target object, the method may include: a first case where the first image includes only one target object, and a second case where the first image includes a plurality of target objects.
对于情况一,本申请实施例的“目标对象”即为所述第一图像中仅包括的目标对象。For case 1, the “target object” in the embodiment of the present application is the target object only included in the first image.
对于情况二,本申请实施例中的“目标对象”可以理解为:所述第一图像包括的多个目标对象中的特定目标对象,该特定目标对象可以为:多个目标对象中的任一个目标对象;或,多个目标对象中尺寸最大的目标对象;或,用户从多个目标对象中选择的至少2个目标对象。即在这种情况下,电子设备可以基于该特定目标对象,进行电子设备的位姿的调整或进行第一图像的调整,以生成目标图像。For the second case, the "target object" in the embodiment of the present application can be understood as: a specific target object among the multiple target objects included in the first image, and the specific target object can be: any one of the multiple target objects; or the target object with the largest size among the multiple target objects; or at least 2 target objects selected by the user from the multiple target objects. That is, in this case, the electronic device can adjust the posture of the electronic device or adjust the first image based on the specific target object to generate the target image.
在所述第一图像包括目标对象的情况下,电子设备可以进一步识别出所述第一图像中目标对象所在的区域,以下称为第一区域,以及识别所述第一图像中目标对象的各部位,以分割目标对象的各部位。在目标对象为全身人像的情况下,目标对象的各部位可以包括:头、上身和下身三个部位。In the case where the first image includes the target object, the electronic device can further identify the area where the target object is located in the first image, hereinafter referred to as the first area, and identify the parts of the target object in the first image to segment the parts of the target object. In the case where the target object is a full-body portrait, the parts of the target object may include: head, upper body and lower body.
在一些实施例中,为方便处理,如图2b所示,所述第一区域的形状可以为矩形,但并不因此限制所述第一区域的形状,如在某些实施例中,所述第一区域的形状可以与所述目标对象的轮廓相同。In some embodiments, for ease of processing, as shown in FIG. 2b , the shape of the first region may be a rectangle, but this does not limit the shape of the first region. For example, in some embodiments, the shape of the first region may be the same as the outline of the target object.
第一区域信息,即第一区域的区域信息,可以包括以下至少一项:所述第一区域的形状信息;所述第一区域中目标对象的分割方向;所述第一区域中目标对象各部位的尺寸信息。The first region information, that is, the region information of the first region, may include at least one of the following: shape information of the first region; segmentation direction of the target object in the first region; and size information of each part of the target object in the first region.
所述第一区域的形状信息用于描述所述第一区域的形状。如:对于矩形,形状信息可以包括以下至少一项:高、宽、至少一个顶点坐标。如:在一些实施例中,形状信息可以包括:一个顶点坐标,以及高和宽。在另一些实施例中,形状信息可以包括:四个顶点坐标。The shape information of the first area is used to describe the shape of the first area. For example, for a rectangle, the shape information may include at least one of the following: height, width, and at least one vertex coordinate. For example, in some embodiments, the shape information may include: one vertex coordinate, as well as height and width. In other embodiments, the shape information may include: four vertex coordinates.
所述第一区域中目标对象的分割方向可以与第一区域的最大长度垂直,如:对于矩形,在高大于宽的情况下,分割方向与高垂直;在高小于宽的情况下,分割方向与宽垂直。The segmentation direction of the target object in the first area may be perpendicular to the maximum length of the first area. For example, for a rectangle, when the height is greater than the width, the segmentation direction is perpendicular to the height; when the height is less than the width, the segmentation direction is perpendicular to the width.
在分割各部位时,可以通过分割第一区域实现部位的分割,第一区域的各子区域与目标对象的各部位一一对应,即一个子区域目标对象的一个部位。所述第一区域中目标对象各部位的尺寸信息,可以包括以下至少一项:各部位所在子区域相对于第一区域的占比;各部位所在子区域的锚点信息。在子区域为矩形的情况下,锚点信息可以表现为顶点信息。When segmenting each part, the segmentation of the part can be achieved by segmenting the first area, and each sub-area of the first area corresponds to each part of the target object one by one, that is, one sub-area is one part of the target object. The size information of each part of the target object in the first area may include at least one of the following: the proportion of the sub-area where each part is located relative to the first area; the anchor point information of the sub-area where each part is located. When the sub-area is a rectangle, the anchor point information can be expressed as vertex information.
为方便理解,请继续参见图2b。在图2b中:H1为第一区域的高;W1为第一矩形的宽;A(x1,y1)为第一区域的一个顶点,可以称为起始点;分割方向与H1垂直,与W1平行。假设图2b中头部区域的占比为1/6,上身区域的占比为2/6,下身区域的占比为3/6。在此情况下,第一区域信息可以为(A,H1,W1,O1,1/6,2/6,3/6),其中,前3个参数为第一区域的形状信息,O1为分割方向,后3个参数为各部位所在子区域相对于第一区域的占比。For ease of understanding, please continue to refer to Figure 2b. In Figure 2b: H1 is the height of the first area; W1 is the width of the first rectangle; A(x1, y1) is a vertex of the first area, which can be called the starting point; the segmentation direction is perpendicular to H1 and parallel to W1. Assume that the head area in Figure 2b accounts for 1/6, the upper body area accounts for 2/6, and the lower body area accounts for 3/6. In this case, the first area information can be (A, H1, W1, O1, 1/6, 2/6, 3/6), where the first 3 parameters are the shape information of the first area, O1 is the segmentation direction, and the last 3 parameters are the proportion of the sub-areas where each part is located relative to the first area.
步骤103、根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息。Step 103: Determine target region information corresponding to the target object according to the first region information and target ratio information corresponding to the target object.
所述目标对象对应的目标比例信息用于描述目标对象的目标比例。目标比例的目标对象可以理解为:符合预期成像效果的目标对象,即若图像中目标对象的比例与目标比例匹配(相同或近似),则该图像的成像效果合格。所述目标比例信息可以由系统默认设置或用户设置。The target ratio information corresponding to the target object is used to describe the target ratio of the target object. The target ratio of the target object can be understood as: a target object that meets the expected imaging effect, that is, if the ratio of the target object in the image matches (is the same as or similar to) the target ratio, the imaging effect of the image is qualified. The target ratio information can be set by the system default or by the user.
目标对象的目标比例可以包括目标对象在至少一个方向上的目标比例。以图2b中的人像为例,目标比例可以包括人像在高度上的目标比例信息,以及在宽度上的目标比例信息。在一些实施例中,高度上的目标比例可以为“N头身”,N为大于1的整数,即以头部的高度为参考,目标对象的总高度为N个头的高度,如一种示例中,高度上的目标比例可以为“8头身”。The target ratio of the target object may include the target ratio of the target object in at least one direction. Taking the portrait in FIG. 2b as an example, the target ratio may include the target ratio information of the portrait in height and the target ratio information in width. In some embodiments, the target ratio in height may be "N heads per body", where N is an integer greater than 1, i.e., with the height of the head as a reference, the total height of the target object is the height of N heads. For example, in one example, the target ratio in height may be "8 heads per body".
电子设备可以基于所述第一区域信息,以及所述目标对象对应的目标比例信息,计算将第一图像中目标对象的比例调整为所述目标比例之后,目标对象所在的目标区域的相关信息,即目标区域信息。需要说明的是,目标区域相关信息包括的信息类型与第一区域信息包括的信息类型相同,此处不再赘述。The electronic device can calculate, based on the first area information and the target ratio information corresponding to the target object, relevant information of the target area where the target object is located after the ratio of the target object in the first image is adjusted to the target ratio, i.e., the target area information. It should be noted that the information type included in the target area related information is the same as the information type included in the first area information, and will not be repeated here.
为方便理解,请参见图2c。在图2c中,目标比例为“8头身”,目标区域信息可以为(B,H2,W2,O1,1/8,3/8,4/8),即目标区域的起始点为B,高度为H2,宽度为W2,分割方向为O1,头部区域相对目标区域的占比为1/8,上身区域相对目标区域的占比为3/8,下身区域相对目标区域的占比为4/8。可见,目标区域中目标对象的比例与目标比例匹配。For easier understanding, please refer to Figure 2c. In Figure 2c, the target ratio is "8 heads and bodies", and the target region information can be (B, H2, W2, O1, 1/8, 3/8, 4/8), that is, the starting point of the target region is B, the height is H2, the width is W2, the segmentation direction is O1, the head region accounts for 1/8 of the target region, the upper body region accounts for 3/8 of the target region, and the lower body region accounts for 4/8 of the target region. It can be seen that the ratio of the target object in the target region matches the target ratio.
步骤104、根据所述目标区域信息,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。Step 104: Generate a target image according to the target area information, wherein the scale information of the target object in the target image matches the target scale information.
在一些实施例中,电子设备可以基于所述目标区域信息,调整第一区域的大小和图像内容,使得第一区域的大小与目标区域的大小相同,第一区域的图像内容中目标对象的比例与目标比例匹配,生成目标图像。In some embodiments, the electronic device can adjust the size and image content of the first area based on the target area information so that the size of the first area is the same as the size of the target area, and the proportion of the target object in the image content of the first area matches the target proportion, thereby generating a target image.
在另一些实施例中,电子设备可以结合所述第一区域信息和所述目标区域信息,计算得到一个二维转换矩阵,之后,基于该二维转换矩阵,生成目标图像,具体可参见下述相关描述,此处不作描述。In other embodiments, the electronic device may combine the first area information and the target area information to calculate a two-dimensional transformation matrix, and then generate a target image based on the two-dimensional transformation matrix. For details, please refer to the following related description and will not be described here.
本实施例的图像生成方法,在获取到与第一位姿信息对应的第一图像之后,电子设备识别所述第一图像中的目标对象,并获取所述第一图像中所述目标对象对应的区域信息,即第一区域信息。之后,可以根据所述第一区域信息和预先获取的所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息,以根据所述目标区域信息获取到目标图像,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配,。这样,可以使得目标图像的目标对象的比例信息符合用户期望,从而可以提高目标图像的成像效果。In the image generation method of this embodiment, after acquiring the first image corresponding to the first pose information, the electronic device identifies the target object in the first image and acquires the region information corresponding to the target object in the first image, that is, the first region information. Afterwards, the target region information corresponding to the target object can be determined based on the first region information and the target ratio information corresponding to the target object acquired in advance, so as to acquire the target image based on the target region information, and the ratio information of the target object in the target image matches the target ratio information. In this way, the ratio information of the target object of the target image can meet the user's expectations, thereby improving the imaging effect of the target image.
在一些实施例中,所述根据所述目标区域信息,生成目标图像,可以包括:In some embodiments, generating a target image according to the target area information may include:
根据所述第一区域信息和所述目标区域信息,确定二维转换矩阵;Determine a two-dimensional conversion matrix according to the first area information and the target area information;
根据所述二维转换矩阵,生成目标图像。A target image is generated according to the two-dimensional transformation matrix.
在本实施例中,所述第一区域信息M、所述目标区域信息N和所述二维转换矩阵C1之间的关系可以满足:M×C1=N。即利用二维转换矩阵,可以将第一区域转换为目标区域。因此,在获取到所述第一区域信息和所述目标区域信息之后,可以将所述目标区域信息中各信息相对所述第一区域信息中相应信息的比值,确定为确定二维转换矩阵中各元素的值,得到所述二维转换矩阵。In this embodiment, the relationship between the first region information M, the target region information N, and the two-dimensional conversion matrix C1 can satisfy: M×C1=N. That is, the first region can be converted into the target region using the two-dimensional conversion matrix. Therefore, after obtaining the first region information and the target region information, the ratio of each information in the target region information to the corresponding information in the first region information can be determined as the value of each element in the two-dimensional conversion matrix to obtain the two-dimensional conversion matrix.
由前述内容可知,本申请实施例的图像生成方法可以适用于不同场景,对于不同场景,所述根据所述二维转换矩阵,生成目标图像的具体实施方式可以不同,具体如下。It can be seen from the foregoing that the image generation method of the embodiment of the present application can be applicable to different scenarios. For different scenarios, the specific implementation method of generating the target image according to the two-dimensional transformation matrix may be different, as follows.
对于前述场景一For the above scenario
所述根据所述二维转换矩阵,生成目标图像,可以包括:Generating a target image according to the two-dimensional transformation matrix may include:
获取所述二维转换矩阵对应的三维转换矩阵;Obtaining a three-dimensional transformation matrix corresponding to the two-dimensional transformation matrix;
根据所述三维转换矩阵和所述第一位姿信息,获取目标位姿信息;Acquire target posture information according to the three-dimensional transformation matrix and the first posture information;
输出与所述目标位姿信息对应的提示信息;Outputting prompt information corresponding to the target posture information;
获取与第二位姿信息对应的第二图像;Acquire a second image corresponding to the second posture information;
在所述第二图像包括所述目标对象的情况下,获取所述第二图像中所述目标对象对应的第二区域信息;In a case where the second image includes the target object, obtaining second region information corresponding to the target object in the second image;
在所述目标区域信息和所述第二区域信息匹配的情况下,执行拍照操作,生成目标图像。When the target area information matches the second area information, a photographing operation is performed to generate a target image.
在场景一中,通过提示用户调整电子设备的位姿,以获取到符合预期成像效果的图像,因此,电子设备可以先根据二维转换矩阵,计算电子设备的目标位姿,获取目标位姿信息。电子设备处于所述目标位姿采集到的目标对象的比例符合目标比例。In scenario 1, the user is prompted to adjust the posture of the electronic device to obtain an image that meets the expected imaging effect. Therefore, the electronic device can first calculate the target posture of the electronic device according to the two-dimensional transformation matrix to obtain the target posture information. The proportion of the target object collected by the electronic device in the target posture meets the target proportion.
具体实现时,电子设备可以获取二维转换C1矩阵对应的三维转换矩阵C2,利用三维转换矩阵C2转换所述第一位姿信息P1,得到目标位姿信息P2,即P1×C2=P2。需要说明的是,二维转换矩阵到三维转换矩阵的转换,可以基于二维像素坐标与三维世界坐标之间的转换关系计算得到,具体实现可参见相关技术,此处不作说明。In a specific implementation, the electronic device can obtain the three-dimensional transformation matrix C2 corresponding to the two-dimensional transformation matrix C1, and use the three-dimensional transformation matrix C2 to transform the first posture information P1 to obtain the target posture information P2, that is, P1×C2=P2. It should be noted that the conversion from the two-dimensional transformation matrix to the three-dimensional transformation matrix can be calculated based on the conversion relationship between the two-dimensional pixel coordinates and the three-dimensional world coordinates. The specific implementation can be referred to the relevant technology, which is not explained here.
电子设备在获取到目标位姿信息之后,可以输出提示信息,以提示用户调整电子设备的位姿至目标位姿。一种实现方式中,所述提示信息可以用于提示电子设备的转动信息和/移动信息,以使用户明确对电子设备的操作;另一种实现方式中,所述提示信息可以显示目标位姿,但不仅限于此。为方便理解,请参见图2d。在图2d中,可以直接在图像预览界面显示提示信息,提示信息包括:三维坐标和调整标识。当用户按照提示信息将电子设备的位姿从P1调整至P2,电子设备可以隐藏提示信息,表示电子设备已调整至目标位姿,此时采集到的目标对象的比例符合目标比例。用户在观察到提示信息消失之后,可以停止电子设备的位姿调整操作,以获取符合预期成像效果的目标图像。After acquiring the target posture information, the electronic device can output prompt information to prompt the user to adjust the posture of the electronic device to the target posture. In one implementation, the prompt information can be used to prompt the rotation information and/or movement information of the electronic device so that the user can clearly understand the operation of the electronic device; in another implementation, the prompt information can display the target posture, but is not limited to this. For ease of understanding, please refer to Figure 2d. In Figure 2d, the prompt information can be directly displayed on the image preview interface, and the prompt information includes: three-dimensional coordinates and adjustment identifiers. When the user adjusts the posture of the electronic device from P1 to P2 according to the prompt information, the electronic device can hide the prompt information, indicating that the electronic device has been adjusted to the target posture, and the proportion of the target object collected at this time meets the target proportion. After observing that the prompt information disappears, the user can stop the posture adjustment operation of the electronic device to obtain a target image that meets the expected imaging effect.
在用户调整电子设备的姿态的过程中,电子设备可以进行图像采集,并获取此过程中采集到的图像中目标对象对应的区域信息,所述第二图像即为在此过程中采集到的图像。在此过程中,每获取到一个图像,即可以将该图像中目标对象对应的区域信息与目标区域信息进行匹配,以检测电子设备是否已调整到位。若不匹配,表示电子设备未调整到位,继续进行图像采集,以检测电子设备是否已调整到位;若匹配,表示电子设备已调整到位,电子设备可以通过以下方式获取目标对象:1)自动执行拍照操作,将拍到的图像作为目标图像,如图2e所示;2)输出拍照提示信息,在检测到拍照输入的情况下,执行拍照操作,将拍到的图像作为图像;3)将第二图像作为目标图像。相比于1)和2),3)无需执行拍照操作,从而可以降低电子设备运行负担。In the process of the user adjusting the posture of the electronic device, the electronic device can perform image acquisition and obtain the area information corresponding to the target object in the image acquired in this process, and the second image is the image acquired in this process. In this process, each time an image is acquired, the area information corresponding to the target object in the image can be matched with the target area information to detect whether the electronic device has been adjusted in place. If it does not match, it means that the electronic device has not been adjusted in place, and image acquisition continues to detect whether the electronic device has been adjusted in place; if it matches, it means that the electronic device has been adjusted in place, and the electronic device can obtain the target object in the following ways: 1) Automatically perform a photo operation, and use the captured image as the target image, as shown in Figure 2e; 2) Output a photo prompt information, and when a photo input is detected, perform a photo operation, and use the captured image as an image; 3) Use the second image as the target image. Compared with 1) and 2), 3) does not need to perform a photo operation, thereby reducing the operating burden of the electronic device.
第二区域信息与目标区域信息匹配,可以表现为:第二区域(第二图像中目标对象所在的区域)与目标区域的重叠区域相对目标区域的占比大于预设阈值,如90%等。The second region information matches the target region information, which can be expressed as: the proportion of the overlapping area of the second region (the region where the target object is located in the second image) and the target region relative to the target region is greater than a preset threshold, such as 90%.
通过本实施例,可以在拍摄过程中,提示用户调整电子设备的位姿,获取到目标比例的目标对象,可以保证图像的成像效果。Through this embodiment, during the shooting process, the user can be prompted to adjust the posture of the electronic device to obtain a target object with a target proportion, thereby ensuring the imaging effect of the image.
对于前述场景二For the above scenario 2
所述根据所述二维转换矩阵,生成目标图像,可以包括:Generating a target image according to the two-dimensional transformation matrix may include:
根据所述二维转换矩阵调整所述第一区域,调整后的所述第一区域中的目标对象的比例信息与所述目标比例信息相同;adjusting the first region according to the two-dimensional conversion matrix, wherein the proportion information of the target object in the first region after adjustment is the same as the target proportion information;
保存调整后的所述第一图像;saving the adjusted first image;
其中,所述目标图像为调整后的所述第一图像。The target image is the adjusted first image.
在场景二中,通过调整第一图像中目标对象所在的区域,以获取到符合预期成像效果的图像,因此,电子设备可以直接根据二维转换矩阵,将所述第一区域调整为所述目标区域,这样,调整后的第一图像中的目标对象的比例符合目标比例,符合预期的成像效果。In scenario two, the area where the target object in the first image is located is adjusted to obtain an image that meets the expected imaging effect. Therefore, the electronic device can directly adjust the first area to the target area according to the two-dimensional conversion matrix. In this way, the proportion of the target object in the adjusted first image meets the target proportion and meets the expected imaging effect.
通过本实施例,可以对不符合预期的成像效果的图像进行调整,使其符合预期的成像效果,可以提高图像的成像效果。Through this embodiment, an image that does not meet the expected imaging effect can be adjusted to meet the expected imaging effect, thereby improving the imaging effect of the image.
以下对目标区域信息的获取进行详细说明。The following is a detailed description of how to obtain the target area information.
在一些实施例中,所述目标对象包括Q个部位;所述第一区域包括与所述Q个部位一一对应的Q个第一子区域;所述第一区域信息包括:所述Q个第一子区域的锚点信息,以及所述第一区域中各子区域相对所述第一区域的占比,Q为大于1的整数;In some embodiments, the target object includes Q parts; the first region includes Q first sub-regions corresponding to the Q parts one by one; the first region information includes: anchor point information of the Q first sub-regions, and a proportion of each sub-region in the first region relative to the first region, where Q is an integer greater than 1;
所述根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息,包括:The determining, according to the first area information and the target ratio information corresponding to the target object, the target area information corresponding to the target object includes:
确定所述第一区域的参考线,以及所述目标对象的参考部位;Determining a reference line of the first area and a reference part of the target object;
根据所述参考部位对应的第一子区域、所述参考线和所述目标比例信息,确定与剩余Q-1个部位一一对应的Q-1个第二子区域,得到目标区域,所述目标区域包括所述参考部位对应的第一子区域和所述Q-1个第二子区域;According to the first sub-region corresponding to the reference part, the reference line and the target ratio information, Q-1 second sub-regions corresponding to the remaining Q-1 parts are determined to obtain a target region, wherein the target region includes the first sub-region corresponding to the reference part and the Q-1 second sub-regions;
获取目标区域信息,所述目标区域信息为所述目标区域的相关信息,包括:所述参考部位对应的第一子区域的锚点信息,所述Q-1个第二子区域的锚点信息,以及所述目标区域中各子区域相对所述目标区域的占比,其中,所述目标区域中各子区域相对所述目标区域的占比与所述目标比例信息匹配。Obtain target area information, wherein the target area information is relevant information of the target area, including: anchor point information of the first sub-area corresponding to the reference part, anchor point information of the Q-1 second sub-areas, and the proportion of each sub-area in the target area relative to the target area, wherein the proportion of each sub-area in the target area relative to the target area matches the target proportion information.
为方便理解,结合图2b和图2c进行说明。在图2b和图2c中,Q为3,子区域的锚点信息可以包括子区域的下边两个顶点的坐标信息,这样,可以实现各子区域的定位。For ease of understanding, the following description is provided in conjunction with Figure 2b and Figure 2c. In Figure 2b and Figure 2c, Q is 3, and the anchor point information of the sub-region may include the coordinate information of the two lower vertices of the sub-region, so that the positioning of each sub-region can be achieved.
参考线可以理解为区域的调整基准线。参考部位可以理解为目标对象的调整基准部位,在调整目标对象的比例时,参考部位的尺寸保持不变。The reference line can be understood as the adjustment reference line of the region. The reference part can be understood as the adjustment reference part of the target object. When the proportion of the target object is adjusted, the size of the reference part remains unchanged.
在图2b中,参考线为第一区域的下边;参考部位为头部。假设图2b中目标对象的比例为1:2:3,头部所在的子区域的高度为20个像素,上身部分所在的子区域的高度为40个像素,下身部分所在的子区域的高度为60个像素。假设目标比例为为1:3:4,参考部位为头部,那么在图2c中,头部所在的子区域的高度为20个像素,上身部分所在的子区域的高度为60个像素,下身部分所在的子区域的高度为80个像素。由于参考线为下边,相比于图2b,图2c可以视为将目标对象所在的区域向上拉伸。由于第一区域的锚点信息已知,目标区域各子区域的高度已知,基于参考线可以计算得到目标区域的锚点信息。In Figure 2b, the reference line is the bottom of the first area; the reference part is the head. Assuming that the ratio of the target object in Figure 2b is 1:2:3, the height of the sub-area where the head is located is 20 pixels, the height of the sub-area where the upper body is located is 40 pixels, and the height of the sub-area where the lower body is located is 60 pixels. Assuming that the target ratio is 1:3:4 and the reference part is the head, then in Figure 2c, the height of the sub-area where the head is located is 20 pixels, the height of the sub-area where the upper body is located is 60 pixels, and the height of the sub-area where the lower body is located is 80 pixels. Since the reference line is the bottom, compared to Figure 2b, Figure 2c can be regarded as stretching the area where the target object is located upward. Since the anchor point information of the first area is known and the heights of each sub-area of the target area are known, the anchor point information of the target area can be calculated based on the reference line.
通过上述方式,可以实现目标区域信息的准确获取,从而可以提高成像的可靠性。Through the above method, accurate acquisition of target area information can be achieved, thereby improving the reliability of imaging.
需要说明的是,本申请实施例中介绍的多种可选的实施方式,在彼此不冲突的情况下可以相互结合实现,也可以单独实现,对此本申请实施例不作限定。It should be noted that the various optional implementations introduced in the embodiments of the present application can be implemented in combination with each other or separately if they do not conflict with each other, and the embodiments of the present application are not limited to this.
为方便理解,示例说明如下:For ease of understanding, the following examples are provided:
在下述示例中,以目标对象为“全身人像”进行示例说明,但并不因此限制目标对象的具体表现形式。In the following examples, the target object is taken as a “full-body portrait” for illustration, but the specific form of expression of the target object is not limited thereby.
在本示例中,可以实现人像拍摄的图像自动处理方法,可以缩减人像拍摄的时间成本,提升人像拍摄效率;引导和控制合理的人像比例,降低人像拍摄的技术门槛,提升人像拍摄成片效果;降低人像后期修图的投入。In this example, an automatic image processing method for portrait shooting can be implemented, which can reduce the time cost of portrait shooting and improve the efficiency of portrait shooting; guide and control reasonable portrait proportions, lower the technical threshold of portrait shooting, and improve the effect of portrait shooting; reduce the investment in post-production portrait retouching.
在本示例中,定义画面内主被摄人为“主体人”,这里以单主体人为例,具体实施步骤如下:In this example, the main subject in the picture is defined as "subject person". Here, a single subject is taken as an example. The specific implementation steps are as follows:
步骤一、打开相机,选择人像拍照功能。Step 1: Open the camera and select the portrait function.
打开电子设备的相机,在拍照界面下点击选择“人像拍照”功能,选择后,进入人像界面,相机开始进行人像处理的输入图像采集,如图2a所示。Turn on the camera of the electronic device, click and select the "portrait photo" function in the photo taking interface, and after selection, enter the portrait interface, and the camera starts to collect input images for portrait processing, as shown in FIG2a.
步骤二、判定主体人像区域并分割主体人像区域的人体比例。Step 2: determine the main portrait area and segment the body proportions of the main portrait area.
进入人像拍照功能之后,识别到画面内存在人像,则对图像内容进行分割,分离出主体人像区域,否则判定为非人像拍摄场景,维持后台检测。将图像内的主体人像区域按矩形分隔出,假设此矩形的高为H1,宽为W1,约定此矩形图像左上角点为主体人区域的起始点A(x1,y1)。如果主体的H1≥W1,则判定对主体的人体比例做进一步分割的方向为沿W1方向,否则分割方向沿H1方向。确认分割方向后,对分离的主体人进行人力比例结构分割(这里以分割位头、上身、下身三部分,沿W1方向举例),此方向定义为O1。并在预览图像对应每部分的起始位置设置锚点,并在预览显示主体各部分在相对于主体总尺寸的占比,如图2b所示。最终我们得到当前主体人区域M:(A,H1,W1,O1,1/6,2/6,3/6)。After entering the portrait photography function, if a portrait is recognized in the picture, the image content is segmented to separate the main portrait area, otherwise it is determined to be a non-portrait shooting scene and the background detection is maintained. The main portrait area in the image is separated by a rectangle. Assume that the height of this rectangle is H1 and the width is W1. The upper left corner of this rectangular image is agreed to be the starting point A(x1, y1) of the main human area. If the H1 of the subject is ≥ W1, the direction of further segmentation of the human body proportion of the subject is determined to be along the W1 direction, otherwise the segmentation direction is along the H1 direction. After confirming the segmentation direction, the separated main human body is segmented into human proportion structure (here the segmentation of the head, upper body and lower body is taken as an example along the W1 direction), and this direction is defined as O1. Anchor points are set at the starting position of each part of the preview image, and the proportion of each part of the subject relative to the total size of the subject is displayed in the preview, as shown in Figure 2b. Finally, we get the current main human area M: (A, H1, W1, O1, 1/6, 2/6, 3/6).
步骤三、计算主体人的目标图像区域。Step 3: Calculate the target image area of the subject.
假定我们的目标比例是“8头身”,则依据步骤二内得到的当前主体人的矩形区域信息M:(A,H1,W1,O1,1/6,2/6,3/6),计算出主体人的目标矩形区域为N:(B,H2,W2,O1,1/8,3/8,4/8),如图2c所示。Assuming that our target ratio is "8 head body", based on the rectangular area information M: (A, H1, W1, O1, 1/6, 2/6, 3/6) of the current subject obtained in step 2, the target rectangular area of the subject is calculated to be N: (B, H2, W2, O1, 1/8, 3/8, 4/8), as shown in Figure 2c.
步骤四、获取位姿传感器数据,计算手机当前位姿,计算M到N的转换矩阵。Step 4: Get the posture sensor data, calculate the current posture of the mobile phone, and calculate the transformation matrix from M to N.
相机在后台不断获取位姿传感器(Accelerator),计算出手机当前的位姿P1。依据步骤二得到的图像区域M,步骤三得到的图像区域N,计算出M到N的转换矩阵C,并计算出电子设备的目标位姿P2,在预览界面显示出引导界面,引导用户调整电子设备的姿态到达位姿P2,如图2d所示。The camera continuously obtains the pose sensor (Accelerator) in the background and calculates the current pose P1 of the mobile phone. Based on the image area M obtained in step 2 and the image area N obtained in step 3, the transformation matrix C from M to N is calculated, and the target pose P2 of the electronic device is calculated. A guidance interface is displayed on the preview interface to guide the user to adjust the posture of the electronic device to reach pose P2, as shown in Figure 2d.
步骤五、当区域M与目标区域N的匹配性较高时,自动拍照。Step 5: When the matching degree between the area M and the target area N is high, a photo is taken automatically.
用户调整手机位姿态的过程中,持续检查当前预览主体人区域M’与目标区域N的重叠区域面积占比X,当重叠区域占比X大于一定阈值,则认为电子设备的机位姿已调整到位,自动启动拍照,完成拍摄,如图2e所示。When the user adjusts the position of the mobile phone, the overlapping area ratio X between the current preview subject area M' and the target area N is continuously checked. When the overlapping area ratio X is greater than a certain threshold, it is considered that the position of the electronic device has been adjusted to the correct position, and the photo shooting is automatically started to complete the shooting, as shown in Figure 2e.
本示例能够在预览时通过调整电子设备的位姿进行人像处理,改善人像拍照的成片质量,可以降低人像拍摄的技术门槛,实现人像拍摄过程中人体比例的较优控制,提升成片质量;缩减人像拍摄的时间成本,提升人像拍摄效率;This example can adjust the posture of the electronic device to process the portrait during preview, improve the quality of the portrait photo, lower the technical threshold of portrait photography, achieve better control of the body proportions during portrait photography, and improve the quality of the photo; reduce the time cost of portrait photography and improve the efficiency of portrait photography;
降低人像后期修图的投入。Reduce the investment in post-production portrait retouching.
在上述示例中,为预览时,实时根据预览图像计算并引导用户进行实时位姿调整以达到较优人体比例的人像拍摄结果。本申请实施例还可以直接根据用户已拍摄的图像以及此图像拍摄时对应的手机位姿信息,在拍摄后对已拍摄图像做主体人体比例调整,达到较优人像成片效果,这样可以节省功耗、内存,并提升性能。In the above example, when previewing, the user is guided to adjust the posture in real time based on the preview image to achieve a portrait shooting result with better body proportions. The embodiment of the present application can also directly adjust the body proportions of the subject in the captured image after shooting based on the image already shot by the user and the corresponding mobile phone posture information when the image was shot, so as to achieve a better portrait film effect, which can save power consumption, memory, and improve performance.
需要说明的是,本申请实施例提供的图像生成方法,执行主体可以为图像生成装置,或者,该图像生成装置中的用于执行图像生成方法的控制模块。本申请实施例中以图像生成装置执行图像生成方法为例,说明本申请实施例提供的图像生成装置。It should be noted that the image generation method provided in the embodiment of the present application can be executed by an image generation device, or a control module in the image generation device for executing the image generation method. In the embodiment of the present application, the image generation device provided in the embodiment of the present application is described by taking the image generation method executed by the image generation device as an example.
参见图3,图3是本申请实施例提供的图像生成装置的结构图。Refer to Figure 3, which is a structural diagram of the image generating device provided in an embodiment of the present application.
如图3所示,图像生成装置300包括:As shown in FIG3 , the image generating device 300 includes:
第一获取模块301,用于获取与第一位姿信息对应的第一图像;A first acquisition module 301 is used to acquire a first image corresponding to the first pose information;
第二获取模块302,用于在所述第一图像包括目标对象的情况下,获取所述第一图像中所述目标对象对应的第一区域信息;A second acquisition module 302 is used to acquire first region information corresponding to the target object in the first image when the first image includes the target object;
确定模块303,用于根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息;A determination module 303 is used to determine target area information corresponding to the target object according to the first area information and target ratio information corresponding to the target object;
生成模块304,用于根据所述目标区域信息,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。The generating module 304 is configured to generate a target image according to the target area information, wherein the scale information of the target object in the target image matches the target scale information.
在一些实施例中,所述生成模块,包括:In some embodiments, the generating module comprises:
获取子模块,用于根据所述第一区域信息和所述目标区域信息,确定二维转换矩阵;an acquisition submodule, configured to determine a two-dimensional conversion matrix according to the first region information and the target region information;
生成子模块,用于根据所述二维转换矩阵,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。A generating submodule is used to generate a target image according to the two-dimensional conversion matrix, wherein the scale information of the target object in the target image matches the target scale information.
在一些实施例中,所述生成子模块包括:In some embodiments, the generating submodule includes:
第一获取单元,用于获取所述二维转换矩阵对应的三维转换矩阵;A first acquisition unit, used to acquire a three-dimensional transformation matrix corresponding to the two-dimensional transformation matrix;
第二获取单元,用于根据所述三维转换矩阵和所述第一位姿信息,获取目标位姿信息;A second acquisition unit, used for acquiring target posture information according to the three-dimensional transformation matrix and the first posture information;
输出单元,用于输出与所述目标位姿信息对应的提示信息;An output unit, used to output prompt information corresponding to the target posture information;
第三获取单元,用于获取与第二位姿信息对应的第二图像;A third acquisition unit, used to acquire a second image corresponding to the second posture information;
第四获取单元,用于在所述第二图像包括所述目标对象的情况下,获取所述第二图像中所述目标对象对应的第二区域信息;a fourth acquisition unit, configured to acquire second region information corresponding to the target object in the second image when the second image includes the target object;
生成单元,用于在所述目标区域信息和所述第二区域信息匹配的情况下,执行拍照操作,生成目标图像。A generating unit is used to perform a photographing operation to generate a target image when the target area information matches the second area information.
在一些实施例中,所述生成子模块包括:In some embodiments, the generating submodule includes:
调整单元,用于根据所述二维转换矩阵调整所述第一区域,调整后的所述第一区域中的目标对象的比例信息与所述目标比例信息相同;An adjusting unit, configured to adjust the first region according to the two-dimensional conversion matrix, wherein the proportion information of the target object in the adjusted first region is the same as the target proportion information;
保存单元,用于保存调整后的所述第一图像;A saving unit, used for saving the adjusted first image;
其中,所述目标图像为调整后的所述第一图像。The target image is the adjusted first image.
在一些实施例中,所述目标对象包括Q个部位;所述第一区域包括与所述Q个部位一一对应的Q个第一子区域;所述第一区域信息包括:所述Q个第一子区域的锚点信息,以及所述第一区域中各子区域相对所述第一区域的占比,Q为大于1的整数;In some embodiments, the target object includes Q parts; the first region includes Q first sub-regions corresponding to the Q parts one by one; the first region information includes: anchor point information of the Q first sub-regions, and a proportion of each sub-region in the first region relative to the first region, where Q is an integer greater than 1;
所述确定模块包括:The determination module comprises:
第一确定单元,用于确定所述第一区域的参考线,以及所述目标对象的参考部位;A first determining unit, configured to determine a reference line of the first area and a reference part of the target object;
第二确定单元,用于根据所述参考部位对应的第一子区域、所述参考线和所述目标比例信息,确定与剩余Q-1个部位一一对应的Q-1个第二子区域,得到目标区域,所述目标区域包括所述参考部位对应的第一子区域和所述Q-1个第二子区域;A second determining unit is used to determine Q-1 second sub-regions corresponding to the remaining Q-1 parts one by one according to the first sub-region corresponding to the reference part, the reference line and the target ratio information, to obtain a target region, wherein the target region includes the first sub-region corresponding to the reference part and the Q-1 second sub-regions;
第五获取单元,用于获取目标区域信息,所述目标区域信息为所述目标区域的相关信息,包括:所述参考部位对应的第一子区域的锚点信息,所述Q-1个第二子区域的锚点信息,以及所述目标区域中各子区域相对所述目标区域的占比,其中,所述目标区域中各子区域相对所述目标区域的占比与所述目标比例信息匹配。The fifth acquisition unit is used to acquire target area information, which is relevant information of the target area, including: anchor point information of the first sub-area corresponding to the reference part, anchor point information of the Q-1 second sub-areas, and the proportion of each sub-area in the target area relative to the target area, wherein the proportion of each sub-area in the target area relative to the target area matches the target proportion information.
本申请实施例中的图像生成装置可以是装置,也可以是终端中的部件、集成电路、或芯片。该装置可以是移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personaldigital assistant,PDA)等,非移动电子设备可以为服务器、网络附属存储器(NetworkAttached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。The image generation device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
本申请实施例中的图像生成300装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The image generation device 300 in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
本申请实施例提供的图像生成装置能够实现图1的方法实施例中的各个过程,为避免重复,这里不再赘述。The image generation device provided in the embodiment of the present application can implement each process in the method embodiment of Figure 1. To avoid repetition, it will not be described again here.
可选的,如图4所示,本申请实施例还提供一种电子设备400,包括处理器401,存储器402,存储在存储器402上并可在所述处理器401上运行的程序或指令,该程序或指令被处理器401执行时实现上述图像生成方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, as shown in Figure 4, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a program or instruction stored in the memory 402 and executable on the processor 401. When the program or instruction is executed by the processor 401, each process of the above-mentioned image generation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
图5为实现本申请实施例的一种电子设备的硬件结构示意图。FIG5 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
该电子设备500包括但不限于:射频单元501、网络模块502、音频输出单元503、输入单元504、传感器505、显示单元506、用户输入单元507、接口单元508、存储器509、以及处理器510等部件。The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.
本领域技术人员可以理解,电子设备500还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器150逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图5中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 150 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The electronic device structure shown in FIG5 does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange components differently, which will not be described in detail here.
其中,处理器510,用于:The processor 510 is used for:
获取与第一位姿信息对应的第一图像;Acquire a first image corresponding to the first pose information;
在所述第一图像包括目标对象的情况下,获取所述第一图像中所述目标对象对应的第一区域信息;In a case where the first image includes a target object, obtaining first region information corresponding to the target object in the first image;
根据所述第一区域信息,以及所述目标对象对应的目标比例信息,确定所述目标对象对应的目标区域信息;Determining target area information corresponding to the target object according to the first area information and target ratio information corresponding to the target object;
根据所述目标区域信息,生成目标图像,其中,所述目标图像中的所述目标对象的比例信息与所述目标比例信息匹配。A target image is generated according to the target area information, wherein the scale information of the target object in the target image matches the target scale information.
本申请实施例提供的电子设备置能够实现图1的方法实施例中的各个过程,为避免重复,这里不再赘述。The electronic device provided in the embodiment of the present application is capable of implementing each process in the method embodiment of FIG. 1 , and will not be described again here to avoid repetition.
应理解的是,本申请实施例中,输入单元504可以包括图形处理器(GraphicsProcessing Unit,GPU)5041和麦克风5042,图形处理器5041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元506可包括显示面板5061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板5061。用户输入单元507包括触控面板5071以及其他输入设备5072。触控面板5071,也称为触摸屏。触控面板5071可包括触摸检测装置和触摸控制器两个部分。其他输入设备5072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。存储器509可用于存储软件程序以及各种数据,包括但不限于应用程序和操作系统。处理器510可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器510中。It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 509 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 510 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 510.
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述图像生成方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned image generation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述图像生成方法实施例的各个过程,且能达到相同的技术效果,为避免重复,不再赘述。An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210604484.5ACN114885101B (en) | 2022-05-31 | 2022-05-31 | Image generation method and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210604484.5ACN114885101B (en) | 2022-05-31 | 2022-05-31 | Image generation method and device |
| Publication Number | Publication Date |
|---|---|
| CN114885101A CN114885101A (en) | 2022-08-09 |
| CN114885101Btrue CN114885101B (en) | 2024-06-28 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210604484.5AActiveCN114885101B (en) | 2022-05-31 | 2022-05-31 | Image generation method and device |
| Country | Link |
|---|---|
| CN (1) | CN114885101B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109658355A (en)* | 2018-12-19 | 2019-04-19 | 维沃移动通信有限公司 | A kind of image processing method and device |
| CN109729257A (en)* | 2017-10-31 | 2019-05-07 | 华为终端(东莞)有限公司 | One kind is taken pictures reminding method and equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP6160292B2 (en)* | 2013-06-24 | 2017-07-12 | 富士通株式会社 | Image correction apparatus, imaging apparatus, and computer program for image correction |
| CN107395965B (en)* | 2017-07-14 | 2019-11-29 | 维沃移动通信有限公司 | A kind of image processing method and mobile terminal |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109729257A (en)* | 2017-10-31 | 2019-05-07 | 华为终端(东莞)有限公司 | One kind is taken pictures reminding method and equipment |
| CN109658355A (en)* | 2018-12-19 | 2019-04-19 | 维沃移动通信有限公司 | A kind of image processing method and device |
| Publication number | Publication date |
|---|---|
| CN114885101A (en) | 2022-08-09 |
| Publication | Publication Date | Title |
|---|---|---|
| CN110012209B (en) | Panoramic image generation method, device, storage medium and electronic device | |
| CN112954210B (en) | Photographing method and device, electronic equipment and medium | |
| US10915998B2 (en) | Image processing method and device | |
| CN105847674A (en) | Preview image processing method based on mobile terminal, and mobile terminal therein | |
| US12412344B2 (en) | Image processing method, mobile terminal, and storage medium | |
| CN112714253B (en) | Video recording method and device, electronic equipment and readable storage medium | |
| CN108495032A (en) | Image processing method, device, storage medium and electronic equipment | |
| CN112954199A (en) | Video recording method and device | |
| CN112492201B (en) | Photographing method, device and electronic device | |
| CN112437232A (en) | Shooting method, shooting device, electronic equipment and readable storage medium | |
| US20250150705A1 (en) | Image processing method and apparatus, electronic device, and storage medium | |
| CN113840070A (en) | Shooting method, shooting device, electronic equipment and medium | |
| CN112887601B (en) | Shooting method and device and electronic equipment | |
| CN114241127B (en) | Panoramic image generation method, device, electronic device and medium | |
| CN112383708B (en) | Shooting method and device, electronic equipment and readable storage medium | |
| CN113873160B (en) | Image processing method, device, electronic equipment and computer storage medium | |
| CN115643485B (en) | Photography methods and electronic equipment | |
| CN112367487B (en) | Video recording method and electronic equipment | |
| CN112788244B (en) | Shooting method, shooting device and electronic equipment | |
| CN112511743B (en) | Video shooting method and device | |
| CN114125226A (en) | Image capturing method, apparatus, electronic device and readable storage medium | |
| CN114885101B (en) | Image generation method and device | |
| CN112165584A (en) | Video recording method, device, electronic device and readable storage medium | |
| CN114339051B (en) | Shooting method, shooting device, electronic equipment and readable storage medium | |
| CN114638817A (en) | Image segmentation method and device, electronic equipment and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |