# US 2025/0166140 A1 · Image inpainting method and device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0166140 A1
- Document ID: US20250166140A1
- Status: Published application
- Kind: A1
- Application number: 18/727,057
- Filed: 2023-01-04
- Published: 2025-05-22
- Earliest claimed: 2022-01-06
- Applicants: Beijing Zitiao Network Technology Co., Ltd.
- Inventors: Zidong ZHONG; Qianqian WANG; Shiyin WANG
- Web page: https://patentgrep.com/patent/US20250166140A1

## CPC

- G06T 5/77: Retouching; Inpainting; Scratch removal
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/08: Learning methods
- G06T 5/50: using two or more images, e.g. averaging or subtraction
- G06T 5/60: using machine learning, e.g. neural networks
- G06V 10/25: Determination of region of interest [ROI] or a volume of interest [VOI]
- G06V 10/774: Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
- G06V 10/80: Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level (multimodal speaker identification or verification G10L17/10)
- G06V 10/82: using neural networks
- G06T 2207/10024: Color image
- G06T 2207/20081: Training; Learning
- G06T 2207/20084: Artificial neural networks [ANN]
- G06T 2207/20221: Image fusion; Image merging
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

Embodiments of the present disclosure relate to the technical field of image processing, and provide an image inpainting method and device. The method includes: obtaining an image to be inpainted; determining an object area and a scratch area of the image to be inpainted, wherein the object area is an area where a target object in the image to be inpainted is located; determining an object scratch area and a background scratch area according to the object area and the scratch area; performing image inpainting on the object area according to the object scratch area to obtain an object image; performing image inpainting on the image, to be inpainted, according to the background scratch area to obtain a background image; and fusing the object image and the background image to obtain an inpainted image of the image to be inpainted.

## Claims

### Claim 1

An image inpainting method, comprising:
obtaining an image to be inpainted;
determining an object region and a scratch region of the image to be inpainted, the object region being a region where a target object in the image to be inpainted is located;
determining an object scratch region and a background scratch region according to the object region and the scratch region;
performing image inpainting on the object region according to the object scratch region to obtain an object image;
performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image; and
fusing the object image and the background image to obtain an inpainted image of the image to be inpainted.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the determining an object scratch region and a background scratch region according to the object region and the scratch region includes:
obtaining the object scratch region based on a segmentation network model and the object region, the segmentation network model being a network model obtained by training a U-Net (UNET) based on first sample data, the first sample data including a plurality of sample images containing the target object and scratch regions corresponding to individual sample images; and
determining the background scratch region according to the scratch region and the object scratch region.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the performing image inpainting on the object region according to the object scratch region to obtaining an object image includes:
inputting the object scratch region and the object region into a first image inpainting network model, and obtaining output of the first image inpainting network model as the object image;
wherein, the first image inpainting network model is a network model obtained by training a first network model based on second sample data, the second sample data including a plurality of sample object images with scratches and scratch-free images corresponding to individual sample object images.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image includes:
inputting the background scratch region and the image to be inpainted into a second image inpainting network model, and obtaining output of the second image inpainting network model as the background image;
wherein, the second image inpainting network model is a network model obtained by training a second network model based on third sample data, the third sample data including a plurality of sample images and scratch regions randomly generated for individual sample images.

### Claim 5 (depends on 1)

The method according to claim 1, wherein after determining an object region and a scratch region of the image to be inpainted, the method further comprises:
determining whether the area of each scratch region is greater than or equal to a threshold area; and
deleting scratch regions with an area smaller than the threshold area from scratch regions of the image to be inpainted.

### Claim 6 (depends on 1)

The method according to claim 1, wherein before segmenting the scratch region into an object scratch region and a background scratch region according to the object region, the method further comprises:
detecting whether the image to be inpainted is a color image;
in response to the image to be inpainted being not a color image, coloring the image to be inpainted.

### Claim 7 (depends on 6)

The method according to claim 6, wherein after coloring the image to be inpainted, the method further comprises:
determining an optimization region of the image to be inpainted, the optimization region being a region composed of pixels in the image to be inpainted whose color values fall within a preset color range; and
performing optimization on the optimization region based on a preset optimization algorithm.

### Claim 8 (depends on 6)

The method according to claim 6, wherein after coloring the image to be inpainted, the method further comprises:
performing white balance processing on the image to be inpainted based on a perfect reflector algorithm.

### Claim 9 (depends on 6)

The method according to claim 6, wherein after coloring the image to be inpainted, the method further comprises:
adjusting the contrast of the image to be inpainted based on a high dynamic range imaging network model (HIDRNET).

### Claim 10 (depends on 6)

The method according to claim 6, wherein before fusing the object image and the background image to obtain an inpainted image of the image to be inpainted, the method further comprises:
performing deblurring processing on the object image and the background image, respectively.

### Claim 11

(canceled)

### Claim 12

An electronic device, comprising: a memory and a processor, wherein the memory is configured to store a computer program; the processor is configured to, when executing the computer program, cause the electronic device to implement the following image inpainting operations:
obtaining an image to be inpainted;
determining an object region and a scratch region of the image to be inpainted, the object region being a region where a target object in the image to be inpainted is located;
determining an object scratch region and a background scratch region according to the object region and the scratch region;
performing image inpainting on the object region according to the object scratch region to obtain an object image;
performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image; and
fusing the object image and the background image to obtain an inpainted image of the image to be inpainted.

### Claim 13

A computer-readable storage medium having a computer program stored thereon, which, when executed by a computing device, causes the computing device to implement the following image inpainting operations:
obtaining an image to be inpainted;
determining an object region and a scratch region of the image to be inpainted, the object region being a region where a target object in the image to be inpainted is located;
determining an object scratch region and a background scratch region according to the object region and the scratch region;
performing image inpainting on the object region according to the object scratch region to obtain an object image;
performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image; and
fusing the object image and the background image to obtain an inpainted image of the image to be inpainted.

### Claim 14

(canceled)

### Claim 15 (depends on 12)

The electronic device according to claim 12, wherein the determining an object scratch region and a background scratch region according to the object region and the scratch region includes:
obtaining the object scratch region based on a segmentation network model and the object region, the segmentation network model being a network model obtained by training a U-Net (UNET) based on first sample data, the first sample data including a plurality of sample images containing the target object and scratch regions corresponding to individual sample images; and
determining the background scratch region according to the scratch region and the object scratch region.

### Claim 16 (depends on 12)

The electronic device according to claim 12, wherein the performing image inpainting on the object region according to the object scratch region to obtaining an object image includes:
inputting the object scratch region and the object region into a first image inpainting network model, and obtaining output of the first image inpainting network model as the object image;
wherein, the first image inpainting network model is a network model obtained by training a first network model based on second sample data, the second sample data including a plurality of sample object images with scratches and scratch-free images corresponding to individual sample object images.

### Claim 17 (depends on 12)

The electronic device according to claim 12, wherein the performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image includes:
inputting the background scratch region and the image to be inpainted into a second image inpainting network model, and obtaining output of the second image inpainting network model as the background image;
wherein, the second image inpainting network model is a network model obtained by training a second network model based on third sample data, the third sample data including a plurality of sample images and scratch regions randomly generated for individual sample images.

### Claim 18 (depends on 12)

The electronic device according to claim 12, wherein after determining an object region and a scratch region of the image to be inpainted, the processor is configured to, when executing the computer program, cause the electronic device to further implement the following operations:
determining whether the area of each scratch region is greater than or equal to a threshold area; and
deleting scratch regions with an area smaller than the threshold area from scratch regions of the image to be inpainted.

### Claim 19 (depends on 13)

The storage medium according to claim 13, wherein the determining an object scratch region and a background scratch region according to the object region and the scratch region includes:
obtaining the object scratch region based on a segmentation network model and the object region, the segmentation network model being a network model obtained by training a U-Net (UNET) based on first sample data, the first sample data including a plurality of sample images containing the target object and scratch regions corresponding to individual sample images; and
determining the background scratch region according to the scratch region and the object scratch region.

### Claim 20 (depends on 13)

The storage medium according to claim 13, wherein the performing image inpainting on the object region according to the object scratch region to obtaining an object image includes:
inputting the object scratch region and the object region into a first image inpainting network model, and obtaining output of the first image inpainting network model as the object image;
wherein, the first image inpainting network model is a network model obtained by training a first network model based on second sample data, the second sample data including a plurality of sample object images with scratches and scratch-free images corresponding to individual sample object images.

### Claim 21 (depends on 13)

The storage medium according to claim 13, wherein the performing image inpainting on the image to be inpainted according to the background scratch region to obtain a background image includes:
inputting the background scratch region and the image to be inpainted into a second image inpainting network model, and obtaining output of the second image inpainting network model as the background image;
wherein, the second image inpainting network model is a network model obtained by training a second network model based on third sample data, the third sample data including a plurality of sample images and scratch regions randomly generated for individual sample images.

### Claim 22 (depends on 13)

The storage medium according to claim 13, wherein after determining an object region and a scratch region of the image to be inpainted, the computer program, when executed by a computing device, causes the computing device to further implement the following operations:
determining whether the area of each scratch region is greater than or equal to a threshold area; and
deleting scratch regions with an area smaller than the threshold area from scratch regions of the image to be inpainted.
