# US 11,120,604 B2 · Image processing method, apparatus, and storage medium

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

- Number: US 11,120,604 B2
- Document ID: US11120604B2
- Status: Granted
- Kind: B2
- Application number: 16/693,225
- Filed: 2019-11-23
- Published: 2021-01-28
- Granted: 2021-09-14
- Earliest claimed: 2019-07-26
- Assignees: Beijing Xiaomi Mobile Software Co., Ltd.
- Applicants: Beijing Xiaomi Mobile Software Co., Ltd.
- Inventors: Yunping Pang
- Web page: https://patentgrep.com/patent/US11120604B2

## CPC

- G06T 11/10: Texturing; Colouring; Generation of textures or colours (retouching, inpainting or scratch removal G06T5/77)
- G06F 18/22: Matching criteria, e.g. proximity measures
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06T 15/02: Non-photorealistic rendering
- G06T 2207/20084: Artificial neural networks [ANN]
- H04M 1/725: Cordless telephones (user interfaces specially adapted therefor H04M1/724)
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- H04M: TELEPHONIC COMMUNICATION (circuits for controlling other apparatus via a telephone cable and not involving telephone switching apparatus G08)

## Abstract

An image processing method includes: inputting an original image and a style reference image into a convolutional neural network to generate a first feature map of the original image and a second feature map of the style reference image; calculating a correction value of any pixel point in the first feature map based on the second feature map; replacing an original value of each pixel point in the first feature map with a corresponding corrected value to obtain a third feature map; and performing a deconvolution process on the third feature map to obtain a processed image. An apparatus and a storage medium are further provided.

## Claims

### Claim 1

An image processing method, comprising:
inputting an original image and a style reference image into a convolutional neural network to generate a first feature map of the original image and a second feature map of the style reference image;
calculating respective correction values for respective pixel points in the first feature map based on the second feature map;
replacing original values of the respective pixel points in the first feature map with the respective correction values to obtain a third feature map; and
performing a deconvolution process on the third feature map to obtain a processed image;
wherein the calculating the respective correction values for the respective pixel points in the first feature map based on the second feature map comprises:
obtaining an attribute parameter of a feature block, the attribute parameter comprising: a shape parameter, a size parameter, and a base point parameter;
taking a respective pixel point in the second feature map as a base point, and dividing the second feature map into M second feature blocks according to the attribute parameter, wherein M is an amount of pixel points in the second feature map;
taking a pixel point in the first feature map as a target base point, and obtaining a first feature block of the first feature map according to the attribute parameter;
calculating M first Euclidean distances between the first feature block and each of the M second feature blocks based on values of pixel points included in the first feature block and each of the M second feature blocks, respectively;
determining a second Euclidean distance which is shortest among the M first Euclidean distances;
obtaining a first value of respective pixel points corresponding to the target base point;
obtaining a second value of respective pixel points corresponding to a base point of one of the M second feature blocks corresponding to the second Euclidean distance;
calculating a weight value according to the first value and the second value; and
determining the weight value as the correction value for the respective pixel points corresponding to the target base point.

### Claim 2 (depends on 1)

The image processing method according to claim 1, wherein the feature block meets at least one of:
the shape parameter is indicated as a square; or
the base point parameter indicates that the base point is at the center of the feature block.

### Claim 3 (depends on 1)

The image processing method according to claim 1, wherein the calculating the weight value according to the first value and the second value comprises:
let the weight value be W, the first value is P, a first weighting coefficient is a, the second value is Q, and a second weighting coefficient is β;
then W=P×α+Q×β, wherein α+β=1.

### Claim 4 (depends on 1)

The image processing method according to claim 1, wherein prior to the calculating M first Euclidean distances between the first feature block and each of the M second feature blocks, respectively, the method further comprises:
responsive to that the first feature block exceeds boundary of the first feature map, zeroizing pixel points of the first feature block exceeding boundaries of the first feature map; and
responsive to that any one of the M second feature blocks exceeds boundary of the second feature map, zeroizing pixel points of the one of the M second feature blocks exceeding boundaries of the second feature map.

### Claim 5 (depends on 1)

The image processing method according to claim 1, wherein a size of the original image is same as a size of the style reference image.

### Claim 6

An image processing apparatus, comprising:
a processor;
a memory for storing instructions executable by the processor;
wherein the processor is configured to:
input an original image and a style reference image into a convolutional neural network to generate a first feature map of the original image and a second feature map of the style reference image;
calculate respective correction values for respective pixel points in the first feature map based on the second feature map;
replace original values of the respective pixel points in the first feature map with the respective correction values to obtain a third feature map; and
perform a deconvolution process on the third feature map to obtain a processed image;
wherein in a case that the processor is configured to calculate the respective correction values for the respective pixel points in the first feature map based on the second feature map, the processor is configured to:
obtain an attribute parameter of a feature block, the attribute parameter comprising: a shape parameter, a size parameter, and a base point parameter;
take a respective pixel point in the second feature map as a base point, and dividing the second feature map into M second feature blocks according to the attribute parameter, wherein M is an amount of pixel points in the second feature map;
take a pixel point in the first feature map as a target base point, and obtaining a first feature block of the first feature map according to the attribute parameter;
calculate M first Euclidean distances between the first feature block and each of the M second feature blocks based on values of pixel points included in the first feature block and each of the M second feature blocks, respectively;
determine a second Euclidean distance which is shortest among the M first Euclidean distances;
obtain a first value of the pixel point corresponding to the target base point;
obtain a second value of the pixel point corresponding to a base point of one of the M second feature blocks corresponding to the second Euclidean distance;
calculate a weight value according to the first value and the second value; and
determine the weight value as the correction value for the pixel point corresponding to the target base point.

