Image processing method, apparatus, and storage medium
AssigneeBeijing Xiaomi Mobile Software Co., Ltd.
InventorYunping Pang
Life of this patent
Estimating the term…
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.
Claims17
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.
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.
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.
Dependencies are inferred from the claim text.