# US 12,118,808 B2 · Image generation method, computing device, 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 12,118,808 B2
- Document ID: US12118808B2
- Status: Granted
- Kind: B2
- Application number: 17/830,518
- Filed: 2022-06-02
- Published: 2023-02-09
- Granted: 2024-10-15
- Earliest claimed: 2021-08-03
- Assignees: Hon Hai Precision Industry Co., Ltd.
- Applicants: Hon Hai Precision Industry Co., Ltd.
- Inventors: Cheng-Feng Wang; Po-Chung Wang; Li-Che Lin
- Web page: https://patentgrep.com/patent/US12118808B2

## CPC

- G06V 30/133: {Evaluation of quality of the acquired characters}
- G06T 5/50: using two or more images, e.g. averaging or subtraction
- G06T 7/0002: {Inspection of images, e.g. flaw detection}
- G06V 10/82: using neural networks
- G06V 30/153: {using recognition of characters or words}
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL

## Abstract

An image generation method obtains an original image. A character area, a background area, and a position of each flawless character in the original image are determined. The character area is segmented to obtain a first image of each flawless character. A background is removed from the first image to obtain a second image. First image processing is performed on the second image to obtain a third image. Second image processing is performed on the second image to obtain fourth images. Third image processing is performed on the fourth images respectively to obtain fifth images. A similarity between each fifth image and the third image is calculated. When the similarity is greater than a defect threshold, a background image is segmented. Brightness of the background image is adjusted. The target fourth image and adjusted background image are synthesized. The method can generate images with defective characters quickly.

## Claims

### Claim 1

An image generation method comprising:
obtaining an original image with flawless characters, determining a character area comprising the flawless characters and a background area of the original image, and determining a position of each flawless character in the character area;
segmenting the character area according to the position of the flawless character in the character area to obtain a first image of the flawless character;
removing a background from the first image to obtain a second image of the flawless character;
performing first image processing on the second image to obtain a third image of the flawless character;
performing second image processing on the second image to obtain N fourth images of the flawless character, and performing third image processing on the N fourth images respectively to obtain N fifth images of the flawless character, N being a positive integer greater than 1;
calculating a similarity between each of the N fifth images and the third image of the flawless character to obtain N similarities of the flawless character, and determining a defect threshold according to similarities of the flawless characters;
comparing the similarity with the defect threshold, and determining that a target fourth image corresponding to the fifth image contains a defective character when the similarity is greater than the defect threshold, the target fourth image being one of the N fourth images;
segmenting a background image from the background area, a size of the background image being equal to a size of the target fourth image; and
adjusting brightness of the background image to obtain at least one adjusted image, and synthesizing the target fourth image and the at least one adjusted image to obtain at least one synthesized image.

### Claim 2 (depends on 1)

The method of claim 1, wherein the first image processing comprises image binarization and outline extraction, the second image processing comprises erasure processing, and the third image processing comprises image binarization, and outline extraction.

### Claim 3 (depends on 2)

The method of claim 2, wherein removing a background from the first image to obtain a second image of the flawless character comprises:
determining a first threshold using an Otsu thresholding algorithm, obtaining a mask of the first image according to the first threshold, and performing a bitwise AND operation on the mask and the first image to obtain a foreground image of the first image; and
softening edges of the foreground image using Gaussian blur to obtain the second image.

### Claim 4 (depends on 3)

The method of claim 3, wherein the first image processing and the third image processing comprise image binarization and outline extraction, the image binarization are performed according to the first threshold, and the outline extraction are performed using a Fourier descriptor algorithm or an invariant moment algorithm.

### Claim 5 (depends on 2)

The method of claim 2, wherein removing a background from the first image to obtain a second image of the flawless character comprises:
removing dots from the first image via Fourier transform to obtain an image without dots, and binarizing the image without dots to obtain a binarized image; and
softening edges of the binarized image using Gaussian blur to obtain the second image.

### Claim 6 (depends on 2)

The method of claim 2, wherein performing second image processing on the second image to obtain N fourth images comprises:
randomly erasing the second image N times to obtain the N fourth images, wherein each of the N times of imaging erasing independently produces one of the N fourth images; and
performing third image processing on the N fourth images respectively to obtain N fifth images comprises:
performing image binarization on the N fourth images respectively to obtain N black and white images; and
performing outline extraction on the N black and white images respectively to obtain the N fifth images.

### Claim 7 (depends on 1)

The method of claim 1, wherein the similarity is a Euclidean distance between each of the N fifth images and the third image of the flawless character; and
determining a defect threshold according to similarities of the flawless characters comprises:
drawing a line graph representing a frequency distribution of the similarities; and
selecting a value of similarity corresponding to a first local minimum frequency in the line graph as the defect threshold.

### Claim 8 (depends on 1)

The method of claim 1, wherein adjusting brightness of the background image to obtain at least one adjusted image comprises:
adjusting the brightness of the background image several times to obtain multiple adjusted images; and
synthesizing the target fourth image and each of the multiple adjusted images to obtain multiple synthesized images.

### Claim 9

A computing device comprising:
at least one processor; and
a storage device storing computer-readable instructions, which when executed by the at least one processor, cause the at least one processor to:
obtain an original image with flawless characters, determine a character area comprising the flawless characters and a background area of the original image, and determine a position of each flawless character in the character area;
segment the character area according to the position of the flawless character in the character area to obtain a first image of the flawless character;
remove a background from the first image to obtain a second image of the flawless character;
perform first image processing on the second image to obtain a third image of the flawless character;
perform second image processing on the second image to obtain N fourth images of the flawless character, and perform third image processing on the N fourth images respectively to obtain N fifth images of the flawless character, N being a positive integer greater than 1;
calculate a similarity between each fifth image and the third image of the flawless character to obtain N similarities of the flawless character, and determine a defect threshold according to similarities of the flawless characters;
compare the similarity with the defect threshold, and determine that a target fourth image corresponding to the fifth image contains a defective character when the similarity is greater than the defect threshold, the target fourth image being one of the N fourth images;
segment a background image from the background area, a size of the background image being equal to a size of the target fourth image; and
adjust brightness of the background image to obtain at least one adjusted image, and synthesize the target fourth image and the at least one adjusted image to obtain at least one synthesized image.

### Claim 10 (depends on 9)

The computing device of claim 9, wherein the first image processing comprises image binarization and outline extraction, the second image processing comprises erasure processing, and the third image processing comprises image binarization, and outline extraction.

### Claim 11 (depends on 10)

The computing device of claim 10, wherein the at least one processor is further caused to:
determine a first threshold using an Otsu thresholding algorithm, obtain a mask of the first image according to the first threshold, and perform a bitwise AND operation on the mask and the first image to obtain a foreground image of the first image; and
soften edges of the foreground image using Gaussian blur to obtain the second image.

### Claim 12 (depends on 10)

The computing device of claim 10, wherein the at least one processor is further caused to:
remove dots from the first image via Fourier transform to obtain an image without dots, and binarize the image without dots to obtain a binarized image; and
soften edges of the binarized image using Gaussian blur to obtain the second image.

### Claim 13 (depends on 10)

The computing device of claim 10, wherein the at least one processor is further caused to:
randomly erase the second image N times to obtain the N fourth images, wherein each of the N times of imaging erasing independently produces one of the N fourth images;
perform image binarization on the N fourth images respectively to obtain N black and white images; and
perform outline extraction on the N black and white images respectively to obtain the N fifth images.

### Claim 14 (depends on 9)

The computing device of claim 9, wherein the similarity is a Euclidean distance between each of the N fifth images and the third image of the flawless character; and
the at least one processor is further caused to:
draw a line graph representing a frequency distribution of the similarities; and
select a value of similarity corresponding to a first local minimum frequency in the line graph as the defect threshold.

### Claim 15

A non-transitory storage medium having stored thereon computer-readable instructions that, when the computer-readable instructions are executed by a processor to implement the following method:
obtaining an original image with flawless characters, determining a character area comprising the flawless characters and a background area of the original image, and determining a position of each flawless character in the character area;
segmenting the character area according to the position of the flawless character in the character area to obtain a first image of the flawless character;
removing a background from the first image to obtain a second image of the flawless character;
performing first image processing on the second image to obtain a third image of the flawless character;
performing second image processing on the second image to obtain N fourth images of the flawless character, and performing third image processing on the N fourth images respectively to obtain N fifth images of the flawless character, N being a positive integer greater than 1;
calculating a similarity between each fifth image and the third image of the flawless character to obtain N similarities of the flawless character, and determining a defect threshold according to similarities of the flawless characters;
comparing the similarity with the defect threshold, and determining that a target fourth image corresponding to the fifth image contains a defective character when the similarity is greater than the defect threshold, the target fourth image being one of the N fourth images;
segmenting a background image from the background area, a size of the background image being equal to a size of the target fourth image; and
adjusting brightness of the background image to obtain at least one adjusted image, and synthesizing the target fourth image and the at least one adjusted image to obtain at least one synthesized image.

### Claim 16 (depends on 15)

The non-transitory storage medium of claim 15, wherein the first image processing comprises image binarization and outline extraction, the second image processing comprises erasure processing, and the third image processing comprises image binarization, and outline extraction.

### Claim 17 (depends on 16)

The non-transitory storage medium of claim 16, wherein removing a background from the first image to obtain a second image of the flawless character comprises:
determining a first threshold using an Otsu thresholding algorithm, obtaining a mask of the first image according to the first threshold, and performing a bitwise AND operation on the mask and the first image to obtain a foreground image of the first image; and
softening edges of the foreground image using Gaussian blur to obtain the second image.

### Claim 18 (depends on 17)

The non-transitory storage medium of claim 17, wherein removing a background from the first image to obtain a second image of the flawless character comprises:
removing dots from the first image via Fourier transform to obtain an image without dots, and binarizing the image without dots to obtain a binarized image; and
softening edges of the binarized image using Gaussian blur to obtain the second image.

### Claim 19 (depends on 16)

The non-transitory storage medium of claim 16, wherein performing second image processing on the second image to obtain N fourth images comprises:
randomly erasing the second image N times to obtain the N fourth images, wherein each of the N times of imaging erasing independently produces one of the N fourth images; and
performing third image processing on the N fourth images respectively to obtain N fifth images comprises:
performing image binarization on the N fourth images respectively to obtain N black and white images; and
performing outline extraction on the N black and white images respectively to obtain the N fifth images.

### Claim 20 (depends on 15)

The non-transitory storage medium of claim 15, wherein the similarity is a Euclidean distance between each of the N fifth images and the third image of the flawless character; and
determining a defect threshold according to similarities of the flawless characters comprises:
drawing a line graph representing a frequency distribution of the similarities; and
selecting a value of similarity corresponding to a first local minimum frequency in the line graph as the defect threshold.
