CN116309440B - Method and device for manufacturing template image for AOI detection - Google Patents
Method and device for manufacturing template image for AOI detection Download PDFInfo
- Publication number
- CN116309440B CN116309440B CN202310253757.0A CN202310253757A CN116309440B CN 116309440 B CN116309440 B CN 116309440B CN 202310253757 A CN202310253757 A CN 202310253757A CN 116309440 B CN116309440 B CN 116309440B
- Authority
- CN
- China
- Prior art keywords
- template image
- initial template
- initial
- image
- value
- 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.)
- Active
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 60
- 238000004519 manufacturing process Methods 0.000 title claims abstract description 27
- 238000000034 method Methods 0.000 title claims abstract description 20
- 230000009466 transformation Effects 0.000 claims description 51
- 238000012545 processing Methods 0.000 claims description 18
- 238000013507 mapping Methods 0.000 claims description 13
- 238000012937 correction Methods 0.000 claims description 12
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims description 9
- 230000006870 function Effects 0.000 claims description 9
- 238000006243 chemical reaction Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 6
- 238000005315 distribution function Methods 0.000 claims description 6
- 230000001131 transforming effect Effects 0.000 claims description 6
- 230000008569 process Effects 0.000 abstract description 4
- 238000005457 optimization Methods 0.000 description 4
- 238000000844 transformation Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000013519 translation Methods 0.000 description 3
- 238000012935 Averaging Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000008685 targeting Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
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
- G06T7/001—Industrial image inspection using an image reference approach
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/751—Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/758—Involving statistics of pixels or of feature values, e.g. histogram matching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20216—Image averaging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30121—CRT, LCD or plasma display
-
- 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)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method for manufacturing a template image for AOI detection, which is characterized in that an average template image among a plurality of initial template images is obtained to be used as a final template image for AOI detection, in the process of updating the initial template images, the deviation among the initial images is compared and judged, the initial template image with larger deviation is removed, and only the initial template image with smaller deviation degree is reserved to obtain the average template image. The template image manufactured by the manufacturing method can reduce false detection rate and missing detection rate of AOI detection and improve accuracy and efficiency of AOI detection. The invention also discloses a device for manufacturing the template image for AOI detection, which corresponds to the manufacturing method.
Description
Technical Field
The invention relates to an AOI detection technology, in particular to a method and a device for manufacturing a template image for AOI detection.
Background
When the AOI detection of poor display is performed on the display equipment, a template image is generally required to be manufactured by collecting a picture of a qualified sample, and then the image of the sample to be detected is compared with the template image, so that whether the sample to be detected is qualified or not is judged.
The method for checking the stitch offset of the LCD product by AOI test is disclosed in Chinese patent No. CN201910528120.1, and comprises the following steps:
electrifying an LCD product in the AOI tester, and displaying patterns by the LCD product;
photographing the pattern displayed by the LCD product to generate a contrast image;
and comparing the comparison image with the template image to identify the offset stitch.
However, parameters such as chromaticity and brightness among different qualified samples have deviation, and a camera shooting the template image has deviation with the shooting environment, so that deviation among different template images can occur, if the template images are not well selected, the display equipment can have higher false detection rate and omission rate when carrying out AOI detection, and the accuracy and efficiency of the AOI detection are affected.
Disclosure of Invention
In order to solve the defects in the prior art, the invention provides a method for manufacturing a template image for AOI detection, which can reduce the false detection rate and the omission rate of the AOI detection and improve the accuracy and the efficiency of the AOI detection.
The invention also provides a device for manufacturing the template image for AOI detection, which corresponds to the manufacturing method.
The technical problems to be solved by the invention are realized by the following technical scheme:
a method for manufacturing a template image for AOI detection comprises the following steps:
step 100: acquiring an image of a detection area of a qualified sample as a first initial template image;
step 200: acquiring an image of a detection area of another qualified sample as a second initial template image;
step 300: processing the second initial template image by taking the first initial template image as a target to obtain a temporary template image;
step 400: comparing the deviation between the first initial template image and the temporary template image, and executing step 500 if the deviation between the first initial template image and the temporary template image meets the preset requirement;
step 500: carrying out average processing on the first initial template image and the temporary template image to obtain an average template image between the first initial template image and the temporary template image;
step 600: and taking the average template image as a new first initial template image, repeating the steps 200-600 until the updating times of the first initial template image reach the preset times, and taking the latest first initial template image as a final template image for AOI detection.
Further, in step 400, if the deviation between the first initial template image and the temporary template image does not meet the preset requirement, steps 200-400 are repeated.
Further, in step 300, the processing performed on the second initial template image with the first initial template image as a target includes: at least one of spatial geometry correction and histogram matching.
Further, in step 300, the transformation model used for performing the spatial geometric correction on the second initial template image is a rigid transformation, an affine transformation, a perspective transformation or a nonlinear transformation, with the first initial template image as a target.
Further, in step 300, assuming that the pixel gray level of the first initial template image is z, the pixel gray level of the second initial template image is r, the pixel gray level of the temporary template image is s, and the image gray levels of the first initial template image and the temporary template image are L, histogram matching is performed on the second initial template image with the first initial template image as a target, including the following steps:
step 310: calculating a histogram distribution function pR (r) of the second initial template image;
step 320: defining the conversion function of r to s as T (,) and calculating the mapping relation of k pixels from rk to sk in the range of r E [0, L-1], rounding the value of sk into the integer range [0, L-1],
step 330: calculating a histogram distribution function pZ (z) of the first initial template image;
step 340: defining the conversion function of z to s as G (,) using the following equation (2), calculating the value of G (zq) in the range of q ε [0, L-1], rounding the value of G (zq) into the integer range [0, L-1],
step 350: constructing a lookup table between sk values and G (zq) values;
step 360: for all sk values, looking up the nearest G (zq) value in the lookup table in the range of k E [0, L-1 ];
step 370: inverse transforming the found G (zq) value by adopting the following formula (3) to obtain a corresponding zq value,
z q =G -1 (s k ) (3);
step 380: constructing a mapping relation from sk to zq;
step 390: and matching the histogram of the second initial template image according to the mapping relation between rk and sk and the mapping relation between sk and zq, and constructing a temporary template image corresponding to the matched histogram.
Further, in step 350, if a certain sk value finds that there are a plurality of G (zq) values closest to the sk value in the lookup table, the minimum zq value is uniformly taken.
Further, in step 400, comparing the deviation between the first initial template image and the temporary template image, comprising the steps of:
step 410: performing difference solving processing on the first initial template image and the temporary template image to obtain a difference value array between the first initial template image and the temporary template image;
step 420: solving a maximum value of the difference value array, and if the maximum value is smaller than a first preset threshold value, executing step 430;
step 430: and solving the standard deviation of the difference value array, and if the standard deviation is smaller than a second preset threshold value, judging that the deviation between the first initial template image and the temporary template image meets the preset requirement.
Further, in step 420, if the maximum value is equal to or greater than the first preset threshold value, it is determined that the deviation between the first initial template image and the temporary template image does not meet the preset requirement.
Further, in step 430, if the standard deviation is equal to or greater than the second preset threshold, it is determined that the deviation between the first initial template image and the temporary template image does not meet the preset requirement.
The device for producing the template image for AOI detection comprises a processor and a memory connected with the processor, wherein a computer program for the processor to execute is stored in the memory, and the method for producing the template image for AOI detection is carried out when the processor executes the computer program.
The invention has the following beneficial effects: according to the manufacturing method, the average template image among a plurality of initial template images is obtained and is used as a final template image for AOI detection, the average template image is used for eliminating individual deviation among the initial template images caused by deviation among different qualified samples, deviation among different cameras, deviation among different shooting environments and the like, in the process of updating the initial template images, the initial template image with larger deviation is removed by comparing and judging the deviation among the initial images, only the initial template image with smaller deviation degree is reserved for obtaining the average template image, the influence of the initial template image with larger deviation on the selection of the final template image is prevented, the selection precision of the final template image is improved, the false detection rate and the omission rate of AOI detection caused by the individual deviation among the initial template images are reduced, and the accuracy and the efficiency of AOI detection are improved.
Drawings
Fig. 1 is a block diagram of steps of a method for producing a template image for AOI detection according to the present invention.
Fig. 2 is a block diagram of steps 300 in the method for producing the template image for AOI detection shown in fig. 1.
Fig. 3 is a block diagram of steps 400 in the method for producing the template image for AOI detection shown in fig. 1.
Detailed Description
The present invention is described in detail below with reference to the drawings and the embodiments, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
In the description of the present invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like indicate orientations or positional relationships based on the orientation or positional relationships shown in the drawings, merely to facilitate describing the present invention and simplify the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and therefore should not be construed as limiting the present invention.
Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", or a third "may explicitly or implicitly include one or more such feature. In the description of the present invention, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
In the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured," "disposed," and the like are to be construed broadly and may be, for example, fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, or can be communicated between two elements or the interaction relationship between the two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
Example 1
As shown in fig. 1, a method for producing a template image for AOI detection includes the steps of:
step 100: an image of a detection area of a qualified sample is acquired as a first initial template image.
In this step 100, a camera may be used to capture the detection area of the qualified sample to obtain an image of the qualified sample as the first initial template image.
Step 200: an image of the detection area of another qualifying sample is acquired as a second initial template image.
In this step 200, a camera may be used to capture a detection area of another qualified sample to obtain an image of the other qualified sample as the second initial template image.
In the above steps 100 and 200, the acceptable sample refers to a sample that has completed AOI detection and is determined to be acceptable for detection; the detection area refers to an area on the qualified sample, in which AOI detection is completed, and corresponds to an area (to-be-detected area) on the sample to be detected, in which AOI detection is required. The cameras adopted in the two steps can be the same camera or different cameras, and the qualified samples adopted in the two steps are different samples, but can be samples produced on the same production line and in the same batch, and can also be samples produced on different production lines and in different batches.
If the qualified sample is a display device, the detection area is generally a display area of the display device, and before shooting, the qualified sample needs to be lightened so as to display a specific picture or any specified picture.
Step 300: and processing the second initial template image by taking the first initial template image as a target to obtain a temporary template image.
In this step 300, the processing of the second initial template image targeting the first initial template image includes: at least one of spatial geometry correction and histogram matching. By taking the first initial template image as a target, carrying out space geometric correction and histogram matching on the second initial template image, the second initial template image can be converted into a temporary template image which is more similar to the first initial template image, and the deviation between the first initial template image and the second initial template image is firstly offset from an image processing algorithm.
Step 400: and comparing the deviation between the first initial template image and the temporary template image, and executing step 500 if the deviation between the first initial template image and the temporary template image meets the preset requirement.
In the step 400, if the deviation between the first initial template image and the temporary template image does not meet the preset requirement, repeating the steps 200-400, wherein the temporary template image and the corresponding second initial template image are discarded. The qualified samples adopted in each repetition of the step 200 are different samples, but may be samples produced in the same production line and in the same batch, samples produced in different production lines and in different batches, and the adopted cameras may be the same camera or different cameras.
Step 500: and carrying out average processing on the first initial template image and the temporary template image to obtain an average template image between the first initial template image and the temporary template image.
In this step 500, when the first initial template image and the temporary template image are subjected to the averaging process, a rectangular coordinate system XY is established with the transverse direction of the image as the X axis and the longitudinal direction of the image as the Y axis, parameter values X, Y and P of each pixel in the first initial template image and the temporary template image in the rectangular coordinate system are respectively obtained, wherein X is an X-axis coordinate value of each pixel in the rectangular coordinate system, Y is a Y-axis coordinate value of each pixel in the rectangular coordinate system, P is a pixel value of each pixel, an average value of pixel values P1 and P2 corresponding to the first initial template image and the temporary template image under the same coordinate values X and Y is obtained, and then the average value corresponding to each coordinate value X and Y is regenerated into the image to obtain the average template image.
Step 600: and taking the average template image as a new first initial template image, repeating the steps 200-600 until the updating times of the first initial template image reach the preset times, and taking the latest first initial template image as a final template image for AOI detection.
In this step 600, the qualified samples used in each repetition of the step 200 are different samples, but may be samples produced on the same production line or in the same batch, or samples produced on different production lines or in different batches, and the adopted cameras may be the same camera or different cameras.
According to the manufacturing method, the average template image among a plurality of initial template images is obtained and is used as a final template image for AOI detection, the average template image is used for eliminating individual deviation among the initial template images caused by deviation among different qualified samples, deviation among different cameras, deviation among different shooting environments and the like, in the process of updating the initial template images, the initial template image with larger deviation is removed by comparing and judging the deviation among the initial images, only the initial template image with smaller deviation degree is reserved for obtaining the average template image, the influence of the initial template image with larger deviation on the selection of the final template image is prevented, the selection precision of the final template image is improved, the false detection rate and the omission rate of AOI detection caused by the individual deviation among the initial template images are reduced, and the accuracy and the efficiency of AOI detection are improved.
Example two
As an optimization scheme of the first embodiment, in step 300 of the present embodiment, the processing performed on the second initial template image with the first initial template image as a target includes: and correcting space geometry.
In this embodiment, the spatial geometric correction manner is used to correct the second initial template image, so that the angle, position, geometric shape, etc. of the second initial template image tend to the angle, position, geometric shape, etc. of the first initial template image, and further a temporary template image that is closer to the first initial template image in angle, position, geometric shape, etc. is obtained.
In step 300, the transformation model used for performing the spatial geometric correction on the second initial template image with the first initial template image as a target may be, but not limited to, a rigid transformation, an affine transformation, a perspective transformation, or a nonlinear transformation.
(1) Rigid body transformation (Rigid Transformation)
If the distance between two points in one image remains unchanged after transformation into another image, then this transformation is called the Rigid transformation (Rigid Transform). Rigid transformation is limited to translation and rotation, the shape is not changed, and rigid transformation is the most general transformation.
In the rectangular coordinate system XY, the transformation formula for transforming the coordinates (x, y) of the same pixel in the second initial template image to the coordinates (x ', y') in the temporary template through a rigid body is as follows:
in the aboveIs the rotation angle [ t ] x ,t y ]Is a translation variable.
(2) Affine transformation (Affine Transformation)
If the straight line in one image is mapped to the straight line in the other image and the parallel relationship is maintained, the transformation is called Affine transformation (Affine transformation). Affine transformations are adapted to translational, rotational, scaling and inversion (mirror) cases.
In the rectangular coordinate system XY, the transformation formula for affine transforming the coordinates (x, y) of the same pixel in the second initial template image into the coordinates (x ', y') in the temporary template is:
wherein [ t ] x ,t y ]Representing the amount of translation and parameter a i The image rotation, scaling, etc. transformations are reflected. Parameter t x ,t y ,a i And (i=1 to 4) to obtain the coordinate transformation relation of the two images.
(3) Projective transformation (Projective Transformation)
If the straight lines in one image are mapped to the straight lines in the other image after passing, but the parallel relationship is not substantially maintained, then the transformation is referred to as projective transformation (Projective Transform) and the two-dimensional planar projective transformation is a linear transformation with respect to the homogeneous three-dimensional vector.
In homogeneous coordinate system, the coordinates (x, y) of the same pixel in the second initial template image are projectively transformed into the coordinates (x ', y') of the temporary template on the two-dimensional plane, which can be described by the following non-singular 3x3 matrix form, namely:
the two-dimensional projective transformation maps the pixel coordinates (x, y) of the second initial template image to the pixel coordinates (x ', y') of the temporary template image as described above.
Their transformation parameters are m i (i=0, 1 …, 8) is a scene and image dependent constant.
(4) Nonlinear transformation
The nonlinear transformation, also known as a Curved transformation (Curved transformation), is the mapping of a straight line on one image to another image, not necessarily a straight line, but a curve.
In the rectangular coordinate system XY, the transformation formula for transforming the coordinates (x, y) of the same pixel in the second initial template image into the coordinates (x ', y') in the temporary template through nonlinear transformation is as follows:
(x′,y′)=F(x,y)
wherein F represents any functional form that maps the second initial template image onto the temporary template image. Polynomial transformations are typically nonlinear transformations such as quadratic, cubic and spline functions, and sometimes exponential functions, and the polynomial can be expressed by the following equation:
after obtaining the transformation model parameters between the two images, the input image is transformed to be in the same coordinate system with the reference image, so that the matching of the target image and the background image can be realized, the coordinates of the points obtained after the transformation of the target image are not necessarily the whole pixel number, and at the moment, interpolation processing is carried out.
Example III
As another optimization of the first embodiment, in step 300 of the present embodiment, the processing performed on the second initial template image with the first initial template image as a target includes: and (5) matching the histograms.
In this embodiment, the second initial template image is enhanced by histogram matching, so that the histogram of the second initial template image tends to the histogram of the first initial template image, and a temporary template image closer in hue and contrast to the first initial template image is obtained.
Specifically, as shown in fig. 2, in step 300, assuming that the pixel gray level of the first initial template image is z, the pixel gray level of the second initial template image is r, the pixel gray level of the temporary template image is s, and the image gray levels of the first initial template image and the temporary template image are L, histogram matching is performed on the second initial template image with the first initial template image as a target, including the following steps:
step 310: a histogram distribution function pR (r) of the second initial template image is calculated.
Step 320: defining the conversion function of r to s as T (,) and calculating the mapping relation of k pixels from rk to sk in the range of r E [0, L-1], rounding the value of sk to the integer range [0, L-1],
step 330: a histogram distribution function pZ (z) of the first initial template image is calculated.
Step 340: defining a conversion function of z to s as G (,) and calculating the value of G (zq) within the range of q E [0, L-1] and rounding the value of G (zq) into the integer range [0, L-1] by adopting the following formula (2);
step 350: a lookup table between sk values and G (zq) values is constructed.
Step 360: for all sk values, the nearest G (zq) value is looked up in the lookup table in the range of k ε [0, L-1 ].
In this step 350, there is a q value, so that G (zq) =sk, or so that G (zq) ≡sk, if a certain sk value finds multiple G (zq) values closest to it in the lookup table, the smallest zq value is uniformly taken.
Step 370: inverse transforming the found G (zq) value by adopting the following formula (3) to obtain a corresponding zq value,
z q =G -1 (s k ) (3)。
step 380: and constructing a mapping relation from sk to zq.
Step 390: and matching the histogram of the second initial template image according to the mapping relation between rk and sk and the mapping relation between sk and zq, and constructing a temporary template image corresponding to the matched histogram.
Example IV
As still another optimization scheme of the first embodiment, in step 300 of the present embodiment, the processing performed on the second initial template image with the first initial template image as a target includes: spatial geometry correction and histogram matching.
The method for performing spatial geometric correction on the second initial template image may refer to the third embodiment, and the method for performing histogram matching on the second initial template image may refer to the fourth embodiment. The space geometry correction is generally performed first, then the histogram matching is performed, or the histogram matching is performed first, and then the space geometry correction is performed.
Example five
As an optimization scheme of the first embodiment, the second embodiment, the third embodiment, or the fourth embodiment, as shown in fig. 3, in step 400 of the present embodiment, the deviation between the first initial template image and the temporary template image is compared, including the steps of:
step 410: and carrying out difference solving processing on the first initial template image and the temporary template image to obtain a difference value array between the first initial template image and the temporary template image.
In this step 410, when the difference processing is performed on the first initial template image and the temporary template image, a rectangular coordinate system XY is established with the transverse direction of the image as the X axis and the longitudinal direction of the image as the Y axis, and parameter values X, Y and P of each pixel in the rectangular coordinate system in the first initial template image and the temporary template image are respectively obtained, wherein X is an X-axis coordinate value of each pixel in the rectangular coordinate system, Y is a Y-axis coordinate value of each pixel in the rectangular coordinate system, P is a pixel value of each pixel, differences between pixel values P1 and P2 corresponding to the first initial template image and the temporary template image under the same coordinate values X and Y are obtained, and then the differences corresponding to the coordinate values X and Y are formed into a two-dimensional difference array.
Step 420: and (3) obtaining the maximum value of the difference value array, and if the maximum value is smaller than a first preset threshold value, executing step 430.
In this step 420, if the maximum value is equal to or greater than the first preset threshold value, it is determined that the deviation between the first initial template image and the temporary template image does not meet a preset requirement.
Specifically, each difference value in the difference value array is compared, the maximum value of the difference value array is screened out, and then the screened maximum value is compared with the first preset threshold value to judge the absolute deviation between the first initial template image and the temporary template image.
Step 430: and solving the standard deviation of the difference value array, and if the standard deviation is smaller than a second preset threshold value, judging that the deviation between the first initial template image and the temporary template image meets the preset requirement.
In this step 430, if the standard deviation is equal to or greater than the second preset threshold, it is determined that the deviation between the first initial template image and the temporary template image does not meet the preset requirement.
Specifically, the standard deviation among the differences in the difference array is obtained, and then the obtained standard deviation is compared with the second preset threshold value to judge the relative deviation between the first initial template image and the temporary template image.
Example six
The apparatus for producing a template image for AOI detection includes a processor and a memory connected to the processor, wherein the memory stores a computer program executed by the processor, and the method for producing a template image for AOI detection according to any one of the first to fifth embodiments is performed when the processor executes the computer program.
Finally, it should be noted that the foregoing embodiments are merely for illustrating the technical solution of the embodiments of the present invention and are not intended to limit the embodiments of the present invention, and although the embodiments of the present invention have been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the embodiments of the present invention may be modified or replaced with the same, and the modified or replaced technical solution may not deviate from the scope of the technical solution of the embodiments of the present invention.
Claims (8)
1. The method for manufacturing the template image for AOI detection is characterized by comprising the following steps of:
step 100: acquiring an image of a detection area of a qualified sample as a first initial template image;
step 200: acquiring an image of a detection area of another qualified sample as a second initial template image;
step 300: processing the second initial template image by taking the first initial template image as a target to obtain a temporary template image, wherein the processing mode comprises at least one of space geometric correction and histogram matching;
step 400: comparing the deviation between the first initial template image and the temporary template image, executing step 500 if the deviation between the first initial template image and the temporary template image meets the preset requirement, and repeating steps 200-400 if the deviation between the first initial template image and the temporary template image does not meet the preset requirement;
step 500: carrying out average processing on the first initial template image and the temporary template image to obtain an average template image between the first initial template image and the temporary template image;
step 600: and taking the average template image as a new first initial template image, repeating the steps 200-600 until the updating times of the first initial template image reach the preset times, and taking the latest first initial template image as a final template image for AOI detection.
2. The method according to claim 1, wherein in step 300, the transformation model used for performing the spatial geometry correction on the second initial template image is a rigid transformation, an affine transformation, a perspective transformation or a nonlinear transformation with the first initial template image as a target.
3. The method of producing a template image for AOI detection according to claim 2, wherein in step 300, assuming that the pixel gray level of the first initial template image is z, the pixel gray level of the second initial template image is r, the pixel gray level of the provisional template image is s, and the image gray levels of the first initial template image and the provisional template image are L, histogram matching is performed on the second initial template image with the first initial template image as a target, comprising the steps of:
step 310: calculating a histogram distribution function pR (r) of the second initial template image;
step 320: defining the conversion function of r to s as T (,) and calculating the mapping relation of k pixels from rk to sk in the range of r E [0, L-1], rounding the value of sk into the integer range [0, L-1],
(1);
step 330: calculating a histogram distribution function pZ (z) of the first initial template image;
step 340: defining the conversion function of z to s as G (,) using the following equation (2), calculating the value of G (zq) in the range of q ε [0, L-1], rounding the value of G (zq) into the integer range [0, L-1],
(2);
step 350: constructing a lookup table between sk values and G (zq) values;
step 360: for all sk values, looking up the nearest G (zq) value in the lookup table in the range of k E [0, L-1 ];
step 370: inverse transforming the found G (zq) value by adopting the following formula (3) to obtain a corresponding zq value,
(3);
step 380: constructing a mapping relation from sk to zq;
step 390: and matching the histogram of the second initial template image according to the mapping relation between rk and sk and the mapping relation between sk and zq, and constructing a temporary template image corresponding to the matched histogram.
4. A method of producing an AOI detection template image according to claim 3, wherein in step 350, if a plurality of G (zq) values closest to a given sk value are found in the lookup table, the minimum zq value is uniformly taken.
5. The method of producing a template image for AOI detection according to claim 1, wherein in step 400, the deviation between the first initial template image and the provisional template image is compared, comprising the steps of:
step 410: performing difference solving processing on the first initial template image and the temporary template image to obtain a difference value array between the first initial template image and the temporary template image;
step 420: solving a maximum value of the difference value array, and if the maximum value is smaller than a first preset threshold value, executing step 430;
step 430: and solving the standard deviation of the difference value array, and if the standard deviation is smaller than a second preset threshold value, judging that the deviation between the first initial template image and the temporary template image meets the preset requirement.
6. The method according to claim 5, wherein in step 420, if the maximum value is equal to or greater than the first preset threshold value, it is determined that the deviation between the first initial template image and the provisional template image does not satisfy a preset requirement.
7. The method according to claim 5, wherein in step 430, if the standard deviation is equal to or greater than the second preset threshold, it is determined that the deviation between the first initial template image and the temporary template image does not satisfy a preset requirement.
8. A device for producing a template image for AOI detection, comprising a processor and a memory connected to the processor, wherein the memory stores a computer program for execution by the processor, and wherein the processor, when executing the computer program, performs the method for producing a template image for AOI detection according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310253757.0A CN116309440B (en) | 2023-03-15 | 2023-03-15 | Method and device for manufacturing template image for AOI detection |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310253757.0A CN116309440B (en) | 2023-03-15 | 2023-03-15 | Method and device for manufacturing template image for AOI detection |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116309440A CN116309440A (en) | 2023-06-23 |
CN116309440B true CN116309440B (en) | 2023-10-13 |
Family
ID=86837488
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310253757.0A Active CN116309440B (en) | 2023-03-15 | 2023-03-15 | Method and device for manufacturing template image for AOI detection |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116309440B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113781419A (en) * | 2021-08-31 | 2021-12-10 | 广州大学 | Defect detection method, visual system, device and medium for flexible PCB |
CN115422617A (en) * | 2022-10-13 | 2022-12-02 | 浙江大学 | Frame image size measuring method, device and medium based on CAD |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021068178A1 (en) * | 2019-10-11 | 2021-04-15 | Beijing Didi Infinity Technology And Development Co., Ltd. | Systems and methods for image quality detection |
-
2023
- 2023-03-15 CN CN202310253757.0A patent/CN116309440B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113781419A (en) * | 2021-08-31 | 2021-12-10 | 广州大学 | Defect detection method, visual system, device and medium for flexible PCB |
CN115422617A (en) * | 2022-10-13 | 2022-12-02 | 浙江大学 | Frame image size measuring method, device and medium based on CAD |
Also Published As
Publication number | Publication date |
---|---|
CN116309440A (en) | 2023-06-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108230397B (en) | Multi-view camera calibration and correction method and apparatus, device, program and medium | |
CN107507235B (en) | Registration method of color image and depth image acquired based on RGB-D equipment | |
KR100386090B1 (en) | Camera calibration system and method using planar concentric circles | |
JP6353289B2 (en) | Ranging correction device | |
US20100020178A1 (en) | Calibrating a camera system | |
CN111540022B (en) | Image unification method based on virtual camera | |
US20110235898A1 (en) | Matching process in three-dimensional registration and computer-readable storage medium storing a program thereof | |
CN110689581A (en) | Structured light module calibration method, electronic device and computer readable storage medium | |
CN108053375B (en) | Image data correction method and device and automobile | |
CN111815710B (en) | Automatic calibration method for fish-eye camera | |
CN112381847B (en) | Pipeline end space pose measurement method and system | |
US11403745B2 (en) | Method, apparatus and measurement device for measuring distortion parameters of a display device, and computer-readable medium | |
CN109272555B (en) | External parameter obtaining and calibrating method for RGB-D camera | |
CN112200203A (en) | Matching method of weak correlation speckle images in oblique field of view | |
CN112947885A (en) | Method and device for generating curved surface screen flattening image | |
KR20230137937A (en) | Device and method for correspondence analysis in images | |
CN116309440B (en) | Method and device for manufacturing template image for AOI detection | |
CN111915681A (en) | External parameter calibration method and device for multi-group 3D camera group, storage medium and equipment | |
CN113643427A (en) | Binocular ranging and three-dimensional reconstruction method | |
CN114049549A (en) | Underwater visual recognition method, system and computer readable storage medium | |
CN115880369A (en) | Device, system and method for jointly calibrating line structured light 3D camera and line array camera | |
CN116385561A (en) | Camera and laser radar calibration method | |
CN115631245A (en) | Correction method, terminal device and storage medium | |
CN112529792B (en) | Distortion correction method for distortion-free model camera | |
CN114792342A (en) | Line structure light positioning method, device, equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |