Background image processing method and apparatus

By using self-flattening correction and filtering, images with uniform grayscale values ​​are generated, solving the problems of false detection and missed detection in glass coating inspection and achieving high-precision defect detection.

CN116416227BActive Publication Date: 2026-05-29BEIJING LUSTER LIGHTTECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING LUSTER LIGHTTECH
Filing Date
2023-03-20
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies for glass coating inspection suffer from false positives and false negatives due to complex backgrounds and grayscale fluctuations, resulting in poor detection accuracy and an inability to adapt to changing inspection environments.

Method used

The optimized grayscale value is determined based on the pixel average value, difference, gain coefficient and target value of the initial image. Self-flattening correction is performed to generate a self-flattened image. Then, filtering and image segmentation are performed to extract the defect feature map.

Benefits of technology

It improves the accuracy and precision of detection results, has a wider range of applications, is less prone to missed or false detections, and reduces the error of image segmentation and feature extraction caused by noise interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116416227B_ABST
    Figure CN116416227B_ABST
Patent Text Reader

Abstract

The application discloses a background image processing method and device, and belongs to the field of industrial visual detection. The background image processing method comprises the following steps: determining an optimized gray value corresponding to a target pixel point based on the difference between the pixel average value corresponding to the obtained initial image of a product to be detected and the pixel value of the target pixel point, a gain coefficient and a target value; determining a self-flat-field correction image based on the optimized gray value corresponding to each pixel point in the initial image; and determining a defect feature map corresponding to the product to be detected based on the self-flat-field correction image. The background image processing method can transform the initial image into an image with uniform gray values without losing image details, and then determine the defect feature map based on the self-flat-field correction image, so that the defect detection of the product with complex and changeable image background and large gray value fluctuation is met, the accuracy and precision of the detection result are high, the product is not easy to be missed or misdetected, and the application range is wider.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of industrial visual inspection, and in particular relates to a background image processing method and apparatus. Background Technology

[0002] When inspecting glass coatings, defect detection is primarily achieved by acquiring images of the glass and extracting features from those images. Related techniques mainly involve using filters of different sizes to remove noise interference from complex backgrounds, and then using an absolute threshold to detect the presence of defects in the filtered image. If the grayscale value of a filtered pixel exceeds a set threshold, the current pixel is considered a defect. However, this method is unsuitable for the complex image backgrounds caused by the varied and complex product specifications during inspection, easily leading to false positives and false negatives; furthermore, its detection accuracy is relatively poor. Summary of the Invention

[0003] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a background image processing method and apparatus, which has high accuracy and precision in detection results, is less prone to missed detections or false detections, and has a wider range of applications.

[0004] In a first aspect, this application provides a background image processing method, the method comprising:

[0005] Based on the difference between the average pixel value of the initial image corresponding to the product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, the optimized gray value corresponding to the target pixel is determined.

[0006] Based on the optimized grayscale values ​​corresponding to each pixel in the initial image, a self-flattened field correction image is determined.

[0007] Based on the self-flattened field correction image, the defect feature map corresponding to the product under test is determined.

[0008] According to the background image processing method of this application, a self-flattened image is obtained by performing self-flattened field correction on the initial image, which can transform it into an image with uniform grayscale values ​​without losing image details. Then, the defect feature map is determined based on the self-flattened field correction image, which can meet the defect detection of products with complex and varied image backgrounds and large grayscale value fluctuations. The detection results have high accuracy and precision, are not easy to miss or falsely detect, and have a wider range of applications.

[0009] According to one embodiment of this application, determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value includes:

[0010] Determine the product of the difference and the gain coefficient;

[0011] The sum of the product and the target value is determined as the optimized grayscale value.

[0012] According to one embodiment of this application, before determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value corresponding to the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, the method further includes:

[0013] Traverse each column of the initial image and determine the average pixel value corresponding to at least a portion of the pixels in the target column of the initial image as the average pixel value corresponding to the target column; the target column is the column where the target pixel is located.

[0014] The difference between the pixel value corresponding to the target pixel and the average pixel value corresponding to the target column is determined as the difference value.

[0015] According to one embodiment of this application, determining the defect feature map corresponding to the product under test based on the self-flattened field correction image includes:

[0016] The self-flattened image is filtered to obtain a first image;

[0017] The first image is segmented based on the target threshold to obtain the defect feature map.

[0018] According to the background image processing method of this application, by filtering the self-flattened field corrected image, noise interference in the background of the self-flattened field corrected image can be filtered out, reducing the error caused by noise to subsequent image segmentation and feature extraction, thereby further improving the image precision, accuracy and image quality of the defect feature map.

[0019] According to one embodiment of this application, when there are multiple products to be tested, each product to be tested corresponds one-to-one with a multiple initial images. The step of determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the obtained product to be tested and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value includes:

[0020] Based on the difference between the average pixel value of the target initial image and the pixel value of the target pixel in any initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel in any initial image is determined.

[0021] According to one embodiment of this application, the initial target image is determined through the following steps:

[0022] One image is extracted from every target number of images from the plurality of initial images, and this image is determined as the target initial image corresponding to the target number of images.

[0023] According to the background image processing method of this application, the average pixel value is determined by selecting one target initial image from multiple initial images, which eliminates the need to calculate the corresponding average pixel value based on the pixel value of each initial image, thereby improving detection efficiency.

[0024] Secondly, this application provides a background image processing apparatus, the apparatus comprising:

[0025] The first processing module is used to determine the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value.

[0026] The second processing module is used to determine the self-flattened correction image based on the optimized grayscale values ​​corresponding to each pixel in the initial image.

[0027] The third processing module is used to determine the defect feature map corresponding to the product under test based on the self-flattened field correction image.

[0028] According to the background image processing apparatus of this application, a self-flattened image is obtained by performing self-flattening correction on the initial image, which can transform it into an image with uniform grayscale values ​​without losing image details. Then, a defect feature map is determined based on the self-flattened image, which can meet the defect detection needs of products with complex and varied image backgrounds and large grayscale value fluctuations. The detection results have high accuracy and precision, are not prone to missed detections or false detections, and have a wider range of applications.

[0029] According to one embodiment of this application, when there are multiple products to be tested, and each of the multiple products to be tested corresponds one-to-one with a multiple initial images, the first processing module is further configured to:

[0030] Based on the difference between the average pixel value of the target initial image and the pixel value of the target pixel in any initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel in any initial image is determined.

[0031] Thirdly, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the background image processing method as described in the first aspect above.

[0032] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the background image processing method as described in the first aspect above.

[0033] Fifthly, this application provides a chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the background image processing method as described in the first aspect.

[0034] In a sixth aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the background image processing method as described in the first aspect above.

[0035] The above-described one or more technical solutions in the embodiments of this application have at least one of the following technical effects:

[0036] By performing self-flattening correction on the initial image, a self-flattened image is obtained, which can be transformed into an image with uniform grayscale values ​​without losing image details. Then, the defect feature map is determined based on the self-flattened image, which can meet the defect detection needs of products with complex and varied image backgrounds and large grayscale value fluctuations. The detection results have high accuracy and precision, are less prone to missed detections or false detections, and have a wider range of applications.

[0037] Furthermore, by filtering the self-flattened image, noise interference in the background of the self-flattened image can be filtered out, reducing the error caused by noise to subsequent image segmentation and feature extraction, thereby further improving the image precision, accuracy and image quality of the defect feature map.

[0038] Furthermore, by selecting one target initial image from multiple initial images to determine the average pixel value, it is not necessary to calculate the corresponding average pixel value based on the pixel value of each initial image separately, which can improve detection efficiency.

[0039] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0040] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:

[0041] Figure 1 This is one of the flowcharts illustrating the background image processing method provided in the embodiments of this application;

[0042] Figure 2 This is a second schematic flowchart of the background image processing method provided in the embodiments of this application;

[0043] Figure 3 This is the third flowchart illustrating the background image processing method provided in the embodiments of this application;

[0044] Figure 4 This is a schematic diagram of the background image processing apparatus provided in the embodiments of this application;

[0045] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0046] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0047] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0048] The background image processing method, background image processing apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0049] The background image processing method can be applied to the terminal, and can be executed by the hardware or software in the terminal.

[0050] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets. It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer.

[0051] It should be understood that a terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.

[0052] The background image processing method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the background image processing method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The background image processing method provided in this application embodiment will be described below using an electronic device as the execution subject as an example.

[0053] It should be noted that this background image processing method is applied to product defect detection scenarios.

[0054] like Figure 1 As shown, the background image processing method includes steps 110, 120 and 130.

[0055] Step 110: Based on the difference between the average pixel value of the initial image corresponding to the product under test and the pixel value of the target pixel in the initial image, the gain coefficient and the target value, determine the optimized gray value corresponding to the target pixel.

[0056] In this step, the product to be tested can be glass, with coatings and embossing, etc.

[0057] In actual production, one testing device can simultaneously test glass from 1 to 3 different production lines, whose specifications may be the same or different.

[0058] In this application, an image sensor can be used to acquire an image of the product under test, such as a line scan camera, to obtain an initial image.

[0059] The initial image can be a grayscale image.

[0060] The initial image includes product features and background area features.

[0061] Understandably, in actual manufacturing processes, the instability of glass and coating production processes leads to fluctuations in the initial images of glass of the same specifications. Furthermore, factors such as embossing and glass tilt can cause differences in the background of each initial image; that is, initial images of different pieces of glass of the same specifications taken with the same equipment will have variations in background brightness and embossing placement.

[0062] In addition, glass comes in a variety of specifications. Different specifications of glass have different thicknesses, surface roughness, coating thicknesses, and types of coating solutions. This results in significant differences in the background brightness values ​​of the initial images corresponding to different specifications of glass.

[0063] In this application, the initial image may be an image with a complex and varied background and irregular fluctuations in grayscale values.

[0064] The pixel average value, gain coefficient, and target value are pre-defined standard values ​​used to reduce the fluctuation of grayscale in the background area of ​​the initial image.

[0065] The average pixel value can be determined by the terminal based on an algorithm, or it can be based on user-defined values, or it can be determined by other means, which are not limited here.

[0066] It should be noted that an initial image may correspond to one pixel average value, or it may correspond to multiple pixel average values. For example, different regions in the initial image may correspond to different pixel average values.

[0067] The target value is the target value for self-flattening correction, which is used to correct an initial image with a complex and variable background and irregular fluctuations in grayscale values ​​into an image that fluctuates around the target value, thereby reducing the degree of fluctuation in background pixels.

[0068] Understandably, in actual processing, the same target value can be set for initial images corresponding to products of different specifications and different initial images corresponding to the same product specification, so as to correct initial images with different grayscale fluctuations to images with a uniform background grayscale value.

[0069] The gain coefficient and target value can be user-defined.

[0070] Optimized grayscale values ​​are new pixel values ​​obtained by reducing fluctuations in the original grayscale values ​​of the target pixels.

[0071] The target pixel can be any pixel in the initial image.

[0072] In this step, based on the difference between the average pixel value and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to each pixel in the initial image can be determined.

[0073] like Figure 2 As shown, in some embodiments, step 110 may include:

[0074] Determine the product of the difference and the gain coefficient;

[0075] The sum of the product and the target value is used to determine the optimized grayscale value.

[0076] In this embodiment, all pixels of the initial image are traversed, and the difference is calculated by subtracting the average pixel value corresponding to that pixel from the gray value of that pixel.

[0077] Then, multiply the obtained difference by the gain coefficient, and add the target value for self-flattening correction to obtain the self-flattening correction result for that pixel.

[0078] Finally, the self-flattening correction result of each pixel is used as the optimized grayscale value of that pixel.

[0079] Continue to refer to Figure 2 In some embodiments, prior to step 110, the method may further include:

[0080] Iterate through each column of the initial image and determine the average pixel value of at least some pixels in the target column of the initial image as the average pixel value of the target column; the target column is the column where the target pixel is located.

[0081] The difference between the pixel value corresponding to the target pixel and the average pixel value corresponding to the target column is defined as the difference value.

[0082] In this embodiment, the target column can be any column of pixels in the initial image.

[0083] The target column corresponds to the target pixel, that is, the target column is the column where the target pixel is located.

[0084] In actual execution, the average value of all pixels in the target column can be determined as the average pixel value of the target column; or a portion of pixels can be selected from all pixels in the target column, and the average value of the selected portion of pixels can be determined as the average pixel value of the target column.

