Printed matter defect detection method for fuzzy imaging environment

文档序号:9256 发布日期:2021-09-17 浏览:38次 中文

1. A method for detecting defects of printed matters in a fuzzy imaging environment is characterized by comprising the following steps of establishing a template and detecting the defects:

the establishing of the template comprises the following steps:

s1, collecting clear images and fuzzy image pairs of different printing patterns to make a training data set;

s2, training a deblurring model DeblurgAN by using a countermeasure mode;

s3, collecting a group of images of defect-free products with the same printing pattern, and making a template image set;

s4, selecting a template image, selecting an interested area, and generating an upper limit image and a lower limit image;

the defect detection comprises the following steps:

s5, collecting an image to be detected, preprocessing the image and then registering the image;

and S6, detecting the defect by using the upper limit image and the lower limit image.

2. The method for detecting defects of printed matters in the fuzzy imaging environment as claimed in claim 1, wherein in step S1, a pair of sharp image and a pair of fuzzy images of different printed patterns are collected to produce a training data set, specifically:

the training data set consists of a basic data set and an enhanced data set, and clear images and fuzzy images of different printing patterns are acquired through a high frame rate camera and serve as the basic data set; randomly selecting a group of clear images with different printing patterns for data enhancement to serve as an enhanced data set, wherein the specific method for data enhancement comprises the following steps:

s1-1, generating a random track vector by utilizing a Markov random process, and applying sub-pixel interpolation to the track vector to generate a fuzzy core;

each trajectory vector is a complex vector corresponding to a discrete position of a two-dimensional randomly moving object in a continuous domain, trajectory generation is performed by a markov process, the position of each point in the trajectory is randomly generated based on the velocity and position of the previous point, gaussian perturbation, impulse perturbation and deterministic inertial components, and the trajectory vector has the following formula:

wherein, is convolution operation, M is track vector length, and LmaxFor the maximum length of movement between two moments, M and LmaxIs a constant value vtRepresents the position vector generated by the Markov random process at the time point t, and the formula is as follows:

in the formula, v0Is a complex number, cos (phi) is v0In sin (phi) is v0Is the random initialization angle, psFor random impulse disturbances, intended to mimic the sudden movements that occur when a user presses a camera button or tries to compensate for camera shake, pgIs Gaussian disturbance, I is an inertial component, pgAnd I obeys a normal distribution of N (0,0.7) gaussians, NrandIs a single random number, S, in a standard normal distribution N (0,1)tRandomly generated trajectory vector for 0-t period, DnextFor the direction of the trajectory vector at the next time, the formula is as follows:

s1-2, obtaining a blurred image corresponding to the clear image by using a degradation model, wherein the formula of the degradation model is as follows:

B=W*K+N (4)

wherein, B is a fuzzy image, W is a clear image, K is a fuzzy kernel, and N is Gaussian noise.

3. The method for detecting defects of printed matter in a blurred imaging environment as claimed in claim 1, wherein the step S2 trains the deblurring model DeblurGAN by using a countermeasure mode, specifically:

the generation network and the discrimination network are trained in a countermeasure mode, the generation network takes the fuzzy image as input and generates a predicted image, the discrimination network calculates the characteristic difference between the predicted image and a clear image and outputs the distance between the predicted image and the clear image, and the generation network is guided to generate a clearer image.

4. The method for detecting defects of printed products in a blurred imaging environment as claimed in claim 1, wherein in step S3, a set of non-defective images of the same printed pattern is collected to produce a stencil image set, specifically:

s3-1, acquiring a group of images of defect-free products with the same printing pattern as a template image set through an industrial camera, and then preprocessing the images, wherein the preprocessing contents comprise: channel screening, graying and illumination compensation;

when the color of the to-be-detected printed pattern is single, the detection accuracy can be improved by using channel screening, wherein the channel screening refers to the step of manually selecting a proper image channel according to the color of the printed pattern to perform subsequent operation; when the color of the printing pattern to be detected is rich, the calculation complexity is reduced by utilizing gray level; when the illumination of the to-be-detected printing image is not uniform, the illumination compensation is utilized to reduce the influence of the non-uniformity of the light source or the light path, and the formula of the illumination compensation is as follows:

wherein, Fi(x, y) is the image FiGray value of pixel at (x, y), Fi' (x, y) is the image FiCarrying out illumination compensation on the pixel gray value at the position (x, y), wherein u is a target gray average value;

s3-2, calculating the fuzzy score of each image in the template image set by using a definition evaluation function, wherein the lower the fuzzy score is, the higher the definition of the image is, carrying out deblurring processing on the template image with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and updating the fuzzy score; the formula for the sharpness evaluation function Tenengrad is as follows:

wherein d isiAs an image FiT is a threshold value for controlling the detection calculation sensitivity, and G (x, y) is an image FiThe gradient value at (x, y) is defined as follows:

Gx(x, y) and Gy(x, y) is the image FiThe gradient values in the horizontal and vertical directions at (x, y) are calculated as follows:

5. the method for detecting defects of printed matters in a blurred imaging environment as claimed in claim 1, wherein the step S4 selects a template image, selects a region of interest, and generates an upper limit image and a lower limit image, specifically:

s4-1, selecting an image with the lowest fuzzy score from the template image set as a template image; the whole image analysis brings larger calculation redundancy, the defect detection efficiency can be greatly improved by selecting the region of interest, the region of interest of the template image is selected according to the actual detection task, and the target image is generated;

s4-2, the imaging result of the printed pattern is susceptible to illumination, and the illumination conditions obtained by different imaging positions are different, so that the gray value in the same area fluctuates in a certain range, and if the target image is directly used for defect detection, the false detection rate is higher; therefore, the upper limit image and the lower limit image generated by utilizing the edge image and the target image are the key for reducing the false defect detection rate, the edge image provides a normal gray value fluctuation range for the target image, and the robustness of defect detection can be effectively improved;

firstly, edge detection is carried out on a target image by using a sobel operator to generate an edge contour, then the edge contour is filled through expansion operation to generate an edge image, and the calculation formula of the edge detection is as follows:

wherein E (x, y) is an edge gradient value of the template image at (x, y);

the calculation formulas of the upper limit image and the lower limit image are as follows:

Tmax(x,y)=Fm(x,y)+max{a,bE(x,y)} (11)

Tmin(x,y)=Fm(x,y)-max{a,bE(x,y)} (12)

wherein, Fm(x, y) is a target image FmGray value at (x, y), Tmax(x, y) is the upper limit image TmaxGray value at (x, y), Tmin(x, y) is a lower limit image TminThe gray values at (x, y), a, b, are constant.

6. The method for detecting defects of printed matters in the blurred imaging environment as claimed in claim 1, wherein the step S5 is to collect the image to be detected, and perform image registration after preprocessing, specifically:

acquiring an image to be detected by using an industrial camera, preprocessing the image to be detected through the content in the S3-1, then calculating a fuzzy score, deblurring the image to be detected with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and then performing image registration on the image to be detected and a target image by using template matching;

the template matching method is based on shape template matching, and the image to be detected is optimally mapped to the position of a target image through affine transformation by utilizing information such as position offset, rotation angle and the like of the image to be detected relative to the target image, so that a registration image is obtained.

7. The method for detecting the defect of the printed matter in the blurred imaging environment as claimed in claim 1, wherein the step S6 performs defect detection by using the upper limit image and the lower limit image, specifically:

the gray values of the pixel points in the upper limit image and the lower limit image are the upper limit and the lower limit of the gray value of the pixel points in the target image, when the gray value of the pixel points in the registration image is not within the range of the upper limit and the lower limit, the pixel points are regarded as abnormal pixel points, and a calculation formula for judging whether the pixel points are abnormal is as follows:

wherein, OjAbnormal image generated for defect detection whenjWhen (x, y) is 0, the image F to be detectedjPixel point at (x, y) is normal when OjWhen (x, y) is 1, the image F to be detectedjPixel point anomaly at (x, y);

