# US 2020/0394769 A1 · Method and device for image correction 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 2020/0394769 A1
- Document ID: US20200394769A1
- Status: Published application
- Kind: A1
- Application number: 16/842,861
- Filed: 2020-04-08
- Published: 2020-12-17
- Earliest claimed: 2019-06-13
- Assignees: Beijing Xiaomi Mobile Software Co., Ltd.
- Applicants: Beijing Xiaomi Mobile Software Co., Ltd.
- Inventors: Zhijun CHEN
- Web page: https://patentgrep.com/patent/US20200394769A1

## CPC

- G06T 3/18: Image warping, e.g. rearranging pixels individually
- G06T 5/80: Geometric correction
- G06T 7/0002: {Inspection of images, e.g. flaw detection}
- G06T 7/70: Determining position or orientation of objects or cameras (camera calibration G06T7/80)
- G06T 2207/10024: Color image
- G06T 2207/20132: Image cropping
- G06T 2207/30201: Face
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL

## Abstract

The present disclosure relates to a method and device for image correction and a storage medium. The method can include a correction offset for each unit to be corrected in an image is determined, at least one target region in the image is determined, an image weight coefficient for each unit to be corrected in the image is determined according to the at least one target region, a final offset for each unit to be corrected in the image is determined according to the image weight coefficient and the correction offset, and each unit to be corrected in the image is corrected according to the final offset.

## Claims

### Claim 1

A method for image correction, comprising:
determining a correction offset for each unit to be corrected in an image;
determining at least one target region in the image;
determining, according to the at least one target region, an image weight coefficient for each unit to be corrected in the image;
determining, according to the image weight coefficient and the correction offset, a final offset for each unit to be corrected in the image; and
correcting, according to the final offset, each unit to be corrected in the image.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining the at least one target region in the image further comprises:
determining a central position and a first set value according to a characteristic of a region to be corrected;
determining a first circle having a center at the central position and a diameter equal to the first set value; and
setting a region within the first circle to be a target region.

### Claim 3 (depends on 2)

The method of claim 2, wherein determining, according to the at least one target region, the image weight coefficient for each unit to be corrected in the image further comprises:
setting a first image weight coefficient for each unit to be corrected in the target region,
the first image weight coefficient being greater than 0 and less than or equal to 1; and
setting a second image weight coefficient for each unit to be corrected outside the target region in the image, the second image weight coefficient being greater than or equal to 0 and less than the first image weight coefficient.

### Claim 4 (depends on 3)

The method of claim 3, wherein the first image weight coefficient comprises a third image weight coefficient and a fourth image weight coefficient, and setting the first image weight coefficient for each unit to be corrected in the target region further comprises:
determining a second set value according to the characteristic of the target region;
determining a second circle having a center at the central position and a diameter equal to the second set value, the second set value being less than the first set value;
setting a third image weight coefficient for each unit to be corrected within the second circle;
determining an annular region between the first circle and the second circle; and
setting a fourth image weight coefficients for each unit to be corrected in the annular region, fourth image weight coefficients from the second circle to the first circle gradually decreasing proportionally from the third image weight coefficient to the second image weight coefficient.

### Claim 5 (depends on 2)

The method of claim 2, wherein determining the first circle having the center at the central position and the diameter equal to the first set value further comprises:
determining a position of a face in the image according to a face recognition algorithm;
determining a face center according to the position of the face;
determining the face center to be the central position;
determining the first set value according to a range of the face; and
determining the first circle having the center at the central position and the diameter equal to the first set value.

### Claim 6 (depends on 5)

The method of claim 5, wherein determining the first set value according to the range of the face further comprises:
determining the first set value according to a length of the face.

### Claim 7 (depends on 1)

The method of claim 1, before determining the target region, further comprising:
determining a set threshold value;
for units to be corrected whose distances from a center of the image is greater than the set threshold value, determining the at least one target region; and
for units to be corrected whose distances from the center of the image is not greater than the set threshold value, determining the image weight coefficient for the units to be a fifth coefficient, the fifth coefficient being less than 1 and greater than or equal to 0.

### Claim 8 (depends on 1)

The method of claim 1, wherein correcting, according to the final offset, each unit to be corrected in the image further comprises:
determining, according to the final offset, a coordinate of each unit to be corrected in the image;
determining an image matrix according to the coordinate of each unit to be corrected;
determining, according to a pixel value of each unit to be corrected in an original image, a pixel value of the unit to be corrected in the image matrix; and
determining, according to the pixel value of each unit to be corrected in the image matrix, a pixel value of the unit to be corrected in a corrected image, the pixel value including a color value or a grayscale value.

### Claim 9 (depends on 1)

The method of claim 1, further comprising, after correcting each unit to be corrected in the image according to the final offset,
determining, according to the corrected image, a region to be cropped; and
cropping, according to the region to be cropped, the corrected image.

### Claim 10

An image correction device, comprising:
a processor; and
a memory configured to store instructions executable by the processor,
wherein the processor is configured to run the instructions to:
determine a correction offset for each unit to be corrected in an image;
determine at least one target region in the image;
determine, according to the at least one target region, an image weight coefficient for each unit to be corrected in the image;
determine, according to the image weight coefficient and the correction offset, a final offset for each unit to be corrected in the image; and
correct, according to the final offset, each unit to be corrected in the image.

### Claim 11 (depends on 10)

The device of claim 10, wherein the processor is further configured to run the executable instruction to:
determine, according to a characteristic of a region to be corrected, a central position and a first set value, and
determine a first circle having a center at the central position and a diameter equal to the first set value and determine a region within the first circle to be a target region.

### Claim 12 (depends on 11)

The device of claim 11, wherein the processor is further configured to run the executable instruction to:
set a first image weight coefficient for each unit to be corrected in the target region, the first image weight coefficient being greater than 0 and less than or equal to 1; and
set a second image weight coefficient for each unit to be corrected outside the target region in the image, the second image weight coefficient being greater than or equal to 0 and less than the first coefficient.

### Claim 13 (depends on 12)

The device of claim 12, wherein the first image weight coefficient further comprises a third image weight coefficient and a fourth image weight coefficient, and the processor is further configured to run the executable instruction to:
determine a second set value according to a characteristic of the target region;
determine a second circle having a center at the central position and a diameter equal to the second set value, the second set value being less than the first set value;
set a third image weight coefficient for each unit to be corrected within the second circle;
determine an annular region between a first circle and a second circle; and
set a fourth image weight coefficient for each unit to be corrected in the annular region, fourth image weight coefficients from the second circle to the first circle gradually decreasing proportionally from the third image weight coefficient to the second image weight coefficient.

### Claim 14 (depends on 11)

The device of claim 11, wherein the processor is further configured to run the executable instruction to:
determine a position of a face in the image according to a face recognition algorithm;
determine a face center according to the position of the face;
determine the face center to be the central position;
determine the first set value according to a range of the face; and
determine the first circle having the at the central position and the diameter of the first set value.

### Claim 15 (depends on 10)

The device of claim 10, wherein the processor is further configured to run the executable instruction to:
determine the at least one target region for units to be corrected whose distances from a center of the image is greater than the set threshold value; and
determine the image weight coefficient for the unit to be a fifth coefficient, the fifth coefficient being less than 1 and greater than or equal to 0 for units to be corrected whose distances from the center of the image is not greater than the set threshold value.

### Claim 16 (depends on 10)

The device of claim 10, wherein the processor is further configured to run the executable instruction to:
determine, according to the final offset, a coordinate of each unit to be corrected in the image;
determine, according to the coordinate of each unit to be corrected, an image matrix;
determine, according to a corresponding pixel value of each unit to be corrected in an original image, a pixel value of each unit to be corrected in the image matrix; and
determine, according to the pixel value of each unit to be corrected in the image matrix, a pixel value of each unit to be corrected in the a corrected image according to the pixel value of the unit to be corrected in the image matrix, the pixel value including a color value or a grayscale value.

### Claim 17 (depends on 10)

The device of claim 10, wherein the processor is further configured to run the executable instruction to:
determine, according to the corrected image, a region to be cropped; and
crop, according to the region to be cropped, the corrected image.

### Claim 18

A non-transitory computer-readable storage medium having a computer-executable instruction stored thereon, the computer-executable instruction being executed by a processor to perform a method including the steps of:
determining a correction offset for each unit to be corrected in an image;
determining at least one target region in the image;
determining, according to the at least one target region, an image weight coefficient for each unit to be corrected in the image;
determining, according to the image weight coefficient and the correction offset, a final offset for each unit to be corrected in the image; and
correcting, according to the final offset, each unit to be corrected in the image.

### Claim 19 (depends on 18)

The non-transitory computer-readable storage medium according to claim 18, wherein the computer-executable instruction being executed by a processor to perform the method further including the steps of:
determining, according to a characteristic of the region to be corrected, a central position and a first set value;
determining a first circle taking the central position as a center of the first circle and taking the first set value as a diameter of the first circle; and
determining a region within the first circle to be a target region.

### Claim 20 (depends on 19)

The non-transitory computer-readable storage medium according to claim 19, wherein the computer-executable instruction being executed by a processor to perform the method further including the steps of:
setting a first image weight coefficient for each unit to be corrected in the target region, the first image weight coefficient being greater than 0 and less than or equal to 1; and
setting a second image weight coefficient for each unit to be corrected outside the target region in the image, the second image weight coefficient being greater than or equal to 0 and less than the first image weight coefficient.