[0085] For example, the average gray level of the first 256 pixels in each column is used as the average pixel value for that column.

[0086] In this embodiment, the average pixel value of each pixel in the same column is the same; the average pixel value of different columns may be the same or different.

[0087] Step 120: Determine the self-flattened field correction image based on the optimized grayscale values ​​corresponding to each pixel in the initial image;

[0088] In this step, the self-flattened corrected image is the image obtained after the background of the initial image has been subjected to wave weakening processing.

[0089] The self-flattened image is a grayscale image.

[0090] In this application, by means of step 110, after obtaining the self-flattening correction result corresponding to each pixel, the self-flattening correction result of each pixel is used as the optimized gray value of that pixel, thereby obtaining the self-flattening correction image.

[0091] Step 130: Based on the self-flattened field correction image, determine the defect feature map corresponding to the product under test.

[0092] In this step, the defect feature map can be a binary map, used to characterize defects in the product under test, such as defects in glass coating.

[0093] In actual implementation, a threshold method can be used to extract defect features to generate a defect feature map; or a neural network can be used, such as inputting the self-flattened correction image into a pre-trained neural network to obtain the defect feature map corresponding to the self-flattened correction image output by the neural network; or any other feasible method can be used, which is not limited in this application.

[0094] During the research and development process, the inventors discovered that related technologies mainly employ the absolute threshold method for detection. This method uses filters of different sizes to filter out noise interference from complex backgrounds based on varying background interference, and then uses an absolute threshold to detect the presence of defects. If the grayscale value of a filtered pixel exceeds a set threshold, the current pixel is considered a defect. However, this method has limited application scenarios. For example, when a product changes to different specifications, the overall grayscale value of its image will change significantly, and this method cannot adapt to the changes in image grayscale values ​​caused by changes in product specifications, easily leading to false positives and false negatives.

[0095] In this application, optimized grayscale values ​​are determined based on different initial images to perform self-flattening correction, resulting in a self-flattened image. This self-flattened image is then inspected, enabling initial images with varying brightness due to different product specifications to be corrected to a uniform background grayscale value without loss of image detail. This adapts to grayscale fluctuations caused by changes in product specifications. For scenarios with high inspection requirements, the threshold can be easily tightened to detect more potential defects.

[0096] According to the background image processing method provided in the embodiments of this application, a self-flattened image is obtained by performing self-flattening correction on the initial image, which can transform it into an image with uniform grayscale values ​​without losing image details. Then, a defect feature map is determined based on the self-flattened image, which can meet the defect detection needs of products with complex and varied image backgrounds and large grayscale value fluctuations. The detection results have high accuracy and precision, are not prone to missed detections or false detections, have a wider range of applications, and strong detection capabilities.

[0097] The implementation of step 130 will be explained in detail below using the threshold method as an example.

[0098] like Figure 3 As shown, in some embodiments, step 130 may include:

[0099] The self-flattened field-corrected image is filtered to obtain the first image;

[0100] Image segmentation is performed on the first image based on the target threshold to obtain the defect feature map.

[0101] In this embodiment, the first image is the image obtained after filtering the self-flattened image.

[0102] By filtering the self-flattened image, noise interference in the background of the self-flattened image can be filtered out, reducing the error caused by noise in subsequent image segmentation and feature extraction, thereby further improving the image accuracy, precision and quality of the defect feature map.

[0103] The target threshold can be user-defined.

[0104] The value of the target threshold can be automatically determined based on factors such as detection accuracy and image quality of the self-flattened image, or it can be based on user-defined values; this application does not impose any limitations on this.

[0105] Understandably, if the grayscale value exceeds the target threshold, the current pixel is considered a defect; if the grayscale value does not exceed the target threshold, the current pixel is considered not a defect.

[0106] In actual execution, the corresponding algorithm can be used to execute steps 110-130 above. The input of the algorithm is the initial image, and the output is a binary map of the defect features in the initial image (i.e., the defect feature map).

[0107] According to the background image processing method provided in the embodiments of this application, by filtering the self-flattened field corrected image, noise interference in the background of the self-flattened field corrected image can be filtered out, reducing the error caused by noise to subsequent image segmentation and feature extraction, thereby further improving the image precision, accuracy and image quality of the defect feature map.