and communicating adjacent abnormal pixel points in the abnormal image to form an abnormal area, calculating the area of the abnormal area, setting a threshold value according to actual detection requirements, and screening out a defect area according to the threshold value.

Background

In recent years, packaging printing technology is continuously advanced and developed, and people demand the quality of printed matters from the initial simplicity and elegance to the modern beauty and high grade. The traditional method for detecting the defects of the outer package of the product by a quality inspector has many defects: the method is greatly influenced by personal subjective consciousness, the production efficiency is low, the labor cost is high, and the omission factor is high. In order to improve the detection quality, a detector uses instruments such as a color difference meter, a densimeter, a polarization stress meter and the like to detect the defects of the outer package of the product. However, the printed matter has various defects and complex conditions, and color distortion, dislocation and missing printing, pinhole black spots, character blurring and the like are all defects which often occur in the printing process. The method of the hand-held instrument cannot meet the requirements of mass production, high speed, intellectualization and the like in actual production. The machine vision technology can overcome the defects of the traditional presswork defect detection method, and after the detection device is put into a production line to operate, the standardized and automatic assembly line work can be executed for a long time, so that the human resources are greatly reduced, and the production cost of an enterprise is reduced.

Image sharpening processing in complex industrial environments is an important task in computer vision. The high-precision printed product surface defect detection depends on high-quality images, and under the influences of rapid target movement, camera shaking, defocusing and the like, pictures captured by a camera are distorted to a certain extent, so that the improvement of the precision of the printed product defect detection is fundamentally prevented, and the computer vision application is seriously influenced. The traditional image sharpening technology adopts the technologies of a Gaussian mixture model, low-rank estimation, dictionary learning and the like. Although a certain effect can be obtained, since the influence factors such as rapid movement of an object, camera shake, defocus, etc. appear in an image as multi-directions, multi-density, and multi-categories, it is difficult to model the complex influence factors in the image simply using the conventional method. Thus, the conventional techniques degrade their original performance in a complicated industrial environment.

With the widespread application of deep learning, convolutional neural networks have been applied to image deblurring. The traditional scheme needs to estimate the fuzzy kernel first and then carry out the fuzzy image restoration work, and the estimation process is sensitive to noise and is easy to generate the ringing phenomenon. And then a large number of end-to-end models based on deep learning are generated to reconstruct the blurred image, the problem of deblurring of unknown motion types is solved, and certain generalization capability exists in different tasks. The invention provides a presswork defect detection method aiming at a fuzzy imaging environment, which aims to effectively improve the accuracy of presswork defect detection in a complex industrial environment. Meanwhile, a Markov random process is utilized to enhance a training data set, and the requirement of the model on the data volume is reduced. The mode of combining the deep learning and the traditional machine learning method is applied to practical industrial application, and the robustness of the defect detection of the printed matter is improved.

Disclosure of Invention

The invention aims to solve the problems of false detection and missing detection caused by a complex environment and lens distortion in a defect detection task, and provides a presswork defect detection method aiming at a fuzzy imaging environment.

The main process of the invention is divided into two stages: one stage is to establish a template; the two stages are defect detection.

The first stage is mainly realized by the following technical scheme:

s1, collecting clear images and fuzzy image pairs of different printing patterns to make a training data set;

the training data set consists of a basic data set and an enhanced data set, and clear images and fuzzy images of different printing patterns are acquired through a high frame rate camera and serve as the basic data set; randomly selecting a group of clear images with different printing patterns for data enhancement to serve as an enhanced data set, wherein the specific method for data enhancement comprises the following steps:

s1-1, generating a random track vector by utilizing a Markov random process, and applying sub-pixel interpolation to the track vector to generate a fuzzy core;

each trajectory vector is a complex vector corresponding to a discrete position of a two-dimensional randomly moving object in a continuous domain, trajectory generation is performed by a markov process, the position of each point in the trajectory is randomly generated based on the velocity and position of the previous point, gaussian perturbation, impulse perturbation and deterministic inertial components, and the trajectory vector has the following formula:

wherein, is convolution operation, M is track vector length, and LmaxFor the maximum length of movement between two moments, M and LmaxIs a constant value vtRepresents the position vector generated by the Markov random process at the time point t, and the formula is as follows:

in the formula, v0Is a complex number, cos (phi) is v0In sin (phi) is v0Is the random initialization angle, psFor random impulse disturbances, intended to mimic the sudden movements that occur when a user presses a camera button or tries to compensate for camera shake, pgIs Gaussian disturbance, I is an inertial component, pgAnd I obeys a normal distribution of N (0,0.7) gaussians, NrandIs a single random number, S, in a standard normal distribution N (0,1)tRandomly generated trajectory vector for 0-t period, DnextFor the direction of the trajectory vector at the next time, the formula is as follows:

s1-2, obtaining a blurred image corresponding to the clear image by using a degradation model, wherein the formula of the degradation model is as follows:

B=W*K+N (4)

wherein, B is a fuzzy image, W is a clear image, K is a fuzzy kernel, and N is Gaussian noise.

S2, training a deblurring model DeblurgAN by using a countermeasure mode;

the generation network and the discrimination network are trained in a countermeasure mode, the generation network takes the fuzzy image as input and generates a predicted image, the discrimination network calculates the characteristic difference between the predicted image and a clear image and outputs the distance between the predicted image and the clear image, and the generation network is guided to generate a clearer image.

S3, collecting a group of images of defect-free products with the same printing pattern, and making a template image set;

s3-1, acquiring a group of images of defect-free products with the same printing pattern as a template image set through an industrial camera, and then preprocessing the images, wherein the preprocessing contents comprise: channel screening, graying and illumination compensation;

when the color of the to-be-detected printed pattern is single, the detection accuracy can be improved by using channel screening, wherein the channel screening refers to the step of manually selecting a proper image channel according to the color of the printed pattern to perform subsequent operation; when the color of the printing pattern to be detected is rich, the calculation complexity is reduced by utilizing gray level; when the illumination of the to-be-detected printing image is not uniform, the illumination compensation is utilized to reduce the influence of the non-uniformity of the light source or the light path, and the formula of the illumination compensation is as follows:

wherein, Fi(x, y) is the image FiGray value of pixel at (x, y), Fi' (x, y) is the image FiCarrying out illumination compensation on the pixel gray value at the position (x, y), wherein u is a target gray average value;

s3-2, calculating the fuzzy score of each image in the template image set by using a definition evaluation function, wherein the lower the fuzzy score is, the higher the definition of the image is, carrying out deblurring processing on the template image with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and updating the fuzzy score; the formula for the sharpness evaluation function Tenengrad is as follows:

wherein d isiAs an image FiT is a threshold value for controlling the detection calculation sensitivity, and G (x, y) is an image FiThe gradient value at (x, y) is defined as follows:

Gx(x, y) and Gy(x, y) is the image FiThe gradient values in the horizontal and vertical directions at (x, y) are calculated as follows:

s4, selecting a template image, selecting an interested area, and generating an upper limit image and a lower limit image;

s4-1, selecting an image with the lowest fuzzy score from the template image set as a template image; the whole image analysis brings larger calculation redundancy, the defect detection efficiency can be greatly improved by selecting the region of interest, the region of interest of the template image is selected according to the actual detection task, and the target image is generated;

s4-2, the imaging result of the printed pattern is susceptible to illumination, and the illumination conditions obtained by different imaging positions are different, so that the gray value in the same area fluctuates in a certain range, and if the target image is directly used for defect detection, the false detection rate is higher; therefore, the upper limit image and the lower limit image generated by utilizing the edge image and the target image are the key for reducing the false defect detection rate, the edge image provides a normal gray value fluctuation range for the target image, and the robustness of defect detection can be effectively improved;

firstly, edge detection is carried out on a target image by using a sobel operator to generate an edge contour, then the edge contour is filled through expansion operation to generate an edge image, and the calculation formula of the edge detection is as follows:

wherein E (x, y) is an edge gradient value of the template image at (x, y);

the calculation formulas of the upper limit image and the lower limit image are as follows:

Tmax(x,y)=Fm(x,y)+max{a,bE(x,y)} (11)

Tmin(x,y)=Fm(x,y)-max{a,bE(x,y)} (12)

wherein, Fm(x, y) is a target image FmGray value at (x, y), Tmax(x, y) is the upper limit image TmaxGray value at (x, y), Tmin(x, y) is a lower limit image TminThe gray values at (x, y), a, b, are constant.

The second stage is mainly realized by the following technical scheme:

s5, collecting an image to be detected, preprocessing the image and then registering the image;

acquiring an image to be detected by using an industrial camera, preprocessing the image to be detected through the content in the S3-1, then calculating a fuzzy score, deblurring the image to be detected with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and then performing image registration on the image to be detected and a target image by using template matching;

the template matching method is based on shape template matching, and the image to be detected is optimally mapped to the position of a target image through affine transformation by utilizing information such as position offset, rotation angle and the like of the image to be detected relative to the target image, so that a registration image is obtained.

S6, detecting defects by using the upper limit image and the lower limit image;

the gray values of the pixel points in the upper limit image and the lower limit image are the upper limit and the lower limit of the gray value of the pixel points in the target image, when the gray value of the pixel points in the registration image is not within the range of the upper limit and the lower limit, the pixel points are regarded as abnormal pixel points, and a calculation formula for judging whether the pixel points are abnormal is as follows:

wherein, OjAbnormal image generated for defect detection whenjWhen (x, y) is 0, the image F to be detectedjPixel point at (x, y) is normal when OjWhen (x, y) is 1, the image F to be detectedjPixel point anomaly at (x, y);

and communicating adjacent abnormal pixel points in the abnormal image to form an abnormal area, calculating the area of the abnormal area, setting a threshold value according to actual detection requirements, and screening out a defect area according to the threshold value.

Effects of the invention

The invention provides a printing defect detection method in a fuzzy imaging environment, which utilizes a machine learning method to carry out image preprocessing and illumination compensation, and then utilizes a trained deep learning network to carry out deblurring processing on an image exceeding a fuzzy threshold value, so that the image is recovered under the condition of ensuring the maximum authenticity of the image, a fuzzy area influencing a defect detection result is effectively removed, and the accuracy of defect detection is further improved. Also, the captured image may be distorted due to the different positions of the object in the camera field of view, which may cause the edges of the printed pattern to be falsely detected as defects. In order to solve the problem of false detection caused by camera distortion, a template matching method is provided for correcting the position difference between a template image and an image to be detected. Experiments show that the method can effectively improve the barrier of false detection of the edge part of the image caused by camera distortion and improve the accuracy of defect detection.

Drawings

FIG. 1 is a schematic view of a defect detection process;

FIG. 2 is a diagram of the effect of deblurring;

FIG. 3 is a diagram of the effect of defect detection after deblurring;

detailed description of the invention

The first embodiment is as follows:

in order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below, and it is obvious that the described embodiments are a part of the embodiments of the present invention, but not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The invention provides a printing defect detection method aiming at a fuzzy imaging environment, which comprises two stages of template establishment and defect detection.

The establishing of the template comprises the following steps:

s1, collecting clear images and fuzzy image pairs of different printing patterns to make a training data set;

s2, training a deblurring model DeblurgAN by using a countermeasure mode;

s3, collecting a group of images of defect-free products with the same printing pattern, and making a template image set;

s4, selecting a template image, selecting an interested area, and generating an upper limit image and a lower limit image;

the defect detection comprises the following steps:

s5, collecting an image to be detected, preprocessing the image and then registering the image;

and S6, detecting the defect by using the upper limit image and the lower limit image.

The embodiment of the invention firstly utilizes a machine learning method to carry out image preprocessing and illumination compensation. And then, in the model training stage, a Markov random process is used for enhancing the training data set, so that the requirement of the model on the data volume is reduced. And then, the trained deep learning network is used for carrying out deblurring processing on the image exceeding the blurring threshold value, and the image is recovered under the condition of ensuring the maximum reality of the image. And then, registering the interested region of the image to be detected with the interested region of the template image by utilizing template matching. And finally, detecting whether the gray value of each pixel in the region of interest of the image to be detected is legal or not, and screening out the defect region.

The following examples illustrate the invention in detail:

the template establishment comprises the following steps:

s1, collecting clear images and fuzzy image pairs of different printing patterns to make a training data set;

the training data set is composed of a basic data set and an enhanced data set, and clear images and fuzzy images 100 pairs of different printing patterns are obtained through a high frame rate camera to serve as the basic data set; randomly selecting 50 clear images with different printing patterns for data enhancement to be used as an enhanced data set, wherein the specific method for data enhancement comprises the following steps:

s1-1, generating a random track vector by utilizing a Markov random process, and applying sub-pixel interpolation to the track vector to generate a fuzzy core;

each trajectory vector is a complex vector corresponding to a discrete position of a two-dimensional randomly moving object in a continuous domain, trajectory generation is performed by a markov process, the position of each point in the trajectory is randomly generated based on the velocity and position of the previous point, gaussian perturbation, impulse perturbation and deterministic inertial components, and the trajectory vector has the following formula:

wherein, is convolution operation, M is track vector length, and LmaxFor the maximum moving length between two time points, M equals 2000, L in this embodimentmax=60,vtRepresents the position vector generated by the Markov random process at the time point t, and the formula is as follows:

in the formula, v0Is a complex number, cos (phi) is v0In sin (phi) is v0Is the random initialization angle, psFor random pulse disturbances, intended to mimic the sudden movements that occur when a user presses a camera button or tries to compensate for camera shake, p in this embodiments=0.001,pgIs Gaussian disturbance, I is an inertial component, pgAnd I obeys a normal distribution of N (0,0.7) gaussians, NrandIs a single random number, S, in a standard normal distribution N (0,1)tRandomly generated for periods of 0-tTrajectory vector, DnextFor the direction of the trajectory vector at the next time, the formula is as follows:

s1-2, obtaining a blurred image corresponding to the clear image by using a degradation model, wherein the formula of the degradation model is as follows:

B=W*K+N (4)

wherein, B is a fuzzy image, W is a clear image, K is a fuzzy kernel, and N is Gaussian noise.

S2, training a deblurring model DeblurgAN by using a countermeasure mode;

the generation network and the discrimination network are trained in a countermeasure mode, the generation network takes the fuzzy image as input and generates a predicted image, the discrimination network calculates the characteristic difference between the predicted image and a clear image and outputs the distance between the predicted image and the clear image, and the generation network is guided to generate a clearer image.

S3, collecting a group of images of defect-free products with the same printing pattern, and making a template image set;

s3-1, acquiring 10 images of the defect-free product with the same printing pattern as a template image set through an industrial camera, and then preprocessing the images, wherein the preprocessing contents comprise: channel screening, graying and illumination compensation;

when the color of the to-be-detected printed pattern is single, the detection accuracy can be improved by using channel screening, wherein the channel screening refers to the step of manually selecting a proper image channel according to the color of the printed pattern to perform subsequent operation; when the color of the printing pattern to be detected is rich, the calculation complexity is reduced by utilizing gray level; when the illumination of the to-be-detected printing image is not uniform, the illumination compensation is utilized to reduce the influence of the non-uniformity of the light source or the light path, and the formula of the illumination compensation is as follows:

wherein, Fi(x, y) is the image FiGray value of pixel at (x, y), Fi' (x, y) is the image FiThe pixel gray value at (x, y) after illumination compensation, u is the target gray average value, and in this embodiment, u is 125;

s3-2, calculating the fuzzy score of each image in the template image set by using a definition evaluation function, wherein the lower the fuzzy score is, the higher the definition of the image is, carrying out deblurring processing on the template image with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and updating the fuzzy score; the formula for the sharpness evaluation function Tenengrad is as follows:

wherein d isiAs an image FiT is a threshold value for controlling the detection calculation sensitivity, in this embodiment, t is 0.6, and G (x, y) is the image FiThe gradient value at (x, y) is defined as follows:

Gx(x, y) and Gy(x, y) is the image FiThe gradient values in the horizontal and vertical directions at (x, y) are calculated as follows:

s4, selecting a template image, selecting an interested area, and generating an upper limit image and a lower limit image;

s4-1, selecting an image with the lowest fuzzy score from the template image set as a template image; the whole image analysis brings larger calculation redundancy, the defect detection efficiency can be greatly improved by selecting the region of interest, the region of interest of the template image is selected according to the actual detection task, and the target image is generated;

s4-2, the imaging result of the printed pattern is susceptible to illumination, and the illumination conditions obtained by different imaging positions are different, so that the gray value in the same area fluctuates in a certain range, and if the target image is directly used for defect detection, the false detection rate is higher; therefore, the upper limit image and the lower limit image generated by utilizing the edge image and the target image are the key for reducing the false defect detection rate, the edge image provides a normal gray value fluctuation range for the target image, and the robustness of defect detection can be effectively improved;

firstly, edge detection is carried out on a target image by using a sobel operator to generate an edge contour, then the edge contour is filled through expansion operation to generate an edge image, and the calculation formula of the edge detection is as follows:

wherein E (x, y) is an edge gradient value of the template image at (x, y);

the calculation formulas of the upper limit image and the lower limit image are as follows:

Tmax(x,y)=Fm(x,y)+max{a,bE(x,y)} (11)

Tmin(x,y)=Fm(x,y)-max{a,bE(x,y)} (12)

wherein, Fm(x, y) is a target image FmGray value at (x, y), Tmax(x, y) is the upper limit image TmaxGray value at (x, y), Tmin(x, y) is a lower limit image TminThe gray-scale value at (x, y), a, b, is constant, in this embodiment, a is 30 and b is 1.5.

The defect detection comprises the following steps:

s5, collecting an image to be detected, preprocessing the image and then registering the image;

acquiring an image to be detected by using an industrial camera, preprocessing the image to be detected through the content in the S3-1, then calculating a fuzzy score, deblurring the image to be detected with the fuzzy score exceeding a threshold value by using a DeblurgAN model, and then performing image registration on the image to be detected and a target image by using template matching;

the template matching method is based on shape template matching, and the image to be detected is optimally mapped to the position of a target image through affine transformation by utilizing information such as position offset, rotation angle and the like of the image to be detected relative to the target image, so that a registration image is obtained.

S6, detecting defects by using the upper limit image and the lower limit image;

the gray values of the pixel points in the upper limit image and the lower limit image are the upper limit and the lower limit of the gray value of the pixel points in the target image, when the gray value of the pixel points in the registration image is not within the range of the upper limit and the lower limit, the pixel points are regarded as abnormal pixel points, and a calculation formula for judging whether the pixel points are abnormal is as follows:

wherein, OjAbnormal image generated for defect detection whenjWhen (x, y) is 0, the image F to be detectedjPixel point at (x, y) is normal when OjWhen (x, y) is 1, the image F to be detectedjPixel point anomaly at (x, y);

communicating adjacent abnormal pixel points in the abnormal image to form an abnormal area, calculating the area of the abnormal area, setting a threshold value according to actual detection requirements, wherein the area threshold value of the abnormal area is 5 pixel points, and screening out a defect area according to the area threshold value.

The final implementation effect is shown in fig. 3, and it can be seen from the figure that the deblurred image can effectively improve the defect detection precision and reduce the phenomena of defect false detection and missing detection caused by complex environment and lens distortion.

The present invention is capable of other embodiments and its several details are capable of modifications in various obvious respects, all without departing from the spirit and scope of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种基于Mask R-CNN的斑马鱼形态学分类方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!