### Claim 7 (depends on 6)

The image processing apparatus according to claim 6, wherein the feature block meets at least one of:
the shape parameter is indicated as a square; or
the base point parameter indicates that the base point is at the center of the feature block.

### Claim 8 (depends on 6)

The image processing apparatus according to claim 6, wherein in a case that the process is configured to calculate the weight value according to the first value and the second value, the processor is configured to:
let the weight value be W, the first value be P, a first weighting coefficient be a, the second value be Q, and a second weighting coefficient be β;
then W=P×α+Q×β, wherein α+β=1.

### Claim 9 (depends on 6)

The image processing apparatus according to claim 6, wherein prior to that the processor is configured to calculate M first Euclidean distances between the first feature block and each of the M second feature blocks, respectively, the processor is further configured to:
responsive to that the first feature block exceeds boundary of the first feature map, zeroize pixel points of the first feature block exceeding boundaries of the first feature map; and
responsive to that any one of the M second feature blocks exceeds boundary of the second feature map, zeroize pixel points of one of the M second feature blocks exceeding boundaries of the feature map.

### Claim 10 (depends on 6)

The image processing apparatus according to claim 6, wherein a size of the original image is same as a size of the style reference image.

### Claim 11

A non-transitory computer-readable storage medium, wherein responsive to that an instruction in the storage medium is executed by a processor of a mobile terminal, the mobile terminal is caused to perform an image processing method, comprising:
inputting an original image and a style reference image into a convolutional neural network to generate a first feature map of the original image and a second feature map of the style reference image;
calculating respective correction values for respective pixel points in the first feature map based on the second feature map;
replacing original values of the respective pixel points in the first feature map with the respective correction value to obtain a third feature map; and
performing a deconvolution process on the third feature map to obtain a processed image;
wherein the calculating the respective correction values for the respective pixel points in the first feature map based on the second feature map comprises:
obtaining an attribute parameter of a feature block, the attribute parameter comprising: a shape parameter, a size parameter, and a base point parameter;
taking a respective pixel point in the second feature map as a base point, and dividing the second feature map into M second feature blocks according to the attribute parameter, wherein M is an amount of pixel points in the second feature map;
taking a pixel point in the first feature map as a target base point, and obtaining a first feature block of the first feature map according to the attribute parameter;
calculating M first Euclidean distances between the first feature block and each of the M second feature blocks based on values of pixel points included in the first feature block and each of the M second feature blocks, respectively;
determining a second Euclidean distance which is shortest among the M first Euclidean distances;
obtaining a first value of respective pixel points corresponding to the target base point;
obtaining a second value of respective pixel points corresponding to a base point of one of the M second feature blocks corresponding to the second Euclidean distance;
calculating a weight value according to the first value and the second value; and
determining the weight value as the correction value for the respective pixel points corresponding to the target base point.

### Claim 12 (depends on 1)

A mobile phone implementing the image processing method according to claim 1, wherein the mobile phone is configured to apply features in the style reference image that have been learned through the deconvolution process to the original image, such that the original image is added with the style of the style reference image while keeping content of the original image, thereby realizing image stylization.

### Claim 13 (depends on 12)

The mobile phone of claim 12, wherein the feature block meets at least one of:
the shape parameter is indicated as a square; or
the base point parameter indicates that the base point is at the center of the feature block.

### Claim 14 (depends on 13)

The mobile phone of claim 13, wherein the calculating the weight value according to the first value and the second value comprises:
let the weight value be W, the first value is P, a first weighting coefficient is a, the second value is Q, and a second weighting coefficient is β;
then W=P×α+Q×β, wherein α+β=1.

### Claim 15 (depends on 14)

The mobile phone of claim 14, wherein prior to the calculating M first Euclidean distances between the first feature block and each of the M second feature blocks, respectively, the method further comprises:
responsive to that the first feature block exceeds boundary of the first feature map, zeroizing pixel points of the first feature block exceeding boundaries of the first feature map; and
responsive to that any one of the second feature blocks exceeds boundary of the second feature map, zeroizing pixel points of the one of the M second feature blocks exceeding boundaries of the feature map.

### Claim 16 (depends on 15)

The mobile phone of claim 15, wherein a size of the original image is same as a size of the style reference image.

### Claim 17 (depends on 16)

The mobile phone of claim 16, wherein the mobile phone comprises a display screen, and the method further comprises displaying the processed image on the display screen.