[0108] In some embodiments, when there are multiple products to be tested, each product to be tested corresponds one-to-one with a multiple initial images, and step 110 may include:

[0109] Based on the difference between the average pixel value of the target initial image and the pixel value of the target pixel in any initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel in any initial image is determined.

[0110] In this embodiment, the multiple products to be tested are multiple products to be tested on the production line.

[0111] In actual operation, multiple products under test are placed on the production line and move with the production line. When each product under test moves to the area of ​​view of the image sensor, the image sensor acquires an image of the product under test and generates an initial image corresponding to the product under test. Thus, multiple consecutive initial images can be obtained, and each product under test corresponds to one initial image.

[0112] The target initial image can be any one of multiple initial images.

[0113] In this embodiment, one image (i.e., the target initial image) can be randomly selected from multiple initial images to calculate its corresponding pixel average value. The pixel average value corresponding to the target initial image is then determined as the pixel average value corresponding to any one of the multiple initial images. This allows for the calculation of the difference between each initial image, eliminating the need to calculate the corresponding pixel average value based on the pixel values ​​of each initial image, thereby improving detection efficiency.

[0114] In some embodiments, the initial target image can be determined through the following steps:

[0115] Extract one image from every target number of images from multiple initial images and determine it as the target initial image corresponding to the target number of images.

[0116] In this embodiment, the target quantity is an integer greater than or equal to 1.

[0117] For example, the column average gray value is calculated every n images (n≥1 and n is an integer). After the column average gray value of a certain image is calculated, the column average gray value of the first image is used as the benchmark for flat field correction in the next n images. This avoids calculating for each image and effectively improves detection efficiency.

[0118] According to the background image processing method provided in the embodiments of this application, the average pixel value is determined by selecting one target initial image from multiple initial images, without having to calculate the corresponding average pixel value based on the pixel value of each initial image, which can improve detection efficiency.

[0119] Of course, in other embodiments, the column average gray value can be calculated for the initial image of each product on the production line, and then flat field correction can be performed based on the column average gray value to generate a self-flat field corrected image corresponding to each initial image, thereby improving the accuracy of the obtained self-flat field corrected image, further reducing the risk of false detection and false negative detection, and improving the accuracy and precision of subsequent detection results.

[0120] In actual implementation, users can choose the best processing method based on actual needs and testing requirements; this application does not impose any restrictions.

[0121] The background image processing method provided in this application can be executed by a background image processing device. This application uses a background image processing device executing the background image processing method as an example to illustrate the background image processing device provided in this application.

[0122] This application also provides a background image processing apparatus.

[0123] like Figure 4 As shown, the background image processing device includes: a first processing module 410, a second processing module 420 and a third processing module 430.

[0124] The first processing module 410 is used to determine the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value.

[0125] The second processing module 420 is used to determine the self-flattened field correction image based on the optimized grayscale values ​​corresponding to each pixel in the initial image.

[0126] The third processing module 430 is used to determine the defect feature map corresponding to the product under test based on the self-flattened field correction image.

[0127] According to the background image processing apparatus provided in the embodiments of this application, a self-flattened image is obtained by performing self-flattened field correction on the initial image, which can transform it into an image with uniform grayscale values ​​without losing image details. Then, a defect feature map is determined based on the self-flattened field correction image, which can meet the defect detection of products with complex and varied image backgrounds and large grayscale value fluctuations. The detection results have high accuracy and precision, are not easy to miss or falsely detect, have a wider range of applications, and strong detection capabilities.

[0128] In some embodiments, the first processing module 410 may also be used for:

[0129] Determine the product of the difference and the gain coefficient;

[0130] The sum of the product and the target value is used to determine the optimized grayscale value.

[0131] In some embodiments, the device may further include:

[0132] The fourth processing module is used to traverse each column of the initial image before determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value corresponding to the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value. The average pixel value is determined as the average pixel value corresponding to at least some pixels in the target column of the initial image. The target column is the column where the target pixel is located.

[0133] The fifth processing module is used to determine the difference between the pixel value corresponding to the target pixel and the average pixel value corresponding to the target column.

