WO2023051432A1 - 图像编辑方法及装置 - Google Patents

图像编辑方法及装置 Download PDF

Info

Publication number
WO2023051432A1
WO2023051432A1 PCT/CN2022/121192 CN2022121192W WO2023051432A1 WO 2023051432 A1 WO2023051432 A1 WO 2023051432A1 CN 2022121192 W CN2022121192 W CN 2022121192W WO 2023051432 A1 WO2023051432 A1 WO 2023051432A1
Authority
WO
WIPO (PCT)
Prior art keywords
editing
layer
image
editing object
original
Prior art date
Application number
PCT/CN2022/121192
Other languages
English (en)
French (fr)
Inventor
张兴华
蔡志锐
Original Assignee
北京字跳网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Priority to EP22874818.2A priority Critical patent/EP4390851A1/en
Publication of WO2023051432A1 publication Critical patent/WO2023051432A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Definitions

  • the present application relates to the technical field of image processing, in particular to an image editing method and device.
  • a multi-object editing method in the related art is: divide the original image into several regions according to the regions where the objects to be edited are located in the original image, and then edit the regions corresponding to each object to be edited on the original image one by one .
  • this multi-object editing method in the related art is to edit on the original image, it is necessary to return to the original image when re-editing an object, and to fully render the editing effects of other edited objects , so this multi-object editing method in the related art will have a huge performance overhead when re-editing the objects in the image.
  • the objects that need to be edited in the original image include: the first object and the second object, the user first edits the first object on the original image to generate the first intermediate image, and then edits the second object on the first intermediate image Editing produces a second intermediate image.
  • the user is dissatisfied with the editing effect of the first object in the second intermediate image and wants to edit the first object again, since an intermediate image with only the editing effect of the second editing object is not generated during the editing process, The user needs to re-edit the first object on the original image to generate a third intermediate image, and render the editing effect of the second edited object on the third intermediate image to obtain the final target image.
  • the number of objects that need to be edited in the image increases, the number of objects that need to be rendered with editing effects will also increase when re-editing the objects in the image, which will lead to continuous performance overhead when re-editing the objects in the image increase.
  • the present application provides an image editing method and device, which are used to solve the problem of huge performance overhead when re-editing objects in an image during the multi-object editing process.
  • an embodiment of the present application provides an image editing method, including:
  • the original image including a first editing object and a second editing object, the first editing object and the second editing object being located in different image areas of the original image;
  • the image data renders the layer corresponding to the second editing object to generate a second original layer corresponding to the second editing object.
  • the extracting the image data corresponding to the first editing object and the image data corresponding to the second editing object from the original image respectively includes:
  • the extracting the image data corresponding to the first editing object and the image data corresponding to the second editing object from the original image respectively includes:
  • the first editing layer and the second editing image Layers are overlaid on the original image in any order to generate the target image.
  • the method before setting the transparency of the edge area of the first editing layer and the edge area of the second editing layer to a preset transparency, the method further includes:
  • the contraction area is an area where the area corresponding to the editing object is changed to the edge area after editing
  • an image editing device including:
  • an acquiring unit configured to acquire an original image, the original image including a first editing object and a second editing object, the first editing object and the second editing object being located in different image areas of the original image;
  • a generation unit configured to render the first editing object and the second editing object to different layers, generate the first original layer corresponding to the first editing object and the first original layer corresponding to the second editing object second original layer;
  • an editing unit configured to, in response to a first editing operation on the first editing object, render an editing result of the first editing object under the first editing operation based on the first original layer, generating a first editing layer corresponding to the first editing object, and, in response to a second editing operation on the second editing object, based on the second original layer, making the second editing object in the rendering the editing result under the second editing operation, and generating a second editing layer corresponding to the second editing object;
  • a processing unit configured to generate a target image as an editing result of the original image according to the first editing layer and the second editing layer.
  • the embodiment of the present application provides an electronic device, including: a memory and a processor, the memory is used to store a computer program; the processor is used to make the electronic device realize the first step when calling the computer program.
  • a memory and a processor the memory is used to store a computer program
  • the processor is used to make the electronic device realize the first step when calling the computer program.
  • an embodiment of the present application provides a computer-readable storage medium, when the computer program is executed by a computing device, the computing device is enabled to implement the image editing method described in the first aspect or any implementation mode of the first aspect .
  • the embodiment of the present application provides a computer program product, which enables the computer to implement the image editing method described in the first aspect or any implementation manner of the first aspect when the computer program product is run on a computer.
  • the image editing method provided by the embodiment of the present application first acquires the original image including the first editing object and the second editing object, and then renders the first editing object and the second editing object to different layers to generate the first original layer and a second original layer, and then in response to the first editing operation on the first editing object, based on the first original layer, rendering the editing result of the first editing object under the first editing operation , generating a first editing layer corresponding to the first editing object, and, in response to a second editing operation on the second editing object, based on the second original layer, making the second editing object in the Render the editing result under the second editing operation, generate a second editing layer corresponding to the second editing object, and finally generate a target image according to the first editing layer and the second editing layer and use it as the to describe the editing results of the original image.
  • the embodiment of the present application can solve the problem of huge performance overhead when re-editing objects in the image during the multi-object editing process.
  • Fig. 1 is one of the flow charts of the steps of the image editing method provided by the embodiment of the present application;
  • Fig. 2 is one of the scene interface diagrams of the image editing method provided by the embodiment of the present application.
  • words such as “exemplary” or “for example” are used as examples, illustrations or illustrations. Any embodiment or design scheme described as “exemplary” or “for example” in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Rather, the use of words such as “exemplary” or “such as” is intended to present related concepts in a concrete manner.
  • the meaning of "plurality” refers to two or more.
  • S102 Render the first editing object and the second editing object to different layers respectively, and generate a first original layer corresponding to the first editing object and a second original layer corresponding to the second editing object layers.
  • the shrinking area is an area where the area corresponding to the editing object is changed into the edge area after editing according to the editing operation corresponding to the editing object.
  • the transparency of the contracted area will not be set to the preset transparency.
  • the edited layer obtained after editing the original layer corresponding to the edited object B according to the editing operation corresponding to the edited object B is shown in (a) in FIG. 9
  • the edited layer The region corresponding to the editing object is region 91 as shown in (b) in FIG. 9
  • the edge region is region 92 as shown in (b) in FIG. 9 , so the transparency of region 92 is set to a preset transparency.
  • step S512 if the area corresponding to the editing object of the first editing layer does not overlap with the area corresponding to the editing object of the second editing layer, the following step S512 is performed.
  • step S51 if the area corresponding to the editing object of the first editing layer overlaps with the area corresponding to the editing object of the second editing layer, the following steps S513 and S514 are performed.
  • the depth of the edited object in this embodiment of the present application may refer to: a scene depth value of the edited object. Since the scene depth values at various positions of the editing object may also have some differences, it is possible to obtain the scene depth values of all pixels corresponding to the editing object, and obtain the average value of the scene depth values of each pixel point as the depth of the editing object.
  • the above embodiment can make the occlusion relationship between the editing objects in the target image conform to the actual situation observed by human eyes, thereby avoiding editing the occlusion relationship between the editing objects in the target image abnormal.
  • step S503 (respectively extracting image data corresponding to the first editing object and image data corresponding to the second editing object from the original image) is implemented as follows: determine from the original image The outline of the first editing object and the outline of the second editing object; determining the first image corresponding to the first editing object according to the outline of the first editing object and the outline of the second editing object respectively The data extraction area and the second image data extraction area corresponding to the second editing object; the outline of the first editing object is located in the first image data extraction area, and the outline of the second editing object is located in the second Image data extraction area; extract the image data in the first image data extraction area, obtain the image data corresponding to the first editing object, and extract the image data in the second image data extraction area, and obtain the image data corresponding to the second editing object
  • the image editing method also includes:
  • the embodiment of the present application also provides an image editing device.
  • the details in the examples are described one by one, but it should be clear that the image editing device in this embodiment can correspondingly implement all the content in the foregoing method embodiments.
  • FIG. 10 is a schematic structural diagram of the image editing device. As shown in FIG. 10 , the image editing device 100 includes:
  • An acquiring unit 101 configured to acquire an original image, the original image includes a first editing object and a second editing object, the first editing object and the second editing object are located in different image areas of the original image;
  • a generating unit 102 configured to render the first editing object and the second editing object to different layers, and generate a first original layer corresponding to the first editing object and a layer corresponding to the second editing object.
  • the editing unit 103 is configured to, in response to a first editing operation on the first editing object, render an editing result of the first editing object under the first editing operation based on the first original layer , generating a first editing layer corresponding to the first editing object, and, in response to a second editing operation on the second editing object, based on the second original layer, making the second editing object in the rendering the editing result under the second editing operation, and generating a second editing layer corresponding to the second editing object;
  • the processing unit 104 is configured to generate a target image as an editing result of the original image according to the first editing layer and the second editing layer.
  • the generation unit 102 is specifically configured to create layers corresponding to the first editing object and the second editing object; respectively extract layers corresponding to the first editing object from the original image.
  • the generation unit 102 is specifically configured to determine the outline of the first editing object and the outline of the second editing object from the original image; extract the outline of the first editing object The image data corresponding to the first editing object is acquired, and the image data corresponding to the second editing object is extracted by extracting the image data corresponding to the second editing object.
  • the generating unit 102 is specifically configured to determine the contour of the first editing object and the contour of the second editing object from the original image; respectively according to the contour of the first editing object and the outline of the second editing object, determine the first image data extraction area corresponding to the first editing object and the second image data extraction area corresponding to the second editing object; the outline of the first editing object is located In the first image data extraction area, the outline of the second editing object is located in the second image data extraction area; image data in the first image data extraction area is extracted, and image data corresponding to the first editing object is acquired , and extract the image data in the second image data extraction area, and acquire the image data corresponding to the second editing object.
  • the processing unit 104 is further configured to process the edge of the first editing object in the first original layer and/or the second original layer based on a preset smoothing algorithm. smoothing the edges of the second editing object in .
  • the processing unit 104 is specifically configured to set the transparency of the edge area of the first editing layer and the edge area of the second editing layer to a preset transparency; the edge area is Editing the area in the layer other than the area corresponding to the editing object; respectively covering the first editing layer and the second editing layer on the original image to generate the target image;
  • the processing unit 104 is specifically configured to determine whether the area corresponding to the editing object of the first editing layer overlaps with the area corresponding to the editing object of the second editing layer; if If the area corresponding to the editing object of the first editing layer does not overlap with the area corresponding to the editing object of the second editing layer, then the first editing layer and the second editing layer are arranged according to any Sequentially overlay on the original image to generate the target image.
  • the processing unit 104 is specifically configured to obtain the The depth of the first editing object and the depth of the second editing object; the first editing layer and the second editing layer are sequentially overlaid on the original image in order of depth from large to small, Generate the target image.
  • the image editing device provided in this embodiment can execute the image editing method provided in the above method embodiment, and its implementation principle and technical effect are similar, and will not be repeated here.
  • FIG. 11 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device provided by this embodiment includes: a memory 111 and a processor 112, and the memory 111 is used to store computer programs; the processing The device 112 is configured to execute the image editing method provided by the above-mentioned embodiments when calling a computer program.
  • an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computing device implements the above-mentioned embodiment.
  • Image editing method
  • an embodiment of the present application also provides a computer program product, which enables the computing device to implement the image editing method provided in the foregoing embodiments when the computer program product is run on a computer.
  • the processor can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM.
  • RAM random access memory
  • ROM read only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both volatile and non-volatile, removable and non-removable storage media.
  • the storage medium may store information by any method or technology, and the information may be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, A magnetic tape cartridge, disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer readable media excludes transitory computer readable media, such as modulated data signals and carrier waves.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

一种图像编辑方法及装置,包括:获取原始图像,原始图像包括第一和第二编辑对象,第一和第二编辑对象位于原始图像的不同图像区域;将第一和第二编辑对象分别渲染到不同的图层,生成第一原始图层和第二原始图层;响应于针对第一编辑对象的第一编辑操作,基于第一原始图层对第一编辑对象在第一编辑操作下的编辑结果进行渲染,生成第一编辑图层,响应于针对第二编辑对象的第二编辑操作,基于第二原始图层对第二编辑对象在第二编辑操作下的编辑结果进行渲染,生成第二编辑图层;根据第一和第二编辑图层,生成目标图像。

Description

图像编辑方法及装置
本申请要求于2021年09月30日提交的,申请名称为“一种图像编辑方法及装置”的、中国专利申请号为“202111165882.3”的优先权,该中国专利申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,尤其涉及一种图像编辑方法及装置。
背景技术
在进行图像编辑的时候,经常会有对同一张图像中的多个对象进行编辑的需求。例如:在对多人合影的照片进行编辑时,经常会有分别对照片中的不同人脸进行不同编辑的需求。
相关技术中的一种多对象编辑方法为:按照原始图像中需要编辑的对象所在的区域将原始图像划分为若干个区域,然后在原始图像上逐一对每一个需要编辑的对象对应的区域进行编辑。然而,由于相关技术中这种多对象编辑方法是在原始图像上进行编辑,因此在对某一对象进行重新编辑时需要返回到原始图像上进行,并对其它已编辑对象的编辑效果作全量渲染,因此相关技术中的这种多对象编辑方法在对图像中的对象进行重新编辑时会有极大的性能开销。例如:原始图像中需要编辑的对象包括:第一对象和第二对象,用户首先在原始图像上对第一对象进行编辑生成了第一中间图像,然后又在第一中间图像上对第二对象进行编辑生成了第二中间图像。当用户对第二中间图像中的第一对象的编辑效果不满意,想要重新对第一对象进行编辑时,由于编辑过程中并未生成仅具有第二编辑对象的编辑效果的中间图像,因此用户需要在原始图像上重新对第一对象进行编辑生成第三中间图像,并在第三中间图像上对第二编辑对象的编辑效果进行渲染,以得到最终的目标图像。随着图像中需要编辑的对象的增多,在对图像中的对象进行重新编辑时需要进行编辑效果渲染的对象也会响应增多,进而导致对图像中的对象进行重新编辑时的性能开销也会不断增大。
发明内容
有鉴于此,本申请提供了一种图像编辑方法及装置,用于解决多对象编辑过程中,在对图像中的对象进行重新编辑时会有极大的性能开销的问题。
为了实现上述目的,本申请实施例提供技术方案如下:
第一方面,本申请的实施例提供了一种图像编辑方法,包括:
获取原始图像,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域;
将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编 辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层;
响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层;
根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
在一些实施方式中,所述将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层,包括:
创建所述第一编辑对象和所述第二编辑对象分别对应的图层;
从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据;
根据所述第一编辑对象对应的图像数据对所述第一编辑对象对应的图层进行渲染,生成所述第一编辑对象对应的第一原始图层,以及根据所述第二编辑对象对应的图像数据对所述第二编辑对象对应的图层进行渲染,生成所述第二编辑对象对应的第二原始图层。
在一些实施方式中,所述从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据,包括:
从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;
提取所述第一编辑对象的轮廓内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取所述第二编辑对象的轮廓内的图像数据,获取所述第二编辑对象对应的图像数据。
在一些实施方式中,所述从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据,包括:
从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;
分别根据所述第一编辑对象的轮廓和所述第二编辑对象的轮廓,确定所述第一编辑对象对应的第一图像数据提取区域和所述第二编辑对象对应的第二图像数据提取区域;所述第一编辑对象的轮廓位于所述第一图像数据提取区域,所述第二编辑对象的轮廓位于所述第二图像数据提取区域;
提取第一图像数据提取区域内的图像数据,获取所述第一编辑对象对应的图像数 据,以及提取第二图像数据提取区域内的图像数据,获取所述第二编辑对象对应的图像数据。
在一些实施方式中,所述方法还包括:
基于预设平滑处理算法对所述第一原始图层中的所述第一编辑对象的边缘和/或的所述第二原始图层中的所述第二编辑对象的边缘作平滑处理。
在一些实施方式中,所述根据所述第一编辑图层和所述第二编辑图层,生成目标图像,包括:
将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度;所述边缘区域为编辑图层中除编辑对象对应的区域以外的区域;
分别将所述第一编辑图层和所述第二编辑图层覆盖于所述原始图像上,生成所述目标图像。
在一些实施方式中,所述分别将所述第一编辑图层和所述第二编辑图层覆盖于所述原始图像上,生成所述目标图像,包括:
判断所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域是否具有交叠;
若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域是否不具有交叠,则将所述第一编辑图层和所述第二编辑图层按照任意顺序覆盖于所述原始图像上,生成所述目标图像。
在一些实施方式中,
若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域具有交叠,则获取所述第一编辑对象的深度和所述第二编辑对象的深度;
将所述第一编辑图层和所述第二编辑图层按照深度由大到小的顺序依次覆盖于所述原始图像上,生成所述目标图像。
在一些实施方式中,在将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度之前,所述方法还包括:
判断所述第一编辑图层和所述第二编辑图层中是否包含收缩区域,所述收缩区域为编辑后由所述编辑对象对应的区域变化为所述边缘区域的区域;
若是,则对所述收缩区域进行边缘过渡填充,并将所述收缩区域设置为所述编辑对象对应的区域。
第二方面,本申请的实施例提供了图像编辑装置,包括:
获取单元,用于获取原始图像,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域;
生成单元,用于将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层;
编辑单元,用于响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层;
处理单元,用于根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
本申请第三方面,本申请实施例提供一种电子设备,包括:存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于在调用计算机程序时,使得所述电子设备实现第一方面或第一方面任一实施方式所述的图像编辑方法。
第四方面,本申请实施例提供一种计算机可读存储介质,当所述计算机程序被计算设备执行时,使得所述计算设备实现第一方面或第一方面任实施方式所述的图像编辑方法。
第五方面,本申请实施例提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机实现第一方面或第一方面任一实施方式所述的图像编辑方法。
本申请实施例提供的图像编辑方法首先获取包括第一编辑对象和第二编辑对象的原始图像,然后将第一编辑对象和第二编辑对象分别渲染到不同的图层,生成第一原始图层和第二原始图层,再响应于针对第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层,最后根据所述第一编辑图层和所述第二编辑图层,生成目标图像并作为所述原始图像的编辑结果。由于本申请实施例中的第一原始图层与第二原始图层之间相互独立,且对第一编辑操作是在第一原始图层上执行的,第二编辑操作是在第二原始图层上执行的,因此对图像中的第一编辑对象或第二编辑对象进行重新编辑时,只需要对第一原始图层或第二原始图层重新进行编辑并渲染即可,无需对原始图像中的全部编辑对象进行重新渲染,因此本申请实施例可以解决多对象编辑过程中,在对图像中的对象进行重新编辑时会有极大的性能开销的问题。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的图像编辑方法的步骤流程图之一;
图2为本申请实施例提供的图像编辑方法的场景界面图之一;
图3为本申请实施例提供的图像编辑方法的场景界面图之二;
图4为本申请实施例提供的图像编辑方法的编辑图层的示意图;
图5为本申请实施例提供的图像编辑方法的步骤流程图之二;
图6为本申请实施例提供的编辑对象的示意图之一;
图7为本申请实施例提供的编辑对象的示意图之二;
图8为本申请实施例提供的收缩区域的示意图;
图9为本申请实施例提供的边缘区域的示意图;
图10为本申请实施例提供的图像编辑装置的示意图;
图11为本申请实施例提供的电子设备的硬件结构示意图。
具体实施方式
为了能够更清楚地理解本申请的上述目的、特征和优点,下面将对本申请的方案进行进一步描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本申请,但本申请还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本申请的一部分实施例,而不是全部的实施例。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。此外,在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。
本申请实施例提供了一种图像编辑方法,参照图1所示,该图像编辑方法包括如下步骤:
S101、获取原始图像。
其中,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域。
需要说明的是,本申请实施例中的编辑对象(第一编辑对象和第二编辑对象)可以为原始图像中的任意元素。例如:编辑对象可以为人脸、大树、草地、天空等,本申请实施例对此不做限定。
本申请实施例中的编辑对象可以由图像识别算法自动获取。示例性的,参照图2所示,可以基于人脸识别算法自动识别原始图像20中的第一人脸21和第二人脸22,并将识别出的第一人脸21和第二人脸22确定为编辑对象。
本申请实施例中的编辑对象,也可以由用户根据编辑需求选取。示例性的,参照图3所示,当显示原始图像30并接收用户到对待编辑人脸31的选取操作或者编辑操作时,响应于用户的选取操作或者编辑操作将待编辑人脸31确定为编辑对象。
S102、将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层。
在一些实施例中,第一原始图层、第二原始图层的大小和形状可以与原始图像的大小和形状相同。
示例性的,参照图4所示,承图2对应的示例中的编辑对象所示,第一人脸21对应的原始图层可以如图4中(a)所示的原始图层41,第二人脸21对应的原始图层可以如图4中(b)所示的原始图层42。
S103、响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层。
S104、响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层。
需要说明的是,本申请实施例不限定上述步骤S103和S104的执行顺序,可以先执行S103,再执行S104,也可以先执行S104,再执行S103,还可以S103和S104同步执行。
进一步的,各第一编辑操作和第二编辑操作可以由用户输入,也可以基于美颜算法、特效添加算法等自动确定。
在一些实施方式中,可以将第一原始图层和第二原始图层叠加显示于原始图像上,并在用户对某一原始图层进行编辑时,将该原始图层置于顶层,从而使用户在对多个编辑对象进行编辑时,不会感知各编辑对象对应的原始图层的存在,进而提升用户的编辑 体验。
S105、根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
本申请实施例提供的图像编辑方法首先获取包括第一编辑对象和第二编辑对象的原始图像,然后将第一编辑对象和第二编辑对象分别渲染到不同的图层,生成第一原始图层和第二原始图层,再响应于针对第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层,最后根据所述第一编辑图层和所述第二编辑图层,生成目标图像并作为所述原始图像的编辑结果。由于本申请实施例中的第一原始图层与第二原始图层之间相互独立,且对第一编辑操作是在第一原始图层上执行的,第二编辑操作是在第二原始图层上执行的,因此对图像中的第一编辑对象或第二编辑对象进行重新编辑时,只需要对第一原始图层或第二原始图层重新进行编辑并渲染即可,无需对原始图像中的全部编辑对象进行重新渲染,因此本申请实施例可以解决多对象编辑过程中,在对图像中的对象进行重新编辑时会有极大的性能开销的问题。
需要说明的是,上述实施例中以对原始图像中的两个编辑对象(第一编辑对象和第二编辑对象)进行编辑为例对进行说明,但本申请实施例并不限定于仅能够对原始图像中的两个编辑对象进行编辑,在上述实施例的基础上本申请实施例提供的图像编辑方法还可以对原始图像中其它数量的编辑对象进行编辑。当对原始图像中其它数量的编辑对象进行编辑时,各个对编辑对象所执行的操作与上述实施例中的第一编辑对象和第二编辑对象所执行的操作类似,在此不再赘述。
作为对上述实施例的扩展和细化,本申请实施例提供了另一种图像编辑方法,参照图5所示,该图像编辑方法包括如下步骤:
S501、获取原始图像。
其中,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域。
S502、创建所述第一编辑对象和所述第二编辑对象分别对应的图层。
即,分别针对所述第一编辑对象和所述第二编辑对象创建一个对应的空白图层。
在一些实施例中,上述步骤S502的实现方式可以包括:在编辑开始时,接收用户对原始图像中的所述第一编辑对象和所述第二编辑对象的选择输入,响应于用户的选择输入为所述第一编辑对象和所述第二编辑对象创建对应的图层。
在一些实施例中,上述步骤S502的实现方式可以包括:接收用户对所述第一编辑对象和所述第二编辑对象的编辑操作时,响应于用户的编辑操作为所述第一编辑对象和所述第二编辑对象创建对应的图层。
S503、从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据。
在一些实施方式中,上述步骤S503的实现方式可以包括如下步骤a和步骤c:
步骤a、从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓。
具体的,可以基于直方图门限法、区域生长法、随机场模型法、松弛标记区域分割法、局部图像函数法、图像滤波法等图像分割算法确定所述原始图像中各编辑对象的轮廓。
步骤b、提取所述第一编辑对象的轮廓内的图像数据,获取所述第一编辑对象对应的图像数据。
步骤c、提取所述第二编辑对象的轮廓内的图像数据,获取所述第二编辑对象对应的图像数据。
示例性的,参照图6所示,一个编辑对象的轮廓如图6中61所示(图6中以加粗实现表示),因此提取轮廓61内的图像数据作为该编辑对像对应的图像数据。根据该编辑对像对应的图像数据进行图像渲染,得到的图像可以如图6中的62所示,
在一些实施方式中,上述步骤S503的实现方式可以包括如下步骤Ⅰ至步骤Ⅴ:
步骤Ⅰ、从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓。
同样,可以基于直方图门限法、区域生长法、随机场模型法、松弛标记区域分割法、局部图像函数法、图像滤波法等图像分割算法确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓。
步骤Ⅱ、根据所述第一编辑对象的轮廓确定所述第一编辑对象对应的第一图像数据提取区域。
其中,所述第一编辑对象的轮廓位于所述第一图像数据提取区域内。
步骤Ⅲ、根据所述第二编辑对象的轮廓确定所述第二编辑对象对应的第二图像数据提取区域。
其中,所述第一编辑对象的轮廓位于所述第一图像数据提取区域内。
在一些实施例中,任一编辑对象对应的图像数据提取区域的边缘上的各个点到该编辑对象的轮廓的最小距离均为预设距离。
示例性的,预设距离可以为N个像素点的距离,N为正整数。
示例性的,参照图7所示,编辑对象的轮廓如图7中71所示,根据编辑对象的轮廓71在原始图像中确定的编辑对象对应的图像数据提取区域如图7中72所示,由于编辑对象的轮廓71位于编辑对象对应的图像数据提取区域72内,因此根据提取的编辑对象对应的图像数据渲染得到的图像如图7中73所示,略大于实际的编辑对象。
步骤Ⅳ、提取第一图像数据提取区域内的图像数据,获取所述第一编辑对象对应的图像数据。
步骤Ⅴ、提取第二图像数据提取区域内的图像数据,获取所述第二编辑对象对应的图像数据。
上述实施例中提取的编辑对象比实际的编辑对象域略大一些,因此在对各个编辑对象进行编辑后,可以基于羽化等平滑处理算法对编辑对象的边缘进行平滑处理,而不会影响实际的编辑对象,进而在合成最终效果图时提升边界区域的融合的效果,提升图像的处理效果。
S504、根据所述第一编辑对象对应的图像数据对所述第一编辑对象对应的图层进行渲染,生成所述第一编辑对象对应的第一原始图层。
S505、根据所述第二编辑对象对应的图像数据对所述第二编辑对象对应的图层进行渲染,生成所述第二编辑对象对应的第二原始图层。
S506、响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层。
S507、响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层。
S508、判断所述第一编辑图层和所述第二编辑图层中是否包含收缩区域。
其中,所述收缩区域为根据编辑对象对应的编辑操作进行编辑后由所述编辑对象对应的区域变化为所述边缘区域的区域。
示例性的,参照图8所示,根据编辑对象对应的编辑操作进行编辑前,编辑对象A的轮廓如图8中81所示,编辑对象A对应的区域为编辑对象A的轮廓81内的所有区域,根据编辑对象对应的编辑操作进行编辑后,编辑对象A的轮廓如图8中82所示,边缘区域包括编辑后的编辑对象A的轮廓82外的所有区域,根据编辑对象对应的编辑操作进行编辑后,环状区域83由所述编辑对象对应的区域变化为所述边缘区域,因此环状区域83为编辑图层中的收缩区域。
在上述步骤S508中,若确定第一编辑图层和/或第二编辑图层中包含收缩区域,则对收缩区域执行如下步骤S509。
S509、对所述收缩区域进行边缘过渡填充,并将所述收缩区域设置为所述编辑对象对应的区域。
本上述实施例对所述收缩区域进行边缘过渡填充,并将所述收缩区域设置为所述编辑对象对应的区域,因此可以避免编辑后的编辑对象无法完全遮挡原始图像中的原始编辑对象,进而避免图像编辑异常。
S510、将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度。
其中,所述编辑图层的边缘区域为所述编辑图层中除编辑对象对应的区域以外的区域。
在一些实施例中,预设透明度可以为100%。
由于上述步骤S510中将收缩区域设置为所述编辑对象对应的区域,因此收缩区域透明度不会被设置为预设透明度。
示例性的,参照图9所示,根据编辑对象B对应的编辑操作对编辑对象B对应的原始图层进行编辑后得到的编辑图层如图9中(a)所示,则编辑图层中编辑对象对应的区域如图9中(b)所示的区域91,边缘区域如图9中(b)所示的区域92,因此将区域92的透明度设置为预设透明度。
S511、判断所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域是否具有交叠。
即,判断对各编辑对象进行编辑后,各编辑对象对应的区域是否具有交叠。
在上述步骤S511中,若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域不具有交叠,则执行如下步骤S512。
S512、将所述第一编辑图层和所述第二编辑图层按照任意顺序逐一覆盖于所述原始图像上,生成所述目标图像。
示例性的,可以按照编辑顺序依次将各编辑图层覆盖于所述原始图像上,生成所述目标图像。
在上述步骤S511中,若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域具有交叠,则执行如下步骤S513和S514。
S513、获取所述第一编辑对象的深度和所述第二编辑对象的深度。
具体的,本申请实施例中编辑对象的深度可以指:编辑对象的场景深度值。由于编辑对象各个位置的场景深度值可能也会有一些差异,因此可以获取编辑对象对应的所有 像素点的场景深度值,并获取各个像素点的场景深度值的平均值作为编辑对象的深度。
S514、将所述第一编辑图层和所述第二编辑图层按照深度由大到小的顺序依次覆盖于所述原始图像上,生成所述目标图像。
即,先叠加深度较大的编辑对象对应的编辑图层,再叠加深度较小的编辑对象对应的编辑图层,直至将全部编辑图层全部叠加于原始图像上,得到的图像即为原始图像的编辑目标图像。
由于上述实施例在编辑图层的编辑对象对应的区域具有交叠时,还会获取所述原始图像中各编辑对象的深度,根据各编辑对象的深度由大到小的顺序依次覆盖于所述原始图像上,生成所述目标图像,因此上述实施例可以使目标图像中的编辑对象之间的遮挡关系符合人眼观察到的实际情况,从而避免编辑目标图像中的编辑对象之间的遮挡关系异常。
进一步的,当上述步骤S503(从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据)的实现方式为:从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;分别根据所述第一编辑对象的轮廓和所述第二编辑对象的轮廓,确定所述第一编辑对象对应的第一图像数据提取区域和所述第二编辑对象对应的第二图像数据提取区域;所述第一编辑对象的轮廓位于所述第一图像数据提取区域,所述第二编辑对象的轮廓位于所述第二图像数据提取区域;提取第一图像数据提取区域内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取第二图像数据提取区域内的图像数据,获取所述第二编辑对象对应的图像数据时,上述实施例提供的图像编辑方法还包括:
基于预设平滑处理算法对所述第一原始图层中的所述第一编辑对象的边缘和/或的所述第二原始图层中的所述第二编辑对象的边缘作平滑处理。
基于同一发明构思,作为对上述方法的实现,本申请实施例还提供了一种图像编辑装置,该装置实施例与前述方法实施例对应,为便于阅读,本装置实施例不再对前述方法实施例中的细节内容进行逐一赘述,但应当明确,本实施例中的图像编辑装置能够对应实现前述方法实施例中的全部内容。
本申请实施例提供了一种图像编辑装置,图10为该图像编辑装置的结构示意图,如图10所示,该图像编辑装置100包括:
获取单元101,用于获取原始图像,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域;
生成单元102,用于将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图 层;
编辑单元103,用于响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层;
处理单元104,用于根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
在一些实施方式中,所述生成单元102,具体用于创建所述第一编辑对象和所述第二编辑对象分别对应的图层;从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据;根据所述第一编辑对象对应的图像数据对所述第一编辑对象对应的图层进行渲染,生成所述第一编辑对象对应的第一原始图层,以及根据所述第二编辑对象对应的图像数据对所述第二编辑对象对应的图层进行渲染,生成所述第二编辑对象对应的第二原始图层。
在一些实施方式中,所述生成单元102,具体用于从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;提取所述第一编辑对象的轮廓内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取所述第二编辑对象的轮廓内的图像数据,获取所述第二编辑对象对应的图像数据。
在一些实施方式中,所述生成单元102,具体用于从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;分别根据所述第一编辑对象的轮廓和所述第二编辑对象的轮廓,确定所述第一编辑对象对应的第一图像数据提取区域和所述第二编辑对象对应的第二图像数据提取区域;所述第一编辑对象的轮廓位于所述第一图像数据提取区域,所述第二编辑对象的轮廓位于所述第二图像数据提取区域;提取第一图像数据提取区域内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取第二图像数据提取区域内的图像数据,获取所述第二编辑对象对应的图像数据。
在一些实施方式中,所述处理单元104,还用于基于预设平滑处理算法对所述第一原始图层中的所述第一编辑对象的边缘和/或的所述第二原始图层中的所述第二编辑对象的边缘作平滑处理。
在一些实施方式中,所述处理单元104,具体用于将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度;所述边缘区域为编辑图层中除编辑对象对应的区域以外的区域;分别将所述第一编辑图层和所述第二编辑图层覆盖于所述原始图像上,生成所述目标图像;
其中,所述边缘区域为编辑图层中除编辑对象对应的区域以外的区域。
在一些实施方式中,所述处理单元104,具体用于判断所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域是否具有交叠;若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域不具有交叠,则将所述第一编辑图层和所述第二编辑图层按照任意顺序覆盖于所述原始图像上,生成所述目标图像。
在一些实施方式中,所述处理单元104,具体用于若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域具有交叠,则获取所述第一编辑对象的深度和所述第二编辑对象的深度;将所述第一编辑图层和所述第二编辑图层按照深度由大到小的顺序依次覆盖于所述原始图像上,生成所述目标图像。
在一些实施方式中,所述处理单元104,还用于在将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度之前,判断所述第一编辑图层和所述第二编辑图层中是否包含收缩区域,所述收缩区域为编辑后由所述编辑对象对应的区域变化为所述边缘区域的区域;若是,则对所述收缩区域进行边缘过渡填充,并将所述收缩区域设置为所述编辑对象对应的区域。
本实施例提供的图像编辑装置可以执行上述方法实施例提供的图像编辑方法,其实现原理与技术效果类似,此处不再赘述。
基于同一构思本申请实施例还提供了一种电子设备。图11为本申请实施例提供的电子设备的结构示意图,如图11所示,本实施例提供的电子设备包括:存储器111和处理器112,所述存储器111用于存储计算机程序;所述处理器112用于在调用计算机程序时执行上述实施例提供的图像编辑方法。
基于同一构思本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,当计算机程序被处理器执行时,使得所述计算设备实现上述实施例提供的图像编辑方法。
基于同一构思本申请实施例还提供了一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算设备实现上述实施例提供的图像编辑方法。
本领域技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质上实施的计算机程序产品的形式。
处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific  Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。存储器是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动存储介质。存储介质可以由任何方法或技术来实现信息存储,信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。根据本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (13)

  1. 一种图像编辑方法,其包括:
    获取原始图像,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域;
    将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层;
    响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层;
    根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
  2. 根据权利要求1所述的方法,其中,所述将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层,包括:
    创建所述第一编辑对象和所述第二编辑对象分别对应的图层;
    从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据;
    根据所述第一编辑对象对应的图像数据对所述第一编辑对象对应的图层进行渲染,生成所述第一编辑对象对应的第一原始图层,以及根据所述第二编辑对象对应的图像数据对所述第二编辑对象对应的图层进行渲染,生成所述第二编辑对象对应的第二原始图层。
  3. 根据权利要求2所述的方法,其中,所述从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据,包括:
    从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;
    提取所述第一编辑对象的轮廓内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取所述第二编辑对象的轮廓内的图像数据,获取所述第二编辑对象对应的图像数据。
  4. 根据权利要求2所述的方法,其中,所述从所述原始图像中分别提取所述第一编辑对象对应的图像数据和所述第二编辑对象对应的图像数据,包括:
    从所述原始图像中确定所述第一编辑对象的轮廓和所述第二编辑对象的轮廓;
    分别根据所述第一编辑对象的轮廓和所述第二编辑对象的轮廓,确定所述第一编辑对象对应的第一图像数据提取区域和所述第二编辑对象对应的第二图像数据提取区域;所述第一编辑对象的轮廓位于所述第一图像数据提取区域,所述第二编辑对象的轮廓位于所述第二图像数据提取区域;
    提取第一图像数据提取区域内的图像数据,获取所述第一编辑对象对应的图像数据,以及提取第二图像数据提取区域内的图像数据,获取所述第二编辑对象对应的图像数据。
  5. 根据权利要求4所述的方法,其中,所述方法还包括:
    基于预设平滑处理算法对所述第一原始图层中的所述第一编辑对象的边缘和/或的所述第二原始图层中的所述第二编辑对象的边缘作平滑处理。
  6. 根据权利要求2所述的方法,其中,所述根据所述第一编辑图层和所述第二编辑图层,生成目标图像,包括:
    将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度;所述边缘区域为编辑图层中除编辑对象对应的区域以外的区域;
    分别将所述第一编辑图层和所述第二编辑图层覆盖于所述原始图像上,生成所述目标图像。
  7. 根据权利要求6所述的方法,其中,所述分别将所述第一编辑图层和所述第二编辑图层覆盖于所述原始图像上,生成所述目标图像,包括:
    判断所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域是否具有交叠;
    若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域不具有交叠,则将所述第一编辑图层和所述第二编辑图层按照任意顺序覆盖于所述原始图像上,生成所述目标图像。
  8. 根据权利要求7所述的方法,其中,
    若所述第一编辑图层的编辑对象对应的区域与所述第二编辑图层的编辑对象对应的区域具有交叠,则获取所述第一编辑对象的深度和所述第二编辑对象的深度;
    将所述第一编辑图层和所述第二编辑图层按照深度由大到小的顺序依次覆盖于所述原始图像上,生成所述目标图像。
  9. 根据权利要求6所述的方法,其中,在将所述第一编辑图层的边缘区域和所述第二编辑图层的边缘区域的透明度设置为预设透明度之前,所述方法还包括:
    判断所述第一编辑图层和所述第二编辑图层中是否包含收缩区域,所述收缩区域为编辑后由所述编辑对象对应的区域变化为所述边缘区域的区域;
    若是,则对所述收缩区域进行边缘过渡填充,并将所述收缩区域设置为所述编辑对象对应的区域。
  10. 一种图像编辑装置,其包括:
    获取单元,用于获取原始图像,所述原始图像包括第一编辑对象和第二编辑对象,所述第一编辑对象和所述第二编辑对象位于所述原始图像的不同图像区域;
    生成单元,用于将所述第一编辑对象和所述第二编辑对象分别渲染到不同的图层,生成所述第一编辑对象对应的第一原始图层和所述第二编辑对象对应的第二原始图层;
    编辑单元,用于响应于针对所述第一编辑对象的第一编辑操作,基于所述第一原始图层,对所述第一编辑对象在所述第一编辑操作下的编辑结果进行渲染,生成所第一编辑对象对应的第一编辑图层,以及,响应于针对所述第二编辑对象的第二编辑操作,基于所述第二原始图层,对所述第二编辑对象在所述第二编辑操作下的编辑结果进行渲染,生成所第二编辑对象对应的第二编辑图层;
    处理单元,用于根据所述第一编辑图层和所述第二编辑图层,生成目标图像,作为所述原始图像的编辑结果。
  11. 一种电子设备,其包括:存储器和处理器,所述存储器用于存储计算机程序;所述处理器用于在调用计算机程序时,使得所述电子设备实现权利要求1-9任一项所述的图像编辑方法。
  12. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有计算机程序,当所述计算机程序被计算设备执行时,使得所述计算设备实现权利要求1-9任一项所述的图像编辑方法。
  13. 一种计算机程序产品,其中,当所述计算机程序产品在计算机上运行时,使得所述计算机实现如权利要求1-9任一项所述的图像编辑方法。
PCT/CN2022/121192 2021-09-30 2022-09-26 图像编辑方法及装置 WO2023051432A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP22874818.2A EP4390851A1 (en) 2021-09-30 2022-09-26 Image editing method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111165882.3 2021-09-30
CN202111165882.3A CN115908642A (zh) 2021-09-30 2021-09-30 一种图像编辑方法及装置

Publications (1)

Publication Number Publication Date
WO2023051432A1 true WO2023051432A1 (zh) 2023-04-06

Family

ID=85739474

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/121192 WO2023051432A1 (zh) 2021-09-30 2022-09-26 图像编辑方法及装置

Country Status (3)

Country Link
EP (1) EP4390851A1 (zh)
CN (1) CN115908642A (zh)
WO (1) WO2023051432A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070003106A1 (en) * 2001-11-05 2007-01-04 Samsung Electronics Co., Ltd. Illumination-invariant object tracking method and image editing system using the same
CN109034150A (zh) * 2018-06-15 2018-12-18 北京小米移动软件有限公司 图像处理方法及装置
CN109948103A (zh) * 2019-04-17 2019-06-28 北京华宇信息技术有限公司 基于网页的图像编辑方法、图像编辑装置和电子设备
CN113379865A (zh) * 2021-06-25 2021-09-10 上海哔哩哔哩科技有限公司 目标对象的绘制方法和系统
CN113672122A (zh) * 2021-08-17 2021-11-19 北京字节跳动网络技术有限公司 图像处理方法、装置和电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070003106A1 (en) * 2001-11-05 2007-01-04 Samsung Electronics Co., Ltd. Illumination-invariant object tracking method and image editing system using the same
CN109034150A (zh) * 2018-06-15 2018-12-18 北京小米移动软件有限公司 图像处理方法及装置
CN109948103A (zh) * 2019-04-17 2019-06-28 北京华宇信息技术有限公司 基于网页的图像编辑方法、图像编辑装置和电子设备
CN113379865A (zh) * 2021-06-25 2021-09-10 上海哔哩哔哩科技有限公司 目标对象的绘制方法和系统
CN113672122A (zh) * 2021-08-17 2021-11-19 北京字节跳动网络技术有限公司 图像处理方法、装置和电子设备

Also Published As

Publication number Publication date
EP4390851A1 (en) 2024-06-26
CN115908642A (zh) 2023-04-04

Similar Documents

Publication Publication Date Title
US7755645B2 (en) Object-based image inpainting
US10284789B2 (en) Dynamic generation of image of a scene based on removal of undesired object present in the scene
TW201804373A (zh) 識別二維碼位置的方法及其系統
US9105117B2 (en) Methods and apparatus for coherent manipulation and stylization of stereoscopic images
BRPI1100230A2 (pt) dispositivo e mÉtodo de processamento de imagem, programa executÁvel por um computador, e , dispositivo de processamento de imagem
Ge et al. Image editing by object-aware optimal boundary searching and mixed-domain composition
Li et al. Seam carving based aesthetics enhancement for photos
TW201351303A (zh) 使用超級像素之基於影像內容的影像尺寸調整技術
Luo et al. Multi-operator image retargeting with automatic integration of direct and indirect seam carving
JP2017091298A (ja) 画像処理装置、画像処理方法及び画像処理プログラム
US20140098246A1 (en) Method, Apparatus and Computer-Readable Recording Medium for Refocusing Photographed Image
WO2023051432A1 (zh) 图像编辑方法及装置
US9786055B1 (en) Method and apparatus for real-time matting using local color estimation and propagation
Sormann et al. Graph cut based multiple view segmentation for 3d reconstruction
US9143754B2 (en) Systems and methods for modifying stereoscopic images
US9720563B2 (en) Apparatus for representing 3D video from 2D video and method thereof
JP2013196225A (ja) プログラム、情報処理方法及び情報処理装置
Lee et al. Depth manipulation using disparity histogram analysis for stereoscopic 3d
Liao et al. Depth annotations: Designing depth of a single image for depth-based effects
CN115984154A (zh) 一种图像融合的方法、装置、存储介质及电子设备
KR20180067914A (ko) 이미지 프로세싱을 이용한 3차원 모델 복원 장치 및 방법
Shen et al. Structure Preserving Large Imagery Reconstruction
JP2012526479A (ja) 画像の領域に追加コンテンツを与えることによる修正画像の生成
Kuo et al. Automatic high dynamic range hallucination in inverse tone mapping
JP2017174416A (ja) 適応的デプスガイドノンフォトリアリスティックレンダリング方法、対応するコンピュータプログラム製品、コンピュータ読取可能搬送媒体及びデバイス

Legal Events

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

Ref document number: 22874818

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022874818

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022874818

Country of ref document: EP

Effective date: 20240319

NENP Non-entry into the national phase

Ref country code: DE