[go: up one dir, main page]

CN112419179B - Method, apparatus, device and computer readable medium for repairing image - Google Patents

Method, apparatus, device and computer readable medium for repairing image Download PDF

Info

Publication number
CN112419179B
CN112419179B CN202011299862.0A CN202011299862A CN112419179B CN 112419179 B CN112419179 B CN 112419179B CN 202011299862 A CN202011299862 A CN 202011299862A CN 112419179 B CN112419179 B CN 112419179B
Authority
CN
China
Prior art keywords
image
target
sample
region
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011299862.0A
Other languages
Chinese (zh)
Other versions
CN112419179A (en
Inventor
李华夏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202011299862.0A priority Critical patent/CN112419179B/en
Publication of CN112419179A publication Critical patent/CN112419179A/en
Application granted granted Critical
Publication of CN112419179B publication Critical patent/CN112419179B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/77Retouching; Inpainting; Scratch removal
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

Embodiments of the present disclosure disclose methods, apparatuses, electronic devices, and computer-readable media for repairing images. One embodiment of the method comprises the following steps: preprocessing an image to be repaired to obtain a first image, wherein the image to be repaired is an image with missing or unobvious image characteristics; determining at least one target region in the first image; processing the target area of the at least one target area to obtain a target modification area; constructing a second image based on at least one target modification region corresponding to the at least one target region; and carrying out image enhancement on the second image to obtain a target image. According to the embodiment, the image with missing or unobvious image characteristics is repaired, the repaired image content is more complete and the image quality is better by reasonably applying the repair technology.

Description

修复图像的方法、装置、设备和计算机可读介质Method, device, apparatus and computer-readable medium for repairing images

技术领域Technical Field

本公开的实施例涉及图像处理领域,具体涉及修复图像的方法、装置、设备和计算机可读介质。Embodiments of the present disclosure relate to the field of image processing, and in particular to a method, apparatus, device, and computer-readable medium for repairing an image.

背景技术Background technique

在图像的获取、传输以及保存过程中,由于各种因素(例如可以是电磁干扰),可能导致图像特征丢失或者不明显。在对图像全局修复的过程中可能会忽略图像细节的部分。而相关的图像修复技术不能很好地完成解决这个问题。In the process of image acquisition, transmission and storage, due to various factors (such as electromagnetic interference), image features may be lost or unclear. In the process of global image restoration, some image details may be ignored. However, related image restoration technologies cannot solve this problem well.

发明内容Summary of the invention

本公开的内容部分用于以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。本公开的内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。本公开的一些实施例提出了修复图像的方法、装置、设备和计算机可读介质,来解决以上背景技术部分提到的技术问题。The content of this disclosure is used to introduce concepts in a brief form, and these concepts will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection. Some embodiments of the present disclosure propose methods, devices, equipment and computer-readable media for repairing images to solve the technical problems mentioned in the above background technology section.

第一方面,本公开的一些实施例提供了一种修复图像的方法,该方法包括:对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定第一图像中的至少一个目标区域;对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;对第二图像进行图像增强,得到目标图像。In a first aspect, some embodiments of the present disclosure provide a method for repairing an image, the method comprising: preprocessing an image to be repaired to obtain a first image, wherein the image to be repaired is an image in which image features are missing or not obvious; determining at least one target area in the first image; for a target area of at least one target area, processing the target area to obtain a target modification area; constructing a second image based on at least one target modification area corresponding to the at least one target area; and performing image enhancement on the second image to obtain a target image.

第二方面,本公开的一些实施例提供了一种修复图像的装置,装置包括:预处理单元,被配置成对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定单元,被配置成确定第一图像中的至少一个目标区域;处理单元,被配置成对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;构建单元,被配置成基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;增强单元,被配置成对第二图像进行图像增强,得到目标图像。In a second aspect, some embodiments of the present disclosure provide a device for repairing an image, the device comprising: a preprocessing unit, configured to preprocess an image to be repaired to obtain a first image, wherein the image to be repaired is an image in which image features are missing or not obvious; a determination unit, configured to determine at least one target area in the first image; a processing unit, configured to process the target area of the at least one target area to obtain a target modification area; a construction unit, configured to construct a second image based on at least one target modification area corresponding to the at least one target area; and an enhancement unit, configured to perform image enhancement on the second image to obtain a target image.

第三方面,本公开的一些实施例提供了一种电子设备,包括:一个或多个处理器;存储装置,其上存储有一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面的修复图像的方法。In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method for repairing an image as in the first aspect.

第四方面,本公开的一些实施例提供了一种计算机可读介质,其上存储有计算机程序,其中,程序被处理器执行时实现如第一方面的修复图像的方法。In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for repairing an image according to the first aspect is implemented.

本公开的上述各个实施例中的一个实施例具有如下有益效果:首先对待修复图像进行预处理,得到第一图像。这一步是对全图做修复,可以整体把握图像的修复效果。由于全图的修复可能会导致局部细节的丢失,所以需要对局部进行细节修复。然后,确定第一图像中的至少一个目标区域,并得到每个目标区域的目标修改区域,实现了对局部图像的进一步修复,这样可以加强图像的具体细节。最后,对目标修改区域构建的第二图像进行了图像增强得到目标图像,实现了对待修复图像的图像特征的补充和加强。该实施方式实现了对图像特征缺失或不明显的图像的修复,并且通过合理的运用修复技术使得修复后的图像内容更加完整,且画质更好。One of the above-mentioned embodiments of the present disclosure has the following beneficial effects: first, the image to be repaired is preprocessed to obtain a first image. This step is to repair the entire image, and the image repair effect can be grasped as a whole. Since the repair of the entire image may cause the loss of local details, it is necessary to repair the local details. Then, at least one target area in the first image is determined, and a target modification area of each target area is obtained, so as to further repair the local image, which can enhance the specific details of the image. Finally, the second image constructed by the target modification area is enhanced to obtain the target image, so as to supplement and enhance the image features of the image to be repaired. This implementation realizes the repair of images with missing or unclear image features, and through the reasonable use of repair technology, the content of the repaired image is more complete and the image quality is better.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,元件和元素不一定按照比例绘制。The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

图1是根据本公开的一些实施例的修复图像的方法的一个应用场景的示意图;FIG1 is a schematic diagram of an application scenario of a method for repairing an image according to some embodiments of the present disclosure;

图2是根据本公开的修复图像的方法的一些实施例的流程图;FIG2 is a flow chart of some embodiments of a method for repairing an image according to the present disclosure;

图3是根据本公开的修复图像的方法的另一些实施例的流程图;FIG3 is a flow chart of other embodiments of a method for repairing an image according to the present disclosure;

图4是根据本公开的修复图像的方法的又一些实施例的流程图;FIG4 is a flow chart of still further embodiments of a method for repairing an image according to the present disclosure;

图5是根据本公开的修复图像的装置的一些实施例的结构示意图;FIG5 is a schematic structural diagram of some embodiments of an apparatus for repairing an image according to the present disclosure;

图6是适于用来实现本公开的一些实施例的电子设备的结构示意图。FIG. 6 is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure.

具体实施方式Detailed ways

下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例。相反,提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.

需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

下面将参考附图并结合实施例来详细说明本公开。The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

图1是根据本公开一些实施例的修复图像的方法的一个应用场景的示意图。FIG. 1 is a schematic diagram of an application scenario of a method for repairing an image according to some embodiments of the present disclosure.

在图1的应用场景中,首先,电子设备101可以接收待修复图像102。然后,电子设备101对待修复图像102进行预处理得到第一图像103。第一图像103是经过全局修复后的图像。所以需要对第一图像103进行进一步的处理。接下来,确定第一图像103中一个目标区域104。对目标区域104进行处理,得到目标修改区域105。基于目标修改区域105构建第二图像106。这样就到了对图像局部细节更细致的处理。最后,对第二图像106进行图像增强,得到目标图像107。图像增强是为了进一步强化图像特征。In the application scenario of FIG. 1 , first, the electronic device 101 can receive the image to be repaired 102. Then, the electronic device 101 pre-processes the image to be repaired 102 to obtain a first image 103. The first image 103 is an image after global repair. Therefore, the first image 103 needs to be further processed. Next, a target area 104 in the first image 103 is determined. The target area 104 is processed to obtain a target modification area 105. A second image 106 is constructed based on the target modification area 105. This leads to a more detailed processing of the local details of the image. Finally, the second image 106 is enhanced to obtain a target image 107. Image enhancement is to further strengthen the image features.

需要说明的是,上述电子设备101可以是硬件,也可以是软件。当电子设备为硬件时,可以实现成多个服务器或终端设备组成的分布式集群,也可以实现成单个服务器或单个终端设备。当电子设备体现为软件时,可以安装在上述所列举的硬件设备中。其可以实现成例如用来提供分布式服务的多个软件或软件模块,也可以实现成单个软件或软件模块。在此不做具体限定。It should be noted that the electronic device 101 can be hardware or software. When the electronic device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or it can be implemented as a single server or a single terminal device. When the electronic device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, for example, or it can be implemented as a single software or software module. No specific limitation is made here.

应该理解,图1中的电子设备的数目仅仅是示意性的。根据实现需要,可以具有任意数目的电子设备。It should be understood that the number of electronic devices in FIG1 is only for illustration and any number of electronic devices may be provided according to implementation requirements.

继续参考图2,示出了根据本公开的修复图像的方法的一些实施例的流程200。该修复图像的方法,包括以下步骤:Continuing to refer to FIG2 , a process 200 of some embodiments of the method for repairing an image according to the present disclosure is shown. The method for repairing an image comprises the following steps:

步骤201,对待修复图像进行预处理,得到第一图像。Step 201: pre-process the image to be repaired to obtain a first image.

在一些实施例中,修复图像的方法的执行主体(例如图1所示的电子设备101)可以通过有线连接方式或者无线连接方式接收待修复图像。其中,上述待修复图像可以为图像特征缺失或不明显的图像。需要指出的是,上述无线连接方式可以包括但不限于3G/4G/5G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。In some embodiments, the execution subject of the method for repairing an image (e.g., the electronic device 101 shown in FIG. 1 ) may receive the image to be repaired via a wired connection or a wireless connection. The image to be repaired may be an image whose image features are missing or unclear. It should be noted that the wireless connection method may include but is not limited to 3G/4G/5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

在一些实施例中,上述待修复图像一般是丢失某些必要的图像特征或者图像特征不明显的图像。上述待修复图像可以是由老旧的拍摄设备获取的图像,也可以是扫描以前的老照片获得的图像。上述待修复图像可以是任意图像。作为示例,上述待修复图像可以是显示有人脸的、小猪、麻雀、房子的图像等。In some embodiments, the image to be restored is generally an image that has lost some necessary image features or has unclear image features. The image to be restored may be an image acquired by an old photographing device or an image obtained by scanning an old photo. The image to be restored may be any image. As an example, the image to be restored may be an image showing a human face, a piglet, a sparrow, a house, etc.

在一些实施例中,上述预处理过程是对待修复图像的整体修复。作为示例,可以通过现有的图像修复软件来对待修复图像进行修复。In some embodiments, the above preprocessing process is to repair the entire image to be repaired. As an example, the image to be repaired can be repaired by existing image repair software.

步骤202,确定第一图像中的至少一个目标区域。Step 202: determine at least one target area in the first image.

在一些实施例中,基于步骤201中的第一图像,上述执行主体(例如图1所示的电子设备)可以确定上述第一图像中的至少一个目标区域。通常,目标区域内存在目标物体图像。执行主体可以通过目标检测来确定第一图像中目标区域的。In some embodiments, based on the first image in step 201, the execution subject (e.g., the electronic device shown in FIG. 1 ) may determine at least one target area in the first image. Typically, there is a target object image in the target area. The execution subject may determine the target area in the first image by target detection.

步骤203,对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域。Step 203: for at least one target region, process the target region to obtain a target modification region.

在一些实施例中,作为示例,执行主体可以通过对目标区域进行调整对比度、锐化等图像处理操作来得到目标修改区域。如此,针对性的对目标区域的细节进行再次修复,实现了对图像局部的图像特征修复。In some embodiments, as an example, the execution subject may obtain the target modification area by performing image processing operations such as adjusting contrast and sharpening on the target area. In this way, the details of the target area are repaired again in a targeted manner, thereby realizing the repair of local image features.

步骤204,基于至少一个目标区域对应的至少一个目标修改区域构建第二图像。Step 204: construct a second image based on at least one target modification region corresponding to the at least one target region.

在一些实施例中,经过再次细节处理的目标区域的第一图像,为最后得到的第二图像。In some embodiments, the first image of the target area that has been processed in detail again is the final second image.

步骤205,对第二图像进行图像增强,得到目标图像。Step 205: Perform image enhancement on the second image to obtain a target image.

在一些实施例中,图像增强可以通过以下几个算法实现:灰度线性变换、直方图均衡变换、同态滤波等算法。图像增强是为了进一步强化图像特征,使得图像细节更清晰。In some embodiments, image enhancement can be achieved through the following algorithms: grayscale linear transformation, histogram equalization transformation, homomorphic filtering, etc. Image enhancement is to further strengthen image features and make image details clearer.

本公开的一些实施例提供的方法,对待修复图像的预处理操作的目的是对待修复图像在全图范围内进行图像修复,得到的第一图像,主要考虑到图像的整体效果。然后,针对性的对目标区域的细节进行再次修复。最后进行图像增强,其目的是要改善图像的视觉效果,针对给定图像的应用场合,有目的地强调图像的整体或局部特性。将原来不清晰的图像变得清晰或强调某些具体的图像特征,扩大图像中不同物体特征之间的差别,抑制不感兴趣的特征。如此,可以改善图像质量、丰富信息量,加强图像判读和识别效果,满足某些特殊分析的需要。通过以上的方式实现了对图像特征缺失或不明显的图像的修复,并且通过合理的运用修复技术使得修复后的图像内容更加完整,且画质更好。In the methods provided by some embodiments of the present disclosure, the purpose of the preprocessing operation of the image to be repaired is to perform image repair on the image to be repaired within the entire image range, and the first image obtained mainly takes into account the overall effect of the image. Then, the details of the target area are repaired again in a targeted manner. Finally, image enhancement is performed, the purpose of which is to improve the visual effect of the image, and to purposefully emphasize the overall or local characteristics of the image for the application of a given image. The originally unclear image becomes clear or certain specific image features are emphasized, the differences between the features of different objects in the image are enlarged, and uninteresting features are suppressed. In this way, the image quality can be improved, the amount of information can be enriched, the image interpretation and recognition effects can be enhanced, and the needs of certain special analyses can be met. The repair of images with missing or unclear image features is achieved in the above manner, and the content of the repaired image is more complete and the image quality is better through the reasonable use of repair technology.

进一步参考图3,其示出了修复图像的方法的另一些实施例的流程300。该修复图像的方法的流程300,包括以下步骤:Further referring to FIG3 , it shows a process 300 of another embodiment of the method for repairing an image. The process 300 of the method for repairing an image comprises the following steps:

步骤301,将待修复图像输入预处理模型中,得到第一图像。Step 301: input the image to be repaired into a preprocessing model to obtain a first image.

在一些实施例中,作为示例,预处理模型的算法可以包括:基于扩散的方法、基于纹理合成的方法、基于数据驱动的图像修复方法等。In some embodiments, as examples, the algorithms of the preprocessing model may include: a diffusion-based method, a texture synthesis-based method, a data-driven image restoration method, and the like.

在一些实施例的可选实现方式中,预处理模型通过以下步骤得到:获取多个样本图像和对应多个样本图像中每个样本图像对应的样本目标图像,样本图像为图像特征缺失或不明显的图像,样本目标图像为对应样本图像的图像特征完整的图像;将多个样本图像中的每个样本图像作为输入,将多个样本图像中的每个样本图像对应的样本目标图像作为输出,训练得到预处理模型。In an optional implementation of some embodiments, the preprocessing model is obtained by the following steps: obtaining multiple sample images and sample target images corresponding to each sample image in the multiple sample images, the sample images are images in which image features are missing or unclear, and the sample target images are images in which image features of the corresponding sample images are complete; taking each sample image in the multiple sample images as input, and taking the sample target image corresponding to each sample image in the multiple sample images as output, and training to obtain the preprocessing model.

在一些实施例的可选实现方式中,样本目标图像通过以下步骤得到:识别样本图像内的样本目标对象;基于样本目标对象添加颜色,得到样本彩色图像;对样本彩色图像进行颜色平衡处理,得到样本颜色平衡图像;对样本颜色平衡图像进行去雾处理,得到样本去雾图像;调整样本去雾图像的清晰度,得到样本清晰图像;增加样本清晰图像的像素,得到对应样本图像的样本目标图像。作为示例,对样本图像添加颜色可以通过在线软件来完成;对彩色图像进行颜色平衡也可以通过图像处理软件来完成;样本去雾的操作可以通过端到端的神经网络模型来完成,也可以根据大气退化模型来实现;使得图像清晰的算法可以是维纳滤波,傅立叶变换等;增加样本清晰图像的像素也就是图像的超分,图像超分的方法有插值方法,基于稀疏表示(字典学习)的方法等。上述的图像修复过程是先对图像进行上色,得到样本彩色图像。随后对样本彩色图像进行颜色平衡,得到样本颜色平衡图像。这一步是为了图像中的颜色过渡更加自然。然后对样本颜色平衡图像进行去雾操作得到样本去雾图像这一步使得有雾的图像更加清晰对于没有雾的图像,这一步的操作也不影响画质。去雾之后需要对样本去雾图像的清晰度进行调整,得到样本清晰图像,这一步使得画质更好。最后增加样本清晰图像的像素,得到对应样本图像的样本目标图像,这一步是图像的超分操作,是对图像细节的像素的补充。In an optional implementation of some embodiments, the sample target image is obtained by the following steps: identifying the sample target object in the sample image; adding color based on the sample target object to obtain a sample color image; performing color balancing on the sample color image to obtain a sample color balanced image; performing defogging on the sample color balanced image to obtain a sample defogging image; adjusting the clarity of the sample defogging image to obtain a sample clear image; increasing the pixels of the sample clear image to obtain a sample target image corresponding to the sample image. As an example, adding color to the sample image can be done through online software; color balancing of the color image can also be done through image processing software; the sample defogging operation can be done through an end-to-end neural network model, or it can be done according to an atmospheric degradation model; the algorithm for making the image clear can be Wiener filtering, Fourier transform, etc.; increasing the pixels of the sample clear image is the super-resolution of the image, and the image super-resolution methods include interpolation methods, methods based on sparse representation (dictionary learning), etc. The above-mentioned image restoration process is to first colorize the image to obtain a sample color image. Then, the sample color image is color balanced to obtain a sample color balanced image. This step is to make the color transition in the image more natural. Then, the sample color-balanced image is defogged to obtain the sample defogged image. This step makes the foggy image clearer. For the image without fog, this step does not affect the image quality. After defogging, the clarity of the sample defogged image needs to be adjusted to obtain the sample clear image. This step makes the image quality better. Finally, the pixels of the sample clear image are increased to obtain the sample target image corresponding to the sample image. This step is the super-resolution operation of the image, which supplements the pixels of the image details.

步骤302,将第一图像输入目标检测模型中,得到第一图像的至少一个目标区域。Step 302: Input the first image into a target detection model to obtain at least one target region of the first image.

在一些实施例中,目标检测模型用于识别第一图像中的至少一个目标物体图像,并为至少一个目标物体图像中的每个目标物体图像设置对应的目标区域。作为示例,目标检测模型可以通过目标检测网络来实现目标区域的确定。作为示例,目标检测网络可以是R-CNN网络、SPPNet网络、Fast R-CNN网络等。In some embodiments, the target detection model is used to identify at least one target object image in the first image, and to set a corresponding target area for each target object image in the at least one target object image. As an example, the target detection model can determine the target area through a target detection network. As an example, the target detection network can be an R-CNN network, an SPPNet network, a Fast R-CNN network, etc.

步骤303,对于至少一个目标区域中的目标区域,将目标区域输入到区域处理模型中,得到对应目标区域的目标修改区域。Step 303: for a target region in at least one target region, input the target region into a region processing model to obtain a target modification region corresponding to the target region.

在一些实施例中,区域处理模型用于对目标区域内的目标物体图像的图像特征进行修复。目标修改区域是对图像中的目标区域进行进一步的细节处理得到的。作为示例,区域处理模型可以是基于卷积自编码的图像修复模型,基于生成对抗网络的图像修复模型,基于循环神经网络的图像修复模型。In some embodiments, the region processing model is used to repair the image features of the target object image in the target region. The target modification region is obtained by further processing the target region in the image. As an example, the region processing model can be an image restoration model based on convolutional autoencoder, an image restoration model based on generative adversarial network, or an image restoration model based on recurrent neural network.

步骤304,基于至少一个目标区域对应的至少一个目标修改区域构建第二图像。Step 304: construct a second image based on at least one target modification region corresponding to the at least one target region.

在一些实施例中,第二图像是在第一图像的基础上,对目标区域进行进一步的细节修复得到的图像。In some embodiments, the second image is an image obtained by further repairing the details of the target area based on the first image.

步骤305,对第二图像进行图像增强,得到目标图像。Step 305: Perform image enhancement on the second image to obtain a target image.

在一些实施例中,步骤304、305的具体实现及其所带来的技术效果,可以参考图2对应的实施例中的步骤204、205,在此不再赘述。In some embodiments, the specific implementation of steps 304 and 305 and the technical effects brought about by them can refer to steps 204 and 205 in the embodiment corresponding to Figure 2, and will not be repeated here.

从图3中可以看出,与图2对应的一些实施例的描述相比,图3对应的一些实施例中的修复图像的方法的流程300体现了如何得到第一图像,如何确定目标区域以及目标修改区域的操作。通过预处理模型的到第一图像。可以对图像特征进行整体把控。另外,预模型的中对图像修复的顺序也很重要,不同的操作顺序可能会带来不同结果。通过训练预模型能合理分配修复图像的操作步骤。通过目标检测模型得到目标区域。使用目标检测模型,可以很好找到需要特别修复的区域,这样能使被修复图像的细节更加充分的体现。通过区域处理模型得到目标修改区域。针对区域进行图像修复,使得修复更加具有针对性,修复效果更好。As can be seen from FIG. 3, compared with the description of some embodiments corresponding to FIG. 2, the process 300 of the method for repairing an image in some embodiments corresponding to FIG. 3 embodies how to obtain a first image, how to determine a target area, and how to perform operations on a target modification area. The first image is obtained by preprocessing the model. The image features can be controlled as a whole. In addition, the order of image repair in the pre-model is also very important, and different operation orders may bring different results. By training the pre-model, the operation steps for repairing the image can be reasonably allocated. The target area is obtained by the target detection model. Using the target detection model, the area that needs special repair can be found well, so that the details of the repaired image can be more fully reflected. The target modification area is obtained by the regional processing model. Image repair is performed on the region, so that the repair is more targeted and the repair effect is better.

进一步参考图4,其示出了修复图像的方法的另一些实施例的流程400。该修复图像的方法的流程400,包括以下步骤:Further referring to FIG4 , it shows a process 400 of another embodiment of the method for repairing an image. The process 400 of the method for repairing an image comprises the following steps:

步骤401,对待修复图像进行预处理,得到第一图像。Step 401: pre-process the image to be repaired to obtain a first image.

步骤402,确定第一图像中的至少一个目标区域。Step 402: determine at least one target area in the first image.

步骤403,调整目标区域的清晰度,得到目标清晰区域。Step 403, adjusting the clarity of the target area to obtain a target clear area.

在一些实施例中,调整目标区域的清晰度可以通过非邻域滤波法,邻域滤波法以及最小二乘滤波等方法实现。In some embodiments, the definition of the target area can be adjusted by non-neighborhood filtering, neighborhood filtering, least squares filtering and other methods.

步骤404,增加目标清晰区域的像素,得到目标修改区域。Step 404, increasing the pixels of the target clear area to obtain the target modified area.

在一些实施例中,作为示例,增加目标区域的像素可以通过基于局部嵌入(Neighbor Embedding)的方法,基于实例的(Example-Based)超分重建方法等。In some embodiments, as an example, increasing the pixels of the target area can be achieved by a method based on neighbor embedding, an example-based super-resolution reconstruction method, etc.

步骤405,基于至少一个目标区域对应的至少一个目标修改区域构建第二图像。Step 405: construct a second image based on at least one target modification region corresponding to at least one target region.

步骤406,对第二图像进行图像增强,得到目标图像。Step 406: Perform image enhancement on the second image to obtain a target image.

在一些实施例中,步骤401、402、405、406的具体实现及其所带来的技术效果,可以参考图2对应的实施例中的步骤201、202、204、205,在此不再赘述。In some embodiments, the specific implementation of steps 401, 402, 405, and 406 and the technical effects brought about by them can refer to steps 201, 202, 204, and 205 in the embodiment corresponding to Figure 2, and will not be repeated here.

从图4中可以看出,与图3对应的一些实施例的描述相比,图4对应的一些实施例中的修复图像的方法的流程400体现了对目标区域进行修复的一个实现方法。通过调整目标区域的清晰度以及增加目标区域的像素来完成对目标区域的细节调整。这样能很好补充图像细节,完善整体图像修复后,可能会对图像局部细节造成损失的问题。As can be seen from FIG. 4 , compared with the description of some embodiments corresponding to FIG. 3 , the process 400 of the method for repairing an image in some embodiments corresponding to FIG. 4 embodies an implementation method for repairing a target area. The detail adjustment of the target area is completed by adjusting the clarity of the target area and increasing the pixels of the target area. This can well supplement the image details and improve the overall image repair, but may cause the problem of loss of local image details.

进一步参考图5,作为对上述各图所示方法的实现,本公开提供了一种修复图像的装置的一些实施例,这些装置实施例与图2所示的那些方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 5 , as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a device for repairing an image, which device embodiments correspond to the method embodiments shown in FIG. 2 , and the device can be specifically applied to various electronic devices.

如图5所示,一些实施例的修复图像的装置500包括:预处理单元501,被配置成对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定单元502,被配置成确定第一图像中的至少一个目标区域;处理单元503,被配置成对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;构建单元504,被配置成基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;增强单元505,被配置成对第二图像进行图像增强,得到目标图像。As shown in FIG5 , an apparatus 500 for repairing an image in some embodiments includes: a preprocessing unit 501, configured to preprocess an image to be repaired to obtain a first image, wherein the image to be repaired is an image in which image features are missing or not obvious; a determination unit 502, configured to determine at least one target area in the first image; a processing unit 503, configured to process the target area of at least one target area to obtain a target modification area; a construction unit 504, configured to construct a second image based on at least one target modification area corresponding to the at least one target area; and an enhancement unit 505, configured to perform image enhancement on the second image to obtain a target image.

在一些实施例的可选实现方式中,预处理单元501进一步被配置成:将待修复图像输入预处理模型中,得到第一图像。In an optional implementation of some embodiments, the preprocessing unit 501 is further configured to: input the image to be repaired into a preprocessing model to obtain a first image.

在一些实施例的可选实现方式中,预处理模型通过以下步骤得到:获取多个样本图像和对应多个样本图像中每个样本图像对应的样本目标图像,样本图像为图像特征缺失或不明显的图像,样本目标图像为对应样本图像的图像特征完整的图像;将多个样本图像中的每个样本图像作为输入,将多个样本图像中的每个样本图像对应的样本目标图像作为输出,训练得到预处理模型。In an optional implementation of some embodiments, the preprocessing model is obtained by the following steps: obtaining multiple sample images and sample target images corresponding to each sample image in the multiple sample images, the sample images are images in which image features are missing or unclear, and the sample target images are images in which image features of the corresponding sample images are complete; taking each sample image in the multiple sample images as input, and taking the sample target image corresponding to each sample image in the multiple sample images as output, and training to obtain the preprocessing model.

在一些实施例的可选实现方式中,样本目标图像通过以下步骤得到:识别样本图像内的样本目标对象;基于样本目标对象添加颜色,得到样本彩色图像;对样本彩色图像进行颜色平衡处理,得到样本颜色平衡图像;对样本颜色平衡图像进行去雾处理,得到样本去雾图像;调整样本去雾图像的清晰度,得到样本清晰图像;增加样本清晰图像的像素,得到对应样本图像的样本目标图像。In an optional implementation of some embodiments, the sample target image is obtained by the following steps: identifying a sample target object within the sample image; adding color based on the sample target object to obtain a sample color image; performing color balancing on the sample color image to obtain a sample color balanced image; performing dehazing on the sample color balanced image to obtain a sample dehazed image; adjusting the clarity of the sample dehazed image to obtain a sample clear image; increasing the pixels of the sample clear image to obtain a sample target image corresponding to the sample image.

在一些实施例的可选实现方式中,确定单元502进一步被配置成:将第一图像输入到目标检测模型中,得到第一图像的至少一个目标区域,目标检测模型用于识别第一图像中的至少一个目标物体图像,并为至少一个目标物体图像中的每个目标物体图像设置对应的目标区域。In an optional implementation of some embodiments, the determination unit 502 is further configured to: input the first image into a target detection model to obtain at least one target area of the first image, the target detection model is used to identify at least one target object image in the first image, and set a corresponding target area for each target object image in the at least one target object image.

在一些实施例的可选实现方式中,处理单元503进一步被配置成:对于至少一个目标区域中的目标区域,将目标区域输入区域处理模型中,得到对应目标区域的目标修改区域,区域处理模型用于对目标区域内的目标物体图像的图像特征进行修复。In an optional implementation of some embodiments, the processing unit 503 is further configured to: for a target area in at least one target area, input the target area into a region processing model to obtain a target modification area corresponding to the target area, and the region processing model is used to repair image features of the target object image in the target area.

在一些实施例的可选实现方式中,处理单元503进一步被配置成:调整目标区域的清晰度,得到目标清晰区域;增加目标清晰区域的像素,得到目标修改区域。In an optional implementation of some embodiments, the processing unit 503 is further configured to: adjust the clarity of the target area to obtain a target clear area; and increase the pixels of the target clear area to obtain a target modified area.

可以理解的是,该装置500中记载的存诸单元与参考图2描述的方法中的各个步骤相对应。由此,上文针对方法描述的操作、特征以及产生的有益效果同样适用于装置500及其中包含的单元,在此不再赘述。It is understandable that the storage units recorded in the device 500 correspond to the steps in the method described with reference to Figure 2. Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 500 and the units contained therein, and will not be repeated here.

下面参考图6,其示出了适于用来实现本公开的一些实施例的电子设备(例如图1中的服务器或终端设备)600的结构示意图。本公开的一些实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图6示出的电子设备仅仅是一个示例,不应对本公开的实施例的功能和使用范围带来任何限制。Referring to FIG. 6 below, it shows a schematic diagram of the structure of an electronic device (e.g., the server or terminal device in FIG. 1 ) 600 suitable for implementing some embodiments of the present disclosure. The electronic devices in some embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG. 6 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.

如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG6 , the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to the bus 604.

通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图6中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Typically, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the electronic device 600 to communicate wirelessly or wired with other devices to exchange data. Although FIG. 6 shows an electronic device 600 with various devices, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have alternatively. Each box shown in FIG. 6 may represent one device, or may represent multiple devices as needed.

特别地,根据本公开的一些实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的一些实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的一些实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开的一些实施例的方法中限定的上述功能。In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

需要说明的是,本公开的一些实施例中记载的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的一些实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的一些实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定第一图像中的至少一个目标区域;对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;对第二图像进行图像增强,得到目标图像。The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: pre-processes the image to be repaired to obtain a first image, where the image to be repaired is an image with missing or unclear image features; determines at least one target area in the first image; processes the target area for the target area of the at least one target area to obtain a target modification area; constructs a second image based on at least one target modification area corresponding to the at least one target area; and performs image enhancement on the second image to obtain a target image.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开的一些实施例的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and/or flow chart, and the combination of the square boxes in the block diagram and/or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

描述于本公开的一些实施例中的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括预处理单元、确定单元、处理单元、构建单元和增强单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,预处理单元还可以被描述为“对待修复图像进行预处理的单元”。The units described in some embodiments of the present disclosure may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a preprocessing unit, a determination unit, a processing unit, a construction unit and an enhancement unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the preprocessing unit may also be described as a "unit for preprocessing the image to be repaired".

本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

根据本公开的一个或多个实施例,提供了一种修复图像的方法,包括:对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定第一图像中的至少一个目标区域;对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;对第二图像进行图像增强,得到目标图像。According to one or more embodiments of the present disclosure, a method for repairing an image is provided, comprising: preprocessing an image to be repaired to obtain a first image, wherein the image to be repaired is an image in which image features are missing or unclear; determining at least one target area in the first image; for a target area of the at least one target area, processing the target area to obtain a target modification area; constructing a second image based on at least one target modification area corresponding to the at least one target area; and performing image enhancement on the second image to obtain a target image.

根据本公开的一个或多个实施例,对待修复图像进行预处理,得到第一图像,包括:将待修复图像输入预处理模型中,得到第一图像。According to one or more embodiments of the present disclosure, preprocessing the image to be repaired to obtain a first image includes: inputting the image to be repaired into a preprocessing model to obtain the first image.

根据本公开的一个或多个实施例,预处理模型通过以下步骤得到:获取多个样本图像和对应多个样本图像中每个样本图像对应的样本目标图像,样本图像为图像特征缺失或不明显的图像,样本目标图像为对应样本图像的图像特征完整的图像;将多个样本图像中的每个样本图像作为输入,将多个样本图像中的每个样本图像对应的样本目标图像作为输出,训练得到预处理模型。According to one or more embodiments of the present disclosure, the preprocessing model is obtained by the following steps: obtaining multiple sample images and sample target images corresponding to each sample image in the multiple sample images, the sample images are images in which image features are missing or unclear, and the sample target images are images in which image features of the corresponding sample images are complete; taking each sample image in the multiple sample images as input, and taking the sample target image corresponding to each sample image in the multiple sample images as output, and training to obtain the preprocessing model.

根据本公开的一个或多个实施例,样本目标图像通过以下步骤得到:识别样本图像内的样本目标对象;基于样本目标对象添加颜色,得到样本彩色图像;对样本彩色图像进行颜色平衡处理,得到样本颜色平衡图像;对样本颜色平衡图像进行去雾处理,得到样本去雾图像;调整样本去雾图像的清晰度,得到样本清晰图像;增加样本清晰图像的像素,得到对应样本图像的样本目标图像。According to one or more embodiments of the present disclosure, a sample target image is obtained by the following steps: identifying a sample target object within a sample image; adding color based on the sample target object to obtain a sample color image; performing color balancing on the sample color image to obtain a sample color balanced image; performing dehazing on the sample color balanced image to obtain a sample dehazed image; adjusting the clarity of the sample dehazed image to obtain a sample clear image; and increasing the pixels of the sample clear image to obtain a sample target image corresponding to the sample image.

根据本公开的一个或多个实施例,确定第一图像中的至少一个目标区域,包括:将第一图像输入到目标检测模型中,得到第一图像的至少一个目标区域,目标检测模型用于识别第一图像中的至少一个目标物体图像,并为至少一个目标物体图像中的每个目标物体图像设置对应的目标区域。According to one or more embodiments of the present disclosure, determining at least one target area in a first image includes: inputting the first image into a target detection model to obtain at least one target area of the first image, the target detection model is used to identify at least one target object image in the first image, and setting a corresponding target area for each target object image in the at least one target object image.

根据本公开的一个或多个实施例,对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域,包括:对于至少一个目标区域中的目标区域,将目标区域输入区域处理模型中,得到对应目标区域的目标修改区域,上述区域处理模型用于对目标区域内的目标物体图像的图像特征进行修复。According to one or more embodiments of the present disclosure, for a target area of at least one target area, the target area is processed to obtain a target modification area, including: for the target area of at least one target area, the target area is input into a region processing model to obtain a target modification area corresponding to the target area, and the above-mentioned region processing model is used to repair image features of the target object image in the target area.

根据本公开的一个或多个实施例,将目标区域输入到区域处理模型中,得到对应目标区域的目标修改区域,包括:调整目标区域的清晰度,得到目标清晰区域;增加目标清晰区域的像素,得到目标修改区域。According to one or more embodiments of the present disclosure, the target area is input into the area processing model to obtain a target modification area corresponding to the target area, including: adjusting the clarity of the target area to obtain a target clear area; increasing the pixels of the target clear area to obtain a target modification area.

根据本公开的一个或多个实施例,提供了一种修复图像的装置,包括:预处理单元,被配置成对待修复图像进行预处理,得到第一图像,待修复图像为图像特征缺失或不明显的图像;确定单元,被配置成确定第一图像中的至少一个目标区域;处理单元,被配置成对于至少一个目标区域的目标区域,对目标区域进行处理,得到目标修改区域;构建单元,被配置成基于至少一个目标区域对应的至少一个目标修改区域构建第二图像;增强单元,被配置成对第二图像进行图像增强,得到目标图像。According to one or more embodiments of the present disclosure, there is provided a device for repairing an image, comprising: a preprocessing unit, configured to preprocess an image to be repaired to obtain a first image, wherein the image to be repaired is an image in which image features are missing or unclear; a determining unit, configured to determine at least one target area in the first image; a processing unit, configured to process the target area of the at least one target area to obtain a target modification area; a constructing unit, configured to construct a second image based on at least one target modification area corresponding to the at least one target area; and an enhancing unit, configured to perform image enhancement on the second image to obtain a target image.

根据本公开的一个或多个实施例,预处理单元被进一步配置成:将待修复图像输入预处理模型中,得到第一图像。According to one or more embodiments of the present disclosure, the preprocessing unit is further configured to: input the image to be repaired into a preprocessing model to obtain a first image.

根据本公开的一个或多个实施例,预处理模型通过以下步骤得到:获取多个样本图像和对应多个样本图像中每个样本图像对应的样本目标图像,样本图像为图像特征缺失或不明显的图像,上述样本目标图像为对应上述样本图像的图像特征完整的图像;将多个样本图像中的每个样本图像作为输入,将多个样本图像中的每个样本图像对应的样本目标图像作为输出,训练得到预处理模型。According to one or more embodiments of the present disclosure, the preprocessing model is obtained by the following steps: obtaining multiple sample images and sample target images corresponding to each sample image in the multiple sample images, the sample images are images in which image features are missing or unclear, and the above-mentioned sample target images are images with complete image features corresponding to the above-mentioned sample images; taking each sample image in the multiple sample images as input, and taking the sample target image corresponding to each sample image in the multiple sample images as output, and training to obtain the preprocessing model.

根据本公开的一个或多个实施例,样本目标图像通过以下步骤得到:识别样本图像内的样本目标对象;基于样本目标对象添加颜色,得到样本彩色图像;对样本彩色图像进行颜色平衡处理,得到样本颜色平衡图像;对样本颜色平衡图像进行去雾处理,得到样本去雾图像;调整样本去雾图像的清晰度,得到样本清晰图像;增加样本清晰图像的像素,得到对应上述样本图像的样本目标图像。According to one or more embodiments of the present disclosure, a sample target image is obtained by the following steps: identifying a sample target object within a sample image; adding color based on the sample target object to obtain a sample color image; performing color balancing on the sample color image to obtain a sample color balanced image; performing dehazing on the sample color balanced image to obtain a sample dehazed image; adjusting the clarity of the sample dehazed image to obtain a sample clear image; and increasing the pixels of the sample clear image to obtain a sample target image corresponding to the above-mentioned sample image.

根据本公开的一个或多个实施例,确定单元被进一步配置成:将第一图像输入到目标检测模型中,得到第一图像的至少一个目标区域,目标检测模型用于识别第一图像中的至少一个目标物体图像,并为上述至少一个目标物体图像中的每个目标物体图像设置对应的目标区域。According to one or more embodiments of the present disclosure, the determination unit is further configured to: input the first image into a target detection model to obtain at least one target area of the first image, the target detection model is used to identify at least one target object image in the first image, and set a corresponding target area for each target object image in the at least one target object image.

根据本公开的一个或多个实施例,处理单元被进一步配置成:对于至少一个目标区域中的目标区域,将目标区域输入区域处理模型中,得到对应目标区域的目标修改区域,区域处理模型用于对目标区域内的目标物体图像的图像特征进行修复。According to one or more embodiments of the present disclosure, the processing unit is further configured to: for a target area in at least one target area, input the target area into a region processing model to obtain a target modification area corresponding to the target area, and the region processing model is used to repair image features of the target object image in the target area.

根据本公开的一个或多个实施例,处理单元被进一步配置成:调整目标区域的清晰度,得到目标清晰区域;增加目标清晰区域的像素,得到目标修改区域。According to one or more embodiments of the present disclosure, the processing unit is further configured to: adjust the clarity of the target area to obtain a target clear area; increase the pixels of the target clear area to obtain a target modified area.

以上描述仅为本公开的一些较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开的实施例中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开的实施例中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.

Claims (8)

1. A method of repairing an image, comprising:
Inputting an image to be repaired into a preprocessing model to obtain a first image, wherein the image to be repaired is an image with missing or unobvious image characteristics; the preprocessing model is obtained based on a sample image and a sample target image;
determining at least one target region in the first image;
Processing the target area of the at least one target area to obtain a target modification area;
constructing a second image based on at least one target modification region corresponding to the at least one target region;
Performing image enhancement on the second image to obtain a target image;
the sample target image is obtained through the following steps:
identifying a sample target object within the sample image;
Adding color based on the sample target object to obtain a sample color image;
Performing color balance processing on the sample color image to obtain a sample color balance image;
Defogging the sample color balance image to obtain a sample defogging image;
adjusting the definition of the defogging image of the sample to obtain a clear image of the sample;
and adding pixels of the sample clear image to obtain a sample target image corresponding to the sample image.
2. The method of claim 1, wherein the pre-processing model is obtained by:
Acquiring a plurality of sample images and sample target images corresponding to each sample image in the plurality of sample images, wherein the sample images are images with missing or unobvious image features, and the sample target images are images with complete image features corresponding to the sample images;
And taking each sample image in the plurality of sample images as input, taking a sample target image corresponding to each sample image in the plurality of sample images as output, and training to obtain the preprocessing model.
3. The method of claim 1, wherein the determining at least one target region in the first image comprises:
And inputting the first image into a target detection model to obtain at least one target area of the first image, wherein the target detection model is used for identifying at least one target object image in the first image and setting a corresponding target area for each target object image in the at least one target object image.
4. A method according to claim 3, wherein said processing said target area for said at least one target area to obtain a target modified area comprises:
and inputting the target region into a region processing model for the target region in the at least one target region to obtain a target modification region corresponding to the target region, wherein the region processing model is used for repairing the image characteristics of the target object image in the target region.
5. The method of claim 4, wherein the inputting the target region into a region processing model results in a target modified region corresponding to the target region, comprising:
adjusting the definition of the target area to obtain a target clear area;
and adding pixels of the target clear region to obtain the target modification region.
6. An apparatus for acquiring an image, comprising:
The preprocessing unit is configured to input an image to be repaired into the preprocessing model to obtain a first image, wherein the image to be repaired is an image with missing or unobvious image characteristics; the preprocessing model is obtained based on a sample image and a sample target image;
A determining unit configured to determine at least one target area in the first image;
The processing unit is configured to process the target area of the at least one target area to obtain a target modification area;
a construction unit configured to construct a second image based on at least one target modification region corresponding to the at least one target region;
an enhancement unit configured to perform image enhancement on the second image to obtain a target image;
the sample target image is obtained through the following steps:
identifying a sample target object within the sample image;
Adding color based on the sample target object to obtain a sample color image;
Performing color balance processing on the sample color image to obtain a sample color balance image;
Defogging the sample color balance image to obtain a sample defogging image;
adjusting the definition of the defogging image of the sample to obtain a clear image of the sample;
and adding pixels of the sample clear image to obtain a sample target image corresponding to the sample image.
7. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1 to 5.
8. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1 to 5.
CN202011299862.0A 2020-11-18 2020-11-18 Method, apparatus, device and computer readable medium for repairing image Active CN112419179B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011299862.0A CN112419179B (en) 2020-11-18 2020-11-18 Method, apparatus, device and computer readable medium for repairing image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011299862.0A CN112419179B (en) 2020-11-18 2020-11-18 Method, apparatus, device and computer readable medium for repairing image

Publications (2)

Publication Number Publication Date
CN112419179A CN112419179A (en) 2021-02-26
CN112419179B true CN112419179B (en) 2024-07-05

Family

ID=74773467

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011299862.0A Active CN112419179B (en) 2020-11-18 2020-11-18 Method, apparatus, device and computer readable medium for repairing image

Country Status (1)

Country Link
CN (1) CN112419179B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113344832A (en) * 2021-05-28 2021-09-03 杭州睿胜软件有限公司 Image processing method and device, electronic equipment and storage medium
CN114332334A (en) * 2021-12-31 2022-04-12 中国电信股份有限公司 Image processing method, image processing device, storage medium and electronic equipment
CN114782418B (en) * 2022-06-16 2022-09-16 深圳市信润富联数字科技有限公司 Detection method and device for ceramic tile surface defects and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445415A (en) * 2020-03-30 2020-07-24 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101142739B1 (en) * 2009-10-29 2012-05-03 삼성전자주식회사 Apparatus and method for inpainting image by restricting reference image region
KR101539013B1 (en) * 2014-03-19 2015-07-24 한림대학교 산학협력단 Apparatus and method for inpainting image
CN108921806B (en) * 2018-08-07 2020-08-07 Oppo广东移动通信有限公司 Image processing method, image processing device and terminal equipment
CN110415178A (en) * 2019-06-06 2019-11-05 长春理工大学 An Underwater Image Sharpening Method Based on Electromagnetic Wave Energy Residual Ratio and Background Light Estimation
CN110288036B (en) * 2019-06-28 2021-11-09 北京字节跳动网络技术有限公司 Image restoration method and device and electronic equipment
CN110458769B (en) * 2019-07-22 2023-04-07 天津大学 Color polarization image restoration method based on elimination of inter-channel crosstalk
CN111784602B (en) * 2020-06-28 2022-09-23 江西理工大学 Method for generating countermeasure network for image restoration
CN111784712B (en) * 2020-07-17 2023-03-14 北京字节跳动网络技术有限公司 Image processing method, device, equipment and computer readable medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445415A (en) * 2020-03-30 2020-07-24 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112419179A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
CN109816589B (en) Method and apparatus for generating manga style transfer model
CN108427939B (en) Model generation method and device
CN112419179B (en) Method, apparatus, device and computer readable medium for repairing image
WO2022178975A1 (en) Noise field-based image noise reduction method and apparatus, device, and storage medium
CN112070888B (en) Image generation method, device, equipment and computer readable medium
CN112418054B (en) Image processing method, device, electronic device and computer readable medium
CN112348910B (en) Method, device, apparatus and computer readable medium for acquiring images
CN111311480A (en) Image fusion method and device
CN114399814B (en) A method for occlusion removal and 3D reconstruction based on deep learning
CN110288625B (en) Method and apparatus for processing image
CN113688928A (en) Image matching method, apparatus, electronic device and computer readable medium
CN112330788A (en) Image processing method, image processing device, readable medium and electronic equipment
CN112418249A (en) Mask image generation method, apparatus, electronic device and computer readable medium
CN112488947A (en) Model training and image processing method, device, equipment and computer readable medium
CN110033413B (en) Image processing method, device, equipment and computer readable medium of client
CN114972876A (en) Knowledge distillation technology-based image processing method, device, equipment and medium
CN112241744B (en) Image color migration method, device, apparatus and computer readable medium
CN118228200B (en) Method, device and equipment for identifying abnormality of power equipment based on multimodal model
CN118247388A (en) Image editing method, device, equipment and storage medium
CN112418233B (en) Image processing method and device, readable medium and electronic equipment
CN116843991A (en) Model training method, information generating method, device, equipment and medium
CN111797931B (en) Image processing method, image processing network training method, device and equipment
CN111680754B (en) Image classification method, device, electronic equipment and computer readable storage medium
CN111726476B (en) Image processing method, device, equipment and computer readable medium
CN116051941A (en) Deep forgery detection method and system for high-frequency information perception with double attention mechanism

Legal Events

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