CN116416227A - Background image processing method and device - Google Patents
Background image processing method and device Download PDFInfo
- Publication number
- CN116416227A CN116416227A CN202310281355.1A CN202310281355A CN116416227A CN 116416227 A CN116416227 A CN 116416227A CN 202310281355 A CN202310281355 A CN 202310281355A CN 116416227 A CN116416227 A CN 116416227A
- Authority
- CN
- China
- Prior art keywords
- image
- target
- value
- pixel
- initial
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 42
- 238000003705 background correction Methods 0.000 claims abstract description 50
- 230000007547 defect Effects 0.000 claims abstract description 47
- 238000012937 correction Methods 0.000 claims abstract description 16
- 238000010586 diagram Methods 0.000 claims abstract description 14
- 238000012545 processing Methods 0.000 claims description 44
- 238000000034 method Methods 0.000 claims description 31
- 238000004590 computer program Methods 0.000 claims description 13
- 238000001914 filtration Methods 0.000 claims description 12
- 238000003709 image segmentation Methods 0.000 claims description 9
- 238000003860 storage Methods 0.000 claims description 7
- 238000001514 detection method Methods 0.000 abstract description 50
- 230000000007 visual effect Effects 0.000 abstract 1
- 239000011521 glass Substances 0.000 description 15
- 230000008569 process Effects 0.000 description 14
- 238000004891 communication Methods 0.000 description 6
- 238000004519 manufacturing process Methods 0.000 description 6
- 238000000576 coating method Methods 0.000 description 5
- 238000000605 extraction Methods 0.000 description 5
- 239000011248 coating agent Substances 0.000 description 4
- 238000013528 artificial neural network Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000004049 embossing Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003190 augmentative effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003313 weakening effect Effects 0.000 description 2
- 239000011247 coating layer Substances 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000007788 liquid Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
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 a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to the obtained product to be detected and a pixel value of the target pixel point in the initial image; 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 characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image. According to the background image processing method, an initial image can be converted into an image with uniform gray values without losing image details, then a defect characteristic diagram is determined based on the self-leveling correction image, defect detection of products with complex and changeable image background and large gray value fluctuation is met, accuracy and precision of detection results are high, missed detection or false detection is not easy, and the application range is wider.
Description
Technical Field
The application belongs to the field of industrial vision detection, and particularly relates to a background image processing method and device.
Background
When the glass coating is detected, the defect detection is realized mainly by collecting the image of the glass and extracting the characteristics of the image. In the related art, noise interference in a complex background is filtered mainly by using filtering with different sizes on an image, then an absolute threshold is used to detect whether a defect exists in the filtered image, and if the gray value of a filtered pixel exceeds a set threshold, the current pixel is regarded as the defect. The method cannot be suitable for a complex image background caused by a detection environment with complex and changeable product specifications, and false detection and omission detection are easy to cause; and the detection accuracy is poor.
Disclosure of Invention
The present application aims to solve at least one of the technical problems existing in the prior art. Therefore, the background image processing method and device are provided, the accuracy and precision of the detection result are high, the detection is not easy to miss or misdetect, and the application range is wider.
In a first aspect, the present application provides a background image processing method, including:
determining an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to an obtained product to be detected and a pixel value of the target pixel point in the initial image;
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 characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image.
According to the background image processing method, the self-flat field correction image is obtained by carrying out self-flat field correction on the initial image, the self-flat field correction image can be converted into an image with uniform gray values without losing image details, then the defect feature map is determined based on the self-flat field correction image, the defect detection of products with complex and changeable image background and larger gray value fluctuation is met, the accuracy and precision of a detection result are high, the detection is not easy to miss or misdetect, and the application range is wider.
According to an embodiment of the present application, the determining, based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an obtained initial image corresponding to a product to be tested and a pixel value of a target pixel point in the initial image, an optimized gray value corresponding to the target pixel point includes:
determining a product of the difference and the gain factor;
and determining the sum of the product and the target value as the optimized gray value.
According to one embodiment of the present application, before determining the optimized gray value corresponding to the target pixel point based on the obtained difference value, gain coefficient and target value between the pixel average value corresponding to the initial image corresponding to the product to be tested and the pixel value of the target pixel point in the initial image, the method further includes:
traversing each column of the initial image, and determining an average value of pixel values corresponding to at least partial pixel points in a target column of the initial image as the average value of pixels corresponding to the target column; the target column is the column where the target pixel point is located;
and determining the difference between the pixel value corresponding to the target pixel point and the pixel average value corresponding to the target column as the difference value.
According to an embodiment of the present application, the determining, based on the self-leveling field correction image, a defect feature map corresponding to the product to be tested includes:
filtering the self-flat field correction image to obtain a first image;
and performing image segmentation processing on the first image based on a target threshold value to acquire the defect feature map.
According to the background image processing method, the self-flat-field correction image is subjected to filtering processing, so that noise interference in the self-flat-field correction image background can be filtered, errors caused by noise on subsequent image segmentation and feature extraction are reduced, and therefore image precision, accuracy and image quality of the defect feature image are further improved.
According to an embodiment of the present application, in a case that the number of products to be tested is plural, the plural products to be tested are in one-to-one correspondence with plural initial images, and determining, based on a difference value between a pixel average value corresponding to an initial image corresponding to the obtained product to be tested and a pixel value of a target pixel point in the initial image, a gain coefficient, and a target value, an optimized gray value corresponding to the target pixel point includes:
and determining an optimized gray value corresponding to the target pixel point in any initial image based on a difference value, a gain coefficient and a target value between the pixel average value corresponding to the target initial image in the plurality of initial images and the pixel value of the target pixel point in any initial image.
According to one embodiment of the application, the initial image of the target is determined by:
and extracting one image from the plurality of initial images at intervals of a target number of images, and determining the initial images as target initial images corresponding to the target number of images.
According to the background image processing method, the pixel average value is determined by selecting one target initial image from a plurality of initial images, and the detection efficiency can be improved without calculating the corresponding pixel average value based on the pixel value of each initial image.
In a second aspect, the present application provides a background image processing apparatus, the apparatus comprising:
the first processing module is used for determining an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to an obtained product to be detected and the pixel value of the target pixel point in the initial image;
the second processing module is used for determining a self-flat field correction image based on the optimized gray value corresponding to each pixel point in the initial image;
and the third processing module is used for determining a defect characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image.
According to the background image processing device, the self-flat field correction image is obtained by carrying out self-flat field correction on the initial image, the self-flat field correction image can be converted into an image with uniform gray values without losing image details, then the defect feature map is determined based on the self-flat field correction image, the defect detection of a product with complex and changeable image background and larger gray value fluctuation is met, the accuracy and precision of a detection result are high, the detection is not easy to miss or misdetect, and the application range is wider.
According to an embodiment of the present application, in a case that the number of products to be tested is plural, the plural products to be tested are in one-to-one correspondence with the plural initial images, and the first processing module is further configured to:
and determining an optimized gray value corresponding to the target pixel point in any initial image based on the difference value, the gain coefficient and the target value between the pixel average value corresponding to the target initial image in the plurality of initial images and the pixel value of the target pixel point in any initial image.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the background image processing method according to the first aspect when the processor executes the computer program.
In a fourth aspect, the present application provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a background image processing method as described in the first aspect above.
In a fifth aspect, the present application provides a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being configured to execute a program or instructions to implement the background image processing method according to the first aspect.
In a sixth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements a background image processing method as described in the first aspect above.
The above technical solutions in the embodiments of the present application have at least one of the following technical effects:
the initial image is subjected to self-flat field correction to obtain a self-flat field correction image, the self-flat field correction image can be converted into an image with uniform gray values without losing image details, then a defect characteristic diagram is determined based on the self-flat field correction image, defect detection of products with complex and changeable image background and larger gray value fluctuation is met, the accuracy and precision of a detection result are higher, omission detection or false detection are not easy, and the application range is wider.
Furthermore, by filtering the self-flat-field correction image, noise interference in the background of the self-flat-field correction image can be filtered, and errors caused by noise on subsequent image segmentation and feature extraction are reduced, so that the image precision, accuracy and image quality of the defect feature image are further improved.
Further, by selecting one target initial image from the plurality of initial images to determine the pixel average value, it is not necessary to calculate the corresponding pixel average value based on the pixel value of each initial image, respectively, and the detection efficiency can be improved.
Additional aspects and advantages of the 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 the application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, wherein:
fig. 1 is one of flow diagrams of a background image processing method provided in an embodiment of the present application;
FIG. 2 is a second flowchart of a background image processing method according to an embodiment of the present disclosure;
FIG. 3 is a third flowchart of a background image processing method according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a background image processing apparatus provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application are within the scope of the protection of the present application.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type and not limited to the number of objects, e.g., the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The background image processing method, the background image processing device, the electronic device and the readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings by means of specific embodiments and application scenarios thereof.
The background image processing method can be applied to the terminal, and can be specifically executed by hardware or software in the terminal.
The terminal includes, but is not limited to, a portable communication device such as a mobile phone or tablet computer. It should also be appreciated that in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer.
It should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.
The execution subject of the background image processing method provided in the embodiment of the present application may be an electronic device or a functional module or a functional entity capable of implementing the background image processing method in the electronic device, where the electronic device mentioned in the embodiment of the present application includes, but is not limited to, a mobile phone, a tablet computer, a camera, a wearable device, and the like, and the background image processing method provided in the embodiment of the present application is described below by taking the electronic device as an execution subject.
The background image processing method is applied to the product defect detection scene.
As shown in fig. 1, the background image processing method includes: step 110, step 120 and step 130.
Step 110, determining an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to the obtained product to be detected and a pixel value of the target pixel point in the initial image;
in this step, the product to be measured may be glass, on which there are a coating film, embossing, etc.
In actual production, one detection device can detect 1-3 glass sources of different production lines at the same time, and the specifications of the glass sources may be the same or different.
In the application, an image of a product to be measured can be acquired through an image sensor, for example, an image of the product to be measured is acquired through a linear array camera, so as to obtain an initial image.
The initial image may be a gray scale image.
The initial image includes product features and background region features.
It will be appreciated that during actual manufacturing, the glass and coating process is not stable, resulting in the same gauge glass, as well as some fluctuations in its initial image. In addition, the background of each initial image may be different due to factors such as embossing and glass tilting, that is, the brightness of the background and the embossing position of the initial image captured by the same equipment may be different for different glasses with the same specification.
In addition, the glass has various specifications, and the glass thickness, the roughness of the glass surface, the thickness of the coating layer, the type of coating liquid and the like of the glass with different specifications are different, so that the glass with different specifications is caused, and the background brightness values of corresponding initial images are greatly different.
In this application, the initial image may be an image whose background is complex and variable and whose gray value fluctuates irregularly.
The pixel average value, the gain coefficient and the target value are the standard values obtained in advance and are used for reducing the fluctuation degree of the gray scale of the background area in the initial image.
The pixel average value may be determined by the terminal based on an algorithm, or may be customized based on a user, or may be determined in other manners, which is not limited herein.
It should be noted that an initial image may correspond to one pixel average value, or may also correspond to a plurality of pixel average values, for example, different areas in the initial image correspond to different pixel average values.
The target value is a self-leveling field corrected target value for correcting an initial image in which the background is complex and changeable and the gray value fluctuates irregularly into an image fluctuating up and down at the target value to reduce the fluctuation degree of the background pixel.
It will be appreciated that in the actual process, the same target value may be set for the initial images corresponding to the products of different product specifications and the different initial images corresponding to the same product specification, so as to correct the initial images of different gray scale fluctuations into images of uniform background gray scale values.
The gain factor and target value may be user-defined based.
The optimized gray value is a new pixel value obtained after the fluctuation weakening processing is carried out on the original gray value of the target pixel point.
The target pixel may be any pixel in the initial image.
In this step, an optimized gray value corresponding to each pixel point in the initial image may be determined based on the difference between the pixel average value and the pixel value of the target pixel point in the initial image, the gain coefficient, and the target value, respectively.
As shown in fig. 2, in some embodiments, step 110 may include:
determining the product of the difference and the gain coefficient;
the sum of the product and the target value is determined as the optimized gray value.
In this embodiment, all pixels of the initial image are traversed, and the difference is calculated by subtracting the average value of the pixels corresponding to the pixels from the gray value corresponding to the pixels.
And then multiplying the obtained difference value by a gain coefficient, and adding a self-leveling field correction target value to obtain a self-leveling field correction result of the pixel point.
And finally, taking the self-flat field correction result of each pixel point as an optimized gray value of the pixel point.
With continued reference to fig. 2, in some embodiments, prior to step 110, the method may further include:
traversing each column of the initial image, and determining the average value of pixel values corresponding to at least part of pixel points in a target column of the initial image as the average value of pixels corresponding to the target column; the target column is the column where the target pixel point is located;
and determining the difference between the pixel value corresponding to the target pixel point and the average value of the pixels corresponding to the target column as a difference value.
In this embodiment, the target column may be a column corresponding to any column of pixels in the initial image.
The target column corresponds to the target pixel point, namely the target column is the column where the target pixel point is located.
In the actual execution process, the average value of the pixel values corresponding to all the pixel points in the target column can be determined as the average value of the pixels corresponding to the target column; or, a part of pixel points may be selected from all the pixel points in the target column, and an average value of pixel values corresponding to the selected part of pixel points may be determined as an average value of pixels corresponding to the target column.
For example, the average gray level of the first 256 points of each column of pixels is traversed as the pixel average value corresponding to the column.
In this embodiment, the average value of pixels corresponding to each pixel point in the same column is the same; the average values of the pixels corresponding to different columns may or may not be the same.
in this step, the self-leveling field corrected image is an image obtained by subjecting the background of the initial image to a fluctuation weakening process.
The self-leveling field corrected image is a gray scale image.
In this application, after obtaining the self-flat field correction result corresponding to each pixel point in the manner set forth in step 110, the self-flat field correction result of each pixel point is used as the optimized gray value of the pixel point, so as to obtain the self-flat field correction image.
And 130, determining a defect characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image.
In this step, the defect feature map may be a binary map, which is used to characterize defects of the product to be tested, such as defects of the glass coating.
In the actual implementation process, a threshold method can be adopted to extract defect characteristics so as to generate a defect characteristic diagram; or a neural network mode can be adopted, for example, the self-flat-field correction image is input into a pre-trained neural network, and a defect characteristic diagram corresponding to the self-flat-field correction image output by the neural network is obtained; or any other realizable manner may be used, and the application is not limited thereto.
The inventor finds that in the research and development process, an absolute threshold method is mainly adopted for detection in the related technology, filtering with different sizes is used for the image according to different image background interferences, noise interferences in a complex background are filtered, and then an absolute threshold is used for detecting whether defects exist in the image; if the gray value of the filtered pixel exceeds the set threshold, the current pixel is regarded as a defect. However, the method has limited application scenes, such as when products are changed to different specifications, the whole gray value of the image can also be changed greatly, and the method cannot adapt to the change of the gray value of the image caused by the change of the specifications of the products, so that false detection and omission are easy to cause.
In the application, corresponding optimized gray values are determined based on different initial images to perform self-flat-field correction to obtain a self-flat-field correction image, the self-flat-field correction image is detected, the initial images with different brightness caused by different product specifications can be corrected into images with uniform background gray values after self-flat-field correction, image details are not lost, and therefore image gray value fluctuation caused by different product specification changes can be adapted. Aiming at the scene with higher detection requirement, the threshold can be conveniently adjusted tightly, and more suspected defects are detected.
According to the background image processing method provided by the embodiment of the application, the self-flat field correction image is obtained by carrying out self-flat field correction on the initial image, the self-flat field correction image can be converted into an image with uniform gray values without losing image details, then the defect feature map is determined based on the self-flat field correction image, the defect detection of a product with complex and changeable image background and larger gray value fluctuation is met, the accuracy and precision of a detection result are higher, the detection is not easy to miss detection or false detection, the application range is wider, and the detection capability is strong.
The implementation of step 130 will be specifically described below using a thresholding method as an example.
As shown in fig. 3, in some embodiments, step 130 may include:
filtering the self-leveling field correction image to obtain a first image;
and performing image segmentation processing on the first image based on the target threshold value to obtain a defect feature map.
In this embodiment, the first image is an image obtained by filtering the self-leveling field corrected image.
By filtering the self-leveling field correction image, noise interference in the background of the self-leveling field correction image can be filtered, and errors caused by subsequent image segmentation and feature extraction by noise are reduced, so that the image precision, accuracy and image quality of the defect feature image are further improved.
The target threshold may be user-defined based.
The value of the target threshold may be automatically determined based on factors such as detection accuracy and image quality of the self-leveling field corrected image, or may be user-defined, which is not limited in this application.
It can be understood that if the gray value exceeds the target threshold, the current pixel point is considered as a defect; and if the gray value does not exceed the target threshold value, the current pixel point is considered not to be a defect.
In the actual implementation process, the steps 110 to 130 may be implemented by using a corresponding algorithm, where an input of the algorithm is an initial image, and an output is a binary image of the defect feature in the initial image (i.e., a defect feature image).
According to the background image processing method provided by the embodiment of the application, through filtering processing of the self-flat-field correction image, noise interference in the self-flat-field correction image background can be filtered, errors caused by subsequent image segmentation and feature extraction by noise are reduced, and therefore image precision, accuracy and image quality of a defect feature image are further improved.
In some embodiments, in the case that the number of products to be tested is plural, the plural products to be tested are in one-to-one correspondence with the plural initial images, step 110 may include:
and determining an optimized gray value corresponding to the target pixel point in any initial image based on the difference value, the gain coefficient and the target value between the pixel average value corresponding to the target initial image in the plurality of initial images and the pixel value of the target pixel point in any initial image.
In this embodiment, the plurality of products to be tested are a plurality of products to be tested on a production line.
In the actual execution process, a plurality of products to be detected are arranged on a production line and move along with the movement of the production line, when each product to be detected moves to the area where the field of view of the image sensor is located, the image sensor performs image acquisition on the product to be detected, and an initial image corresponding to the product to be detected is generated, so that a plurality of continuous initial images can be obtained, and each product to be detected corresponds to one initial image.
The target initial image may be any one of a plurality of initial images.
In this embodiment, an image (i.e., a target initial image) may be randomly selected from a plurality of initial images, and the pixel average value corresponding to the target initial image may be calculated, and the pixel average value corresponding to the target initial image may be respectively determined as the pixel average value corresponding to any one of the plurality of initial images, so as to respectively calculate the difference value corresponding to each initial image, without respectively calculating the corresponding pixel average value based on the pixel value of each initial image, thereby improving the detection efficiency.
In some embodiments, the initial image of the target may be determined by:
and extracting one image from the plurality of initial images at intervals of the target number of images, and determining the initial images as target initial images corresponding to the target number of images.
In this embodiment, the target number is an integer of 1 or more.
For example, the column average gray value is calculated once every n images (n is equal to or greater than 1 and n is an integer), when a certain image calculates the column average gray value, the column average gray value of the 1 st image is used as a reference for carrying out flat field correction on all the following n images, so that each image can be prevented from being calculated once, and the detection efficiency can be effectively improved.
According to the background image processing method, the pixel average value is determined by selecting one target initial image from a plurality of initial images, and the detection efficiency can be improved without calculating the corresponding pixel average value based on the pixel value of each initial image.
Of course, in other embodiments, the column average gray value of each initial image of each product on the pipeline may be calculated, and then the flat field correction is performed based on the column average gray value to generate the self-flat field correction image corresponding to each initial image, so as to improve the accuracy of the obtained self-flat field correction image, further reduce the risks of false detection and omission, and improve the accuracy and precision of the subsequent detection result.
In the actual implementation process, the user may select an optimal processing manner based on the actual requirement and the detection requirement, which is not limited in this application.
According to the background image processing method provided by the embodiment of the application, the execution subject can be a background image processing device. In the embodiment of the present application, a background image processing apparatus is described by taking an example in which the background image processing apparatus executes a background image processing method.
The embodiment of the application also provides a background image processing device.
As shown in fig. 4, the background image processing apparatus includes: a first processing module 410, a second processing module 420, and a third processing module 430.
The first processing module 410 is configured to determine an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to the obtained product to be detected and a pixel value of the target pixel point in the initial image;
a second processing module 420, configured to determine a self-flat-field corrected image based on the optimized gray values corresponding to the pixels in the initial image;
the third processing module 430 is configured to determine a defect feature map corresponding to the product to be tested based on the self-leveling field correction image.
According to the background image processing device provided by the embodiment of the application, the self-flat field correction image is obtained by carrying out self-flat field correction on the initial image, the self-flat field correction image can be converted into an image with uniform gray values without losing image details, then the defect characteristic diagram is determined based on the self-flat field correction image, the defect detection of a product with complex and changeable image background and larger gray value fluctuation is met, the accuracy and precision of a detection result are higher, the detection is not easy to miss detection or false detection, the application range is wider, and the detection capability is strong.
In some embodiments, the first processing module 410 may also be configured to:
determining the product of the difference and the gain coefficient;
the sum of the product and the target value is determined as the optimized gray value.
In some embodiments, the apparatus may further comprise:
the fourth processing module is used for traversing each column of the initial image before determining the optimized gray value corresponding to the target pixel point based on the obtained difference value, gain coefficient and target value between the pixel average value corresponding to the initial image corresponding to the product to be detected and the pixel value of the target pixel point in the initial image, and determining the average value of the pixel values corresponding to at least part of the pixel points in the target column of the initial image as the pixel average value corresponding to the target column; the target column is the column where the target pixel point is located;
and the fifth processing module is used for determining the difference between the pixel value corresponding to the target pixel point and the pixel average value corresponding to the target column as a difference value.
In some embodiments, the third processing module 430 may also be configured to:
filtering the self-leveling field correction image to obtain a first image;
and performing image segmentation processing on the first image based on the target threshold value to obtain a defect feature map.
According to the background image processing device provided by the embodiment of the application, through filtering processing of the self-flat-field correction image, noise interference in the self-flat-field correction image background can be filtered, errors caused by subsequent image segmentation and feature extraction by noise are reduced, and therefore image precision, accuracy and image quality of a defect feature image are further improved.
In some embodiments, in the case that the number of products to be tested is plural, the plural products to be tested are in one-to-one correspondence with the plural initial images, and the first processing module 410 may be further configured to:
and determining an optimized gray value corresponding to the target pixel point in any initial image based on the difference value, the gain coefficient and the target value between the pixel average value corresponding to the target initial image in the plurality of initial images and the pixel value of the target pixel point in any initial image.
In some embodiments, the apparatus may further include a sixth processing module for:
and extracting one image from the plurality of initial images at intervals of the target number of images, and determining the initial images as target initial images corresponding to the target number of images.
According to the background image processing device provided by the embodiment of the application, the pixel average value is determined by selecting one target initial image from a plurality of initial images, and the detection efficiency can be improved without calculating the corresponding pixel average value based on the pixel value of each initial image.
The background image processing apparatus in the embodiment of the present application may be an electronic device, or may be a component in an electronic device, for example, an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices than a terminal. By way of example, the electronic device may be a mobile phone, tablet computer, notebook computer, palm computer, vehicle-mounted electronic device, mobile internet appliance (Mobile Internet Device, MID), augmented reality (augmented reality, AR)/Virtual Reality (VR) device, robot, wearable device, ultra-mobile personal computer, UMPC, netbook or personal digital assistant (personal digital assistant, PDA), etc., but may also be a server, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (TV), teller machine or self-service machine, etc., and the embodiments of the present application are not limited in particular.
The background image processing apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which is not specifically limited in the embodiments of the present application.
The background image processing apparatus provided in the embodiment of the present application can implement each process implemented by the embodiments of the methods of fig. 1 to 3, and in order to avoid repetition, a description is omitted here.
In some embodiments, as shown in fig. 5, the embodiment of the present application further provides an electronic device 500, including a processor 501, a memory 502, and a computer program stored in the memory 502 and capable of running on the processor 501, where the program when executed by the processor 501 implements the respective processes of the background image processing method embodiment described above, and the same technical effects can be achieved, so that repetition is avoided, and no further description is given here.
The electronic device in the embodiment of the application includes the mobile electronic device and the non-mobile electronic device described above.
The embodiment of the application also provides a computer program product, which comprises a computer program, and the computer program realizes the background image processing method when being executed by a processor.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes computer readable storage medium such as computer readable memory ROM, random access memory RAM, magnetic or optical disk, etc.
The embodiment of the application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used for running a program or an instruction, so as to implement each process of the background image processing method embodiment, and achieve the same technical effect, so that repetition is avoided, and no redundant description is provided here.
It should be understood that the chips referred to in the embodiments of the present application may also be referred to as system-on-chip chips, chip systems, or system-on-chip chips, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.
In the description of the present specification, reference to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.
Claims (10)
1. A background image processing method, characterized by comprising:
determining an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to an obtained product to be detected and a pixel value of the target pixel point in the initial image;
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 characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image.
2. The background image processing method according to claim 1, wherein the determining the optimized gray value corresponding to the target pixel point based on the obtained difference value, gain coefficient and target value between the pixel average value corresponding to the initial image corresponding to the product to be detected and the pixel value of the target pixel point in the initial image includes:
determining a product of the difference and the gain factor;
and determining the sum of the product and the target value as the optimized gray value.
3. The background image processing method according to claim 1, wherein before the determining of the optimized gray value corresponding to the target pixel point based on the obtained difference value, gain coefficient, and target value between the pixel average value corresponding to the initial image corresponding to the product to be measured and the pixel value of the target pixel point in the initial image, the method further comprises:
traversing each column of the initial image, and determining an average value of pixel values corresponding to at least partial pixel points in a target column of the initial image as the average value of pixels corresponding to the target column; the target column is the column where the target pixel point is located;
and determining the difference between the pixel value corresponding to the target pixel point and the pixel average value corresponding to the target column as the difference value.
4. A background image processing method according to any one of claims 1 to 3, wherein the determining, based on the self-leveling field correction image, a defect feature map corresponding to the product to be tested includes:
filtering the self-flat field correction image to obtain a first image;
and performing image segmentation processing on the first image based on a target threshold value to acquire the defect feature map.
5. A background image processing method according to any one of claims 1 to 3, wherein, in a case where the number of products to be detected is plural, the plural products to be detected are in one-to-one correspondence with plural initial images, and the determining the optimized gray value corresponding to the target pixel based on the obtained difference value, gain coefficient, and target value between the pixel average value corresponding to the initial image corresponding to the product to be detected and the pixel value of the target pixel in the initial image comprises:
and determining an optimized gray value corresponding to the target pixel point in any initial image based on a difference value, a gain coefficient and a target value between the pixel average value corresponding to the target initial image in the plurality of initial images and the pixel value of the target pixel point in any initial image.
6. The background image processing method according to claim 5, wherein the target initial image is determined by:
and extracting one image from the plurality of initial images at intervals of a target number of images, and determining the initial images as target initial images corresponding to the target number of images.
7. A background image processing apparatus, characterized by comprising:
the first processing module is used for determining an optimized gray value corresponding to a target pixel point based on a difference value, a gain coefficient and a target value between a pixel average value corresponding to an initial image corresponding to an obtained product to be detected and the pixel value of the target pixel point in the initial image;
the second processing module is used for determining a self-flat field correction image based on the optimized gray value corresponding to each pixel point in the initial image;
and the third processing module is used for determining a defect characteristic diagram corresponding to the product to be detected based on the self-leveling field correction image.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the background image processing method according to any one of claims 1-6 when the program is executed by the processor.
9. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the background image processing method according to any of claims 1-6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the background image processing method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310281355.1A CN116416227A (en) | 2023-03-20 | 2023-03-20 | Background image processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310281355.1A CN116416227A (en) | 2023-03-20 | 2023-03-20 | Background image processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116416227A true CN116416227A (en) | 2023-07-11 |
Family
ID=87049062
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310281355.1A Pending CN116416227A (en) | 2023-03-20 | 2023-03-20 | Background image processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116416227A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117152014A (en) * | 2023-09-05 | 2023-12-01 | 珠海圣美生物诊断技术有限公司 | Flat field correction method and device for multichannel fluorescence microscope |
CN118982717A (en) * | 2024-08-06 | 2024-11-19 | 广州碧德科技股份有限公司 | A method and system for detecting abnormality of metal thermos cup wall based on homogenization of reflective area |
-
2023
- 2023-03-20 CN CN202310281355.1A patent/CN116416227A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117152014A (en) * | 2023-09-05 | 2023-12-01 | 珠海圣美生物诊断技术有限公司 | Flat field correction method and device for multichannel fluorescence microscope |
CN117152014B (en) * | 2023-09-05 | 2024-05-28 | 珠海圣美生物诊断技术有限公司 | Flat field correction method and device for multichannel fluorescence microscope |
CN118982717A (en) * | 2024-08-06 | 2024-11-19 | 广州碧德科技股份有限公司 | A method and system for detecting abnormality of metal thermos cup wall based on homogenization of reflective area |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109118542B (en) | Calibration method, device, equipment and storage medium between laser radar and camera | |
CN111768392B (en) | Target detection method and device, electronic equipment and storage medium | |
CN116416227A (en) | Background image processing method and device | |
CN116958145B (en) | Image processing method and device, visual detection system and electronic equipment | |
CN111598801B (en) | Identification method for weak Mura defect | |
CN117788798A (en) | Target detection method and device, visual detection system and electronic equipment | |
CN112686893B (en) | Satellite image block adjustment method and device | |
CN116152261B (en) | Visual inspection system for quality of printed product | |
CN116109572A (en) | Workpiece edge weak defect detection method and device and electronic equipment | |
CN118411382B (en) | Boundary point detection method, boundary point detection device, electronic equipment and storage medium | |
CN114998186A (en) | Image processing-based method and system for detecting surface scab defect of copper starting sheet | |
Fabijańska | Subpixel edge detection in blurry and noisy images | |
CN115546271B (en) | Visual analysis method, device, equipment and medium based on depth joint characterization | |
CN118488329A (en) | Pixel dead pixel correction method and device, electronic equipment and storage medium | |
CN117788433A (en) | Glass defect detection method | |
CN116958058A (en) | Lens dirt detection method and device and image detection equipment | |
US12033315B1 (en) | Machine vision-based techniques for non-contact structural health monitoring | |
CN110634124A (en) | Method and equipment for area detection | |
CN118411381B (en) | Boundary coordinate detection method, device, electronic equipment and storage medium | |
CN119006839B (en) | Multi-mode remote sensing image normalization structural feature extraction method and system | |
CN117710398A (en) | Contour edge extraction method and device | |
CN116309288A (en) | Image detection method and image detection device | |
CN117474858A (en) | Defect detection method and device, visual detection system and electronic equipment | |
CN118097428A (en) | Training method and device for vector image alignment model and electronic equipment | |
Gajjar et al. | Trigonometry-based motion blur parameter estimation algorithm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB03 | Change of inventor or designer information | ||
CB03 | Change of inventor or designer information |
Inventor after: Sun Pengyu Inventor after: Yang Yinghao Inventor after: Yao Yi Inventor after: Bao Zhenjian Inventor before: Sun Pengyu Inventor before: Yang Yinghao Inventor before: Yao Yi Inventor before: Bao Zhenjian |