Image defect repairing system based on artificial intelligence
Through an image defect repair system based on artificial intelligence, using technologies such as feature extraction, contrast and adversarial neural networks, the problem of inaccurate defect edge recognition in the existing technology is solved, and a more accurate and beautiful image repair effect is achieved.
Patent Information
- Application Number
- CN202411184798.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art is difficult to effectively repair when identifying the edges of image defects, especially when the defect distribution range is small, and the accuracy is insufficient and it is difficult to effectively repair.
Using an image defect repair system based on artificial intelligence, including feature extraction module, feature comparison module and image repair module, the obvious differential pixel values and distribution are determined by calculating the histogram and similar texture of the image, and image repair is performed using an adversarial neural network. Combined with isogradient stretching and fusion technology, accurately identify and repair defect edges.
It improves the recognition accuracy of defect edges, ensures the image integrity and aesthetics after repair, and enhances the repair effect when the defect distribution range is small.
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital image processing, and in particular to an image defect repair system based on artificial intelligence. Background Art
[0002] Image defect repair refers to the use of various techniques and methods to remove defects, damage or unwanted parts in an image, thereby restoring the integrity and aesthetics of the image. In the field of digital image processing, image defect repair is a common and important task. These defects may include scratches, stains, noise, blur, etc., which may be caused by poor shooting conditions, image transmission errors, or storage medium damage. The important thing is to identify the defect range of the image. It is common in the prior art to use the Canny algorithm or other edge detection operators to identify the edges of the defects, and then use texture synthesis repair methods, filtering and smoothing-based repair methods, and image fusion-based repair methods to repair. Although the repair can be completed, when the defect distribution range is small, the edges of the identified defects are not accurate. Therefore, an image defect repair system based on artificial intelligence is proposed. Summary of the invention
[0003] In view of the shortcomings of the prior art, the present invention provides an image defect repair system based on artificial intelligence. To achieve the above purpose, the present invention is implemented through the following technical solutions: including:
[0004] The feature extraction module is used to extract features of equal pixel range from the input image, obtain the pixel distribution of the corresponding features, and use the cv2.calcHist function to calculate the histogram of the image and extract similar textures of the image;
[0005] The feature comparison module obtains the significant difference pixel values and distribution according to the pixel values contained in the histogram of the image, and determines the feature distribution of the image through the significant difference pixel values and distribution;
[0006] The data processing module obtains the histogram of the feature extraction module and performs equalization and stretching of the pixel values of the interval pixel range according to the equal gradient. In the process, the feature comparison module is used to determine the pixel values and distribution of obvious differences. The pixel range with initial obvious difference pixel values higher than other adjacent interval pixel ranges adopts decreasing equal gradient to equalize and compress the pixel values. The other areas adopt increasing equal gradient to equalize and stretch the pixel values. Through real-time comparison of the feature comparison module, the number of equal gradient stretching times of each pixel range at the same pixel value is confirmed, and the pixel range is adjusted to repeat the operation, and the number of equal gradient stretching times is counted. The number of equal gradient stretching times each time is compared with the number of occurrences of each pixel value in the histogram, and the distribution position of the pixel is obtained to determine the image defect. The characteristic distribution of the image defect is identified in combination with the characteristic distribution of the image, and the characteristic distribution boundary of the image defect is determined according to the continuity of the characteristic distribution of the image. The pixel distribution within the characteristic distribution boundary of the image defect is adjusted according to the similar texture of the image;
[0007] The image restoration module is used to construct an adversarial neural network including a generator and a discriminator, and to perform preset training on the adversarial neural network so as to perform image restoration on the image to be restored through the adversarial neural network after preset training.
[0008] Preferably, after the image restoration module repairs the characteristic distribution of the image defects after multiple equal-gradient stretching, the data processing module fuses the images into one image to complete the final restoration.
[0009] Preferably, the image restoration module is trained using image similar textures and feature distribution of image defects.
[0010] Preferably, the pixel distribution refers to the distribution of each pixel value in the image, reflecting the overall characteristics of the image and the visual properties of brightness and color.
[0011] Preferably, the pixel range uses the number of pixels as the size range.
[0012] (I) Beneficial effects
[0013] The present invention provides an image defect repair system based on artificial intelligence. It has the following beneficial effects:
[0014] In the present invention, the image defects are obtained by using obviously different pixel values and equalized stretching pixel values combined with different equal gradients after distribution, and the number of equal gradient stretching times at the same pixel value in each pixel range is compared with the number of occurrences of each pixel value in the histogram, and then the characteristic distribution boundary of the image defects is confirmed, which speeds up the recognition accuracy of the defect edge. In addition, by re-fusion after image restoration, the integrity and aesthetics of the restored image are guaranteed. DETAILED DESCRIPTION
[0015] The technical solutions in the embodiments of the present invention are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] An embodiment of the present invention provides an image defect repair system based on artificial intelligence, comprising:
[0017] The feature extraction module is used to extract features of equal pixel range from the input image, obtain the pixel distribution of the corresponding features, and use the cv2.cal cHis st function to calculate the histogram of the image and extract the similar texture of the image. The above-mentioned image is input by a scanning device or downloaded by data transmission. The pixel distribution refers to the distribution of each pixel value in the image, reflecting the overall characteristics of the image and the visual characteristics of brightness and color. The histogram counts the number of occurrences of each pixel value by traversing each pixel in the image;
[0018] A feature comparison module obtains the pixel values and distribution of obvious differences according to the pixel values contained in the histogram of the image, and determines the feature distribution of the image through the obvious difference pixel values and distribution. Here, the mean value of the histogram pixel values is used as the basis for comparison. The obvious difference pixel values include the pixel values with large differences compared with the mean value of each pixel range. The feature distribution of the image determined in the above includes the defective part;
[0019] The data processing module obtains the histogram of the feature extraction module and performs equalization and stretching of the pixel values of the interval pixel range according to the equal gradient. In the process, the feature comparison module is used to determine the pixel values and distribution of obvious differences. The pixel range with initial obvious difference pixel values higher than other adjacent interval pixel ranges adopts decreasing equal gradient to equalize and compress the pixel values. The other areas adopt increasing equal gradient to equalize and stretch the pixel values. Through real-time comparison of the feature comparison module, the number of equal gradient stretching times of each pixel range at the same pixel value is confirmed, and the pixel range is adjusted to repeat the operation, and the number of equal gradient stretching times is counted. The number of equal gradient stretching times each time is compared with the number of occurrences of each pixel value in the histogram, and the distribution position of the pixel is obtained to determine the image defect. The characteristic distribution of the image defect is identified in combination with the characteristic distribution of the image, and the characteristic distribution boundary of the image defect is determined according to the continuity of the characteristic distribution of the image. The pixel distribution within the characteristic distribution boundary of the image defect is adjusted according to the similar texture of the image;
[0020] The image restoration module is used to construct an adversarial neural network including a generator and a discriminator, and pre-train the adversarial neural network so as to perform image restoration on the image to be restored through the pre-trained adversarial neural network. After the image restoration module repairs the feature distribution of image defects after multiple equal-gradient stretching, the data processing module fuses the images into one image to complete the final restoration.
[0021] The image restoration module is trained with the feature distribution of image similar textures and image defects. By using the feature distribution of image similar textures and image defects to train the image restoration module, it is easier to restore the image more accurately and quickly. During the process, similar image defect distribution features can be downloaded from the cloud for pre-training. The feature extraction module extracts the image pixel features by comparing the final image after defect restoration with the image before restoration, and compares them with the function of the feature comparison module to determine the restoration trend of similar defects and the corresponding feature association.
[0022] The pixel range mentioned above uses the number of pixels as the size range, that is, the number of pixels per unit area is used as the segmentation range. For example, the entire image is divided uniformly according to the area occupied by 100X100 pixels as the unit pixel range.
[0023] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An image defect repair system based on artificial intelligence, characterized in that: include: The feature extraction module is used to extract features of equal pixel range from the input image, obtain the pixel distribution of the corresponding features, and use the cv2.calcHist function to calculate the histogram of the image and extract similar textures of the image; The feature comparison module obtains the significant difference pixel values and distribution according to the pixel values contained in the histogram of the image, and determines the feature distribution of the image through the significant difference pixel values and distribution; The data processing module obtains the histogram of the feature extraction module and performs equalization and stretching of the pixel values of the interval pixel range according to the equal gradient. In the process, the feature comparison module is used to determine the pixel values and distribution of obvious differences. The pixel range with initial obvious difference pixel values higher than other adjacent interval pixel ranges adopts decreasing equal gradient to equalize and compress the pixel values. The other areas adopt increasing equal gradient to equalize and stretch the pixel values. Through real-time comparison of the feature comparison module, the number of equal gradient stretching times of each pixel range at the same pixel value is confirmed, and the pixel range is adjusted to repeat the operation, and the number of equal gradient stretching times is counted. The number of equal gradient stretching times each time is compared with the number of occurrences of each pixel value in the histogram, and the distribution position of the pixel is obtained to determine the image defect. The characteristic distribution of the image defect is identified in combination with the characteristic distribution of the image, and the characteristic distribution boundary of the image defect is determined according to the continuity of the characteristic distribution of the image. The pixel distribution within the characteristic distribution boundary of the image defect is adjusted according to the similar texture of the image; The image restoration module is used to construct an adversarial neural network including a generator and a discriminator, and to perform preset training on the adversarial neural network so as to perform image restoration on the image to be restored through the adversarial neural network after preset training.
2. The image defect repair system based on artificial intelligence according to claim 1, characterized in that: After the image restoration module repairs the characteristic distribution of the image defects after multiple equal-gradient stretching, the data processing module fuses the images into one image to complete the final restoration.
3. The image defect repair system based on artificial intelligence according to claim 1, characterized in that: The image restoration module is trained using image similar textures and feature distributions of image defects.
4. The image defect repair system based on artificial intelligence according to claim 1, characterized in that: The pixel distribution refers to the distribution of each pixel value in the image, reflecting the overall characteristics of the image and the visual properties of brightness and color.
5. The image defect repair system based on artificial intelligence according to claim 1, characterized in that: The pixel range uses the number of pixels as the size range.
Citation Information
Patent Citations
PCB defect detection method based on computer vision
CN114998314A
System and method for dynamically determining vehicle and trailer dimensions from shadow profiles
CN117232427A
Generative adversarial model-based socket panel flaw online detection method and device
CN118096710A