[0134] In some embodiments, the third processing module 430 can also be used for:

[0135] The self-flattened field-corrected image is filtered to obtain the first image;

[0136] Image segmentation is performed on the first image based on the target threshold to obtain the defect feature map.

[0137] According to the background image processing apparatus provided in the embodiments of this application, by filtering the self-flattened field corrected image, noise interference in the background of the self-flattened field corrected image can be filtered out, reducing the error caused by noise to subsequent image segmentation and feature extraction, thereby further improving the image precision, accuracy and image quality of the defect feature map.

[0138] In some embodiments, when there are multiple products to be tested, and each of the multiple products to be tested corresponds one-to-one with a multiple initial image, the first processing module 410 can also be used for:

[0139] Based on the difference between the average pixel value of the target initial image and the pixel value of the target pixel in any initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel in any initial image is determined.

[0140] In some embodiments, the device may further include a sixth processing module for:

[0141] Extract one image from every target number of images from multiple initial images and determine it as the target initial image corresponding to the target number of images.

[0142] According to the background image processing apparatus provided in the embodiments of this application, the average pixel value is determined by selecting one target initial image from multiple initial images, without having to calculate the corresponding average pixel value based on the pixel value of each initial image, which can improve detection efficiency.

[0143] The background image processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0144] The background image processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0145] The background image processing device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0146] In some embodiments, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501, a memory 502, and a computer program stored in the memory 502 and executable on the processor 501. When the program is executed by the processor 501, it implements the various processes of the above-described background image processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0147] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0148] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described background image processing method.

[0149] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0150] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described background image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0151] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0152] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0154] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0155] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0156] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.

Claims

1. A background image processing method, characterized in that, include: Based on the difference between the average pixel value of the initial image corresponding to the product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel is determined; wherein, the target value is the target value for self-flattening correction. Based on the optimized grayscale values ​​corresponding to each pixel in the initial image, a self-flattened field correction image is determined. Based on the self-flattened field correction image, the defect feature map corresponding to the product under test is determined; The step of determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value includes: Determine the product of the difference and the gain coefficient; The sum of the product and the target value is determined as the optimized grayscale value.

2. The background image processing method according to claim 1, characterized in that, Before determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, the method further includes: Traverse each column of the initial image and determine the average pixel value corresponding to at least a portion of the pixels in the target column of the initial image as the average pixel value corresponding to the target column; the target column is the column where the target pixel is located. The difference between the pixel value corresponding to the target pixel and the average pixel value corresponding to the target column is determined as the difference value.

3. The background image processing method according to any one of claims 1-2, characterized in that, The step of determining the defect feature map corresponding to the product under test based on the self-flattened field correction image includes: The self-flattened field-corrected image is filtered to obtain a first image; The first image is segmented based on the target threshold to obtain the defect feature map.

4. The background image processing method according to any one of claims 1-2, characterized in that, When there are multiple products to be tested, each product corresponds one-to-one with a multiple initial images. The step of determining the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the product to be tested and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value, includes: Based on the difference between the average pixel value of the target initial image and the pixel value of the target pixel in any initial image, the gain coefficient, and the target value, the optimized grayscale value corresponding to the target pixel in any initial image is determined.

5. The background image processing method according to claim 4, characterized in that, The initial target image is determined through the following steps: One image is extracted from every target number of images from the plurality of initial images, and this image is determined as the target initial image corresponding to the target number of images.

6. A background image processing apparatus, characterized in that, include: The first processing module is used to determine the optimized grayscale value corresponding to the target pixel based on the difference between the average pixel value of the initial image corresponding to the acquired product under test and the pixel value of the target pixel in the initial image, the gain coefficient, and the target value; wherein, the target value is the target value for self-flattening correction. The second processing module is used to determine the self-flattened correction image based on the optimized grayscale values ​​corresponding to each pixel in the initial image. The third processing module is used to determine the defect feature map corresponding to the product under test based on the self-flattened field correction image; The first processing module is specifically used to determine the product of the difference and the gain coefficient; The sum of the product and the target value is determined as the optimized grayscale value.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the background image processing method as described in any one of claims 1-5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the background image processing method as described in any one of claims 1-5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the background image processing method as described in any one of claims 1-5.