CN105069807B - A kind of stamped workpieces defect inspection method based on image procossing - Google Patents
A kind of stamped workpieces defect inspection method based on image procossing Download PDFInfo
- Publication number
- CN105069807B CN105069807B CN201510541955.2A CN201510541955A CN105069807B CN 105069807 B CN105069807 B CN 105069807B CN 201510541955 A CN201510541955 A CN 201510541955A CN 105069807 B CN105069807 B CN 105069807B
- Authority
- CN
- China
- Prior art keywords
- image
- value
- carried out
- edge
- stamped workpieces
- 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.)
- Expired - Fee Related
Links
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
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
-
- 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/20172—Image enhancement details
- G06T2207/20192—Edge enhancement; Edge preservation
-
- 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/30164—Workpiece; Machine component
Abstract
The invention discloses a kind of stamped workpieces defect inspection method based on image procossing, concretely comprise the following steps:Stamped workpieces image is obtained, image denoising processing is carried out using the method for adaptive ballot Fast Median Filtering;Then, image enhaucament is carried out using contourlet transformation and small survival environment particle sub-group optimization algorithm, and edge detection process is carried out to image;Finally carry out stamped workpieces defects detection.The present invention has carried out enhancing processing using contourlet transformation and small survival environment particle sub-group optimization method to image, not only so that image overall contrast has been lifted, but also enhancing effect is served to the edge details of workpiece image, increase the repeatable accuracy of workpiece sensing;The characteristics of defect part edge is more obvious in stamped workpieces image is directed to, the present invention proposes the edge detection method blended based on neutral net and Fast Fuzzy algorithm, while reducing testing cost, also greatly improves detection efficiency.
Description
Technical field
The invention belongs to industrial production to detect detection technique field, and in particular to a kind of stamped workpieces based on image procossing
Defect inspection method.
Background technology
Image detecting technique is at home and abroad widely used in Product checking, and it is based on optics, at fused images
The contemporary advanced science and technology such as reason technology, photoelectron technology, computer technology is integrated, a comprehensive detection system of composition.
The technology is mainly that detected material is imaged using optical technology, using image as the carrier of transmission information or the hand of detection
Section, then by certain working process, realizes the detection to material outer feature.
At present, the method for most of workpiece, defect detection needs to carry out binary conversion treatment, the party to the workpiece image of acquisition
Requirement of the method to light source is more strict, and the price of light source costliness can undoubtedly greatly increase the cost of detection;Meanwhile image obtains
The electrical resistance interference of device can make gray level image produce a variety of noises, so as to which more ambiguousness easily occurs in the image for making to obtain, sternly
Ghost image rings the repeatable accuracy of workpiece sensing;In addition, the IMAQ speed of its vision system also causes the image processing section used time
It is longer, constrain the raising of detection efficiency.Therefore, the complexity concerns for how solving accuracy of detection and detection algorithm are still workpiece
The huge challenge that detection technique is faced.
The content of the invention
It is an object of the invention to provide a kind of stamped workpieces defect inspection method based on image procossing, solves existing work
The problem of part detection method is with high costs, repeatable accuracy is poor and detection efficiency is low.
The technical solution adopted in the present invention is a kind of stamped workpieces defect inspection method based on image procossing, specifically
Step is:
Step 1, stamped workpieces image is obtained, is carried out using the method for adaptive ballot Fast Median Filtering at image denoising
Reason;
Step 2, image enhaucament is carried out using contourlet transformation and small survival environment particle sub-group optimization algorithm;
Step 3, edge detection process is carried out to image;
Step 4, stamped workpieces defects detection.
It is of the invention to be further characterized in that,
In step 1, the process of image denoising is:
Step 1.1:The workpiece image of acquisition is divided into N × N number of filtering sliding window, wherein, N >=3, and N is strange
Number;
Step 1.2:Pixel in filtering sliding window obtained by step 1.1 is scanned one by one, by the picture of central point
Plain value xijWith the pixel value θ of its neighborhood territory pixel pointabIt is compared, works as xij=θabWhen, gray value ballot is carried out to the pixel;
And judge xijWhether it is extreme value, if xijFor extreme value, then step 1.3 is carried out;
Step 1.3:According to gray value occur number statistics ballot box array value, and by first meet formula (1) or
(2) gray value of pixel replaces central point pixel value, realizes medium filtering:
Mmin+M≥0.5×(N×N+1) (1)
Or Mmax+M≥0.5×(N×N+1) (2)
Wherein, M is equal to the number of pixels of central point pixel value, M for gray valueminIt is smaller than central point pixel value for gray value
Number of pixels, MmaxFor the gray value number of pixels bigger than central point pixel value.
In step 2, image enhancement processes are:
Step 2.1:Contourlet transformation is carried out to step 1 gained image, obtains low pass and the band logical side of workpiece image
To subband;
Step 2.2:Band logical directional subband is adaptively adjusted using nonlinear gain function, i.e.,:
Wherein,Coefficient after being adjusted for k-th of subband on s-th of yardstick, For the maximum of coefficient above book band, b is image enhaucament scope, its
Value is [0,1], and c is image enhaucament intensity, and its value is [1,10];
Step 2.3:The optimal solution of band logical subband undetermined coefficient is calculated using small survival environment particle sub-group optimization algorithm;To population
Initialized:Imputation method population is made up of Z sub- populations, and optimum individual is P in every sub- populationzbest;
Step 2.4:Judge the distance between optimum individual d in two sub- populationsijWhether the radius of microhabitat is less than
RnicheIf being less than, compare the fitness of two microhabitat optimum individuals, high person keeps constant, low person's zero setting;
Step 2.5:The optimum individual of zero setting in step 2.4 is reinitialized, and in the microhabitat where it again
Optimum individual is selected, until each microhabitat has optimum individual, subsequent particle is according to formula (3) and (4) renewal speed public affairs
Formula comes more new position and speed:
Vi(t+1)=wV (t)+c1r1[pbesti(t)-Xi(t)]+c2r2[pbesti(t)-Xi(t)] (3)
Xi(t+1)=Xi(t)+Vi(t+1) (4)
Wherein, Vi(t+1) it is speed of the particle i at the t+1 moment;pbesti(t) local optimum of current particle individual is represented
Solution;Xi(t+1) for particle i in the position at t+1 moment;V (t) represents speed of the particle i in t;c1, c2For Studying factors, lead to
Normal c1=c2=2;r1, r2It is the random number met on (0,1);W is non-negative inertial factor;
Step 2.6:From increasing, when iterations reaches maximum, optimizing terminates loop iteration, now obtains band logical director
Optimal value with coefficient;Otherwise step 2.3 is gone to;
Step 2.7:Contourlet inverse transformations are done using the optimal value of step 2.6 gained band logical directional subband coefficient, i.e.,
Obtain stamped workpieces image enhancement processing design sketch.
In step 3, image carries out edge detection process process and is:
Step 3.1:Wavelet decomposition is carried out to step 2 gained image, obtains the high fdrequency component and low frequency component of image;
Step 3.2:Intermediate value characteristic quantity (M is extracted using LVQ1 neutral nets successively from high fdrequency component imagei,j), directionality
Information characteristics amount (Qi,j), Kirsch operator characteristic quantities (Ki,j), thus 3 prototype vector composition characteristic vector Pi,j=[Mi,j,
Qi,j,Ki,j]T;
Step 3.3:Each neuron of input layer is assigned to an output neuron, obtains weight matrix W2, i.e.,
Step 3.4:Each iterative process, an input vector PijNetwork is provided to, and calculates each prototype vector
With PijDistance;The neuron of input layer is at war with, if i-th neuron i* wins, the output of first layer neuron to
Measure a1The i-th element be arranged to 1, remaining element is 0;Then a1With the weight matrix W of second layer neuron2Be multiplied so as to
Obtain final output vector a2, a2And only one nonzero element k*, k* row k element, show PijIt is assigned to kth class
's;
If a, PijClassification be correct, the then triumph neuron i of first layer*Weights i*W1(q) to PijIt is mobile:
i*W1(q)=i*W1(q-1)+α(Pij(q)-i*W1(q-1))
Wherein:Q represents the number of iteration;α is learning rate, W1For a random matrix;
If b, PijClassification be wrong, mobile weights i*W2(q) away from Pij:
i*W2(q)=i*W2(q-1)-α(Pij(q)-i*W2(q-1));
Successively to each input vector P of gray level imageijLearnt, obtain discriminant function parameter W1;
Step 3.5:By step 3.4 gained discriminant function parameter W1It is input to as input parameter in edge detector, by
Edge detector generates high fdrequency component edge image;
Step 3.6:By the intermediate value X of gradation of imagemax/ 2 are assigned to initial threshold X0, then it is iterated according to formula (5),
Until Xi+1=XiWhen terminate iteration, take X nowiAs threshold value, and it is designated as XT:
Wherein, XmaxFor the maximum gray scale of image pixel;nkIt is equal to k number of pixels for gray value;
Step 3.7:Defining new membership function is:
Wherein, xmnFor raw data matrix, XTFor threshold value;
Step 3.8:Using formula (6) to membership function muimnNonlinear transformation is carried out on image Fuzzy property domain to obtain
Fuzzy membership matrix:
μ′mn=Tr(μmn)=T1(Tr-1(μmn)) r=1,2 ... (6)
Wherein, μ 'mnFor fuzzy membership matrix, Tr(μmn) it is non-linear transform function, r is iterations;
Step 3.9:Inverse transformation is carried out to fuzzy membership matrix according to formula (7), image transforms to number by fuzzy space
According to space:
Step 3.10:Utilize " Max " and " Min " operator extraction low frequency component image border;
Step 3.11:Step 3.5 gained high fdrequency component edge image and 3.10 gained low frequency component image borders are carried out
Image algebraic operation synthesizes;
Step 3.12:The first address of low-frequency edge image and the height and width of image are obtained, open up one piece of core buffer,
And it is initialized as 255;
Step 3.13:The first address of high frequency edge image and the height and width of image for carrying out adding computing are chosen, to two width
Pixel corresponding to image carries out plus computing, if being as a result more than 255, it is 255 to put the point, is otherwise preserved result, so
Result in internal memory is copied back into the data field of low-frequency edge image afterwards.
In step 4, stamped workpieces defect inspection method is:
Step 4.1:Using thick, the smart two-stage template based on boundary moment invariant to step 3 gained stamped workpieces edge image
Matched with template image;
Step 4.2:After matching terminates, two-way poor shadow image is obtained by formula (8) and (9):
sneg(x, y)=- [f (x, y)-g (x, y)] f (x, y) < g (x, y) (8)
spos(x, y)=f (x, y)-g (x, y) f (x, y) >=g (x, y) (9)
Wherein, g (x, y) is image to be detected, and f (x, y) is target image, sneg(x, y) is minus tolerance shadow image, spos(x,
Y) it is principal-employment shadow image;
Step 4.3:Binaryzation is carried out to the image of poor movie queen, and bianry image is designated as T (x, y), by formula (10) and
(11) mathematical morphological operation is carried out to T (x, y):
The implication of above formula is, when structural element S origin is moved to point (x, y) position, if S is completely contained in X,
The point is 1 on image after corrosion, is otherwise 0;Θ represents erosion operation;
When structural element S origin is moved to point (x, y) position, if comprising the point that at least one pixel value is 1 in S,
Then the point is 1 on image upon inflation, is otherwise 0;Represent dilation operation;
Step 4.4:Calculate the connected region area A of dissimilarity 0 on bianry image T (x, y)S, then by ASWith given detection
Precision h is compared, if ASValue be more than h, then representing has the defects of certain in image to be detected, then calculate defect image
Characteristic parameter and carry out defect classification;Otherwise, representing does not have defect in image to be detected.
The invention has the advantages that
1. the present invention has carried out enhancing processing using contourlet transformation and small survival environment particle sub-group optimization method to image,
Not only so that image overall contrast has been lifted, but also enhancing effect is served to the edge details of workpiece image, increased
The repeatable accuracy of workpiece sensing.
2. being directed to the characteristics of defect part edge is more obvious in stamped workpieces image, the present invention is proposed based on nerve
The edge detection method that network and Fast Fuzzy algorithm blend, while reducing testing cost, also greatly improve detection
Efficiency.
Brief description of the drawings
Fig. 1 is the stamped workpieces defect inspection method flow chart of the invention based on image procossing;
Fig. 2 is to utilize the stamped workpieces figure after the adaptive quick ballot medium filtering of the present invention and the processing of existing denoising method
Picture;
Fig. 3 is that the stamped workpieces image after image enhaucament is carried out using the inventive method and existing method;
Fig. 4 is the Image Edge-Detection flow chart of the stamped workpieces defect inspection method of the invention based on image procossing;
Fig. 5 is to utilize the present invention and existing method Image Edge-Detection results contrast figure;
Fig. 6 is the workpiece, defect overhaul flow chart of the stamped workpieces defect inspection method of the invention based on image procossing;
Fig. 7 is the result figure that image deflects detection is carried out using the inventive method.
Embodiment
The present invention is described in detail with reference to the accompanying drawings and detailed description.
A kind of stamped workpieces defect inspection method flow based on image procossing of the present invention is as shown in figure 1, specific detection step
Suddenly it is:
Step 1, stamped workpieces image is obtained using light source, the CCD camera of high-resolution, image pick-up card, utilization is adaptive
The method for the Fast Median Filtering that should vote carries out image denoising processing:
Step 1.1:The workpiece image of acquisition is divided into N × N number of filtering sliding window, wherein, N >=3, and N is strange
Number;
Step 1.2:Pixel in filtering sliding window obtained by step 1.1 is scanned one by one, by the picture of central point
Plain value xijWith the pixel value θ of its neighborhood territory pixel pointabIt is compared, works as xij=θabWhen, gray value ballot is carried out to the pixel;
And judge xijWhether it is extreme value, if xijFor extreme value, then step 1.3 is carried out;
Step 1.3:The number occurred according to gray value is with the order statistics ballot box number of (or from high to low) from low to high
The value of group, and the gray value of first pixel for meeting formula (1) or (2) is replaced into central point pixel value, realize medium filtering:
Mmin+M≥0.5×(N×N+1) (1)
Or Mmax+M≥0.5×(N×N+1) (2)
Wherein, M is equal to the number of pixels of central point pixel value, M for gray valueminIt is smaller than central point pixel value for gray value
Number of pixels, MmaxFor the gray value number of pixels bigger than central point pixel value.
In the present embodiment step 1 be under Intel (R) Core (TM) 2Duo CPU 2.33GHz Windows XP systems,
On Matlab 2010a operation platforms, the emulation experiment of the present invention and existing method are completed.As shown in Figure 2:Wherein Fig. 2 (a) is
Original image without denoising, Fig. 2 (b) are image containing Gaussian noise, and Fig. 2 (c) is after Wavelet-Domain Hidden Markov Tree Model denoising
Image, Fig. 2 (d) is image after Contourlet domain HMT model denoisings, and Fig. 2 (e) is utilizes VisuShrink thresholds
The image being worth after denoising, Fig. 2 (f) is the image after the adaptive quick ballot medium filtering denoising of the present invention, from figure
In as can be seen that the image picture noise after being handled using denoising method of the present invention has carried out effective removal, and after handling
Image edge clear, i.e., effectively image detail is protected.Test result indicates that filtering speed of the present invention is very fast,
The requirement of live real-time can preferably be met.
Step 2, image enhaucament is carried out using contourlet transformation and small survival environment particle sub-group optimization algorithm:
Step 2.1:Contourlet transformation is carried out to step 1 gained image, obtains low pass and the band logical side of workpiece image
To subband;
Step 2.2:Band logical directional subband is adaptively adjusted using nonlinear gain function, i.e.,:
Wherein,Coefficient after being adjusted for k-th of subband on s-th of yardstick, For the maximum of coefficient above book band, b is image enhaucament scope, its
Value is [0,1], and c is image enhaucament intensity, and its value is [1,10];
Step 2.3:The optimal solution of band logical subband undetermined coefficient is calculated using small survival environment particle sub-group optimization algorithm;To population
Initialized:Imputation method population is made up of Z sub- populations, and optimum individual is P in every sub- populationzbest;
Step 2.4:Judge the distance between optimum individual d in two sub- populationsijWhether the radius of microhabitat is less than
RnicheIf being less than, compare the fitness of two microhabitat optimum individuals, high person keeps constant, low person's zero setting;
Step 2.5:The optimum individual of zero setting in step 2.4 is reinitialized, and in the microhabitat where it again
Select optimum individual, For i=1to Z-1, For j=i+1to Z, until each microhabitat has optimum individual, then
Particle comes more new position and speed according to formula (3) and (4) renewal speed formula:
Vi(t+1)=wV (t)+c1r1[pbesti(t)-Xi(t)]+c2r2[pbesti(t)-Xi(t)] (3)
Xi(t+1)=Xi(t)+Vi(t+1) (4)
Wherein, Vi(t+1) it is speed of the particle i at the t+1 moment;pbesti(t) local optimum of current particle individual is represented
Solution;Xi(t+1) for particle i in the position at t+1 moment;V (t) represents speed of the particle i in t;c1, c2For Studying factors, lead to
Normal c1=c2=2;r1, r2It is the random number met on (0,1);W is non-negative inertial factor;
Step 2.6:From increasing, when iterations reaches maximum, optimizing terminates loop iteration, now obtains band logical director
Optimal value with coefficient;Otherwise step 2.3 is gone to;
Step 2.7:Contourlet inverse transformations are done using the optimal value of step 2.6 gained band logical directional subband coefficient, i.e.,
It can obtain stamped workpieces image enhancement processing design sketch.
In order to more intuitively show the good result of the method, the inventive method and histogram specification, two-way are utilized
Five kinds of histogram equalization, Curvelet algorithms, lifting wavelet transform, Stationary Wavelet Transform Enhancement Methods act on same width punching press
Workpiece image.The algorithm major parameter being related in experiment is as follows:8 equally spaced ashes are taken in histogram equalization method image enhaucament
Level is spent, is then that quantization unit rounding-off computing is modified with 1/7;Threshold value thresholding in Curvelet changing images enhancing algorithm
Take the 0.7 of the maximum Curvelet coefficients of respective sub-bands;The Decomposition order of lifting wavelet transform method is 2;Stationary Wavelet Transform method
Decomposition order be 4;The improved enhancing algorithm of institute of the invention initializes microhabitat particle populations first, and its sub- population number is set
For 2, if every sub- population population is set to 5;Then carry out 3 grades of LP based on contourlet transformation to decompose, microhabitat particle
Population algorithm carries out optimizing in band logical directional subband and finds optimum coefficient.Fig. 3 is the image enhaucament result ratio of different Enhancement Methods
Compared with wherein Fig. 3 (a) is histogram equalization method treatment effect figure, and Fig. 3 (b) is two-way histogram equalization method treatment effect figure, can be with
Find out that the picture contrast after being handled using both approaches is not obvious enough, Defect Edge receives heavy damage.Fig. 3 (c) is
Curvelet algorithm process design sketch, Fig. 3 (d) are lifting wavelet transform method treatment effect figure, and Fig. 3 (e) is Stationary Wavelet Transform
Action effect figure, after being handled using this several method, it is remarkably reinforced although picture contrast has, mould is still compared in image border
Paste.Fig. 3 (f) is using the design sketch after algorithm process proposed by the present invention.It can be seen that by contrast, use is proposed by the present invention
After strengthening algorithm process, the contrast of image is improved, and image edge detailss have obtained complete preservation, with other calculations
Method has obtained greatly optimizing compared to treatment effect.
Step 3, edge detection process is carried out to image:
Step 3.1:Wavelet decomposition is carried out to step 2 gained image, obtains the high fdrequency component and low frequency component of image;
Step 3.2:Intermediate value characteristic quantity (M is extracted using LVQ1 neutral nets successively from high fdrequency component imagei,j), directionality
Information characteristics amount (Qi,j), Kirsch operator characteristic quantities (Ki,j), thus 3 prototype vector composition characteristic vector Pi,j=[Mi,j,
Qi,j,Ki,j]T;
Step 3.3:Each neuron of input layer is assigned to an output neuron, obtains weight matrix W2, i.e.,
Step 3.4:Each iterative process, an input vector PijNetwork is provided to, and calculates each prototype vector
With PijDistance;The neuron of input layer is at war with, if i-th of neuron i*Win, then the output of first layer neuron to
Measure a1The i-th element be arranged to 1, remaining element is 0;Then a1With the weight matrix W of second layer neuron2Be multiplied so as to
Obtain final output vector a2, a2And only one nonzero element k*, k* row k element, show PijIt is assigned to kth class
's;
If a, PijClassification be correct, the then triumph neuron i of first layer*Weights i*W1(q) to PijIt is mobile:
i*W1(q)=i*W1(q-1)+α(Pij(q)-i*W1(q-1))
Wherein:Q represents the number of iteration;α is learning rate, W1For a random matrix;
If b, PijClassification be wrong, mobile weights i*W2(q) away from Pij:
i*W2(q)=i*W2(q-1)-α(Pij(q)-i*W2(q-1));
Successively to each input vector P of gray level imageijLearnt, obtain discriminant function parameter W1;
Step 3.5:By step 3.4 gained discriminant function parameter W1It is input to as input parameter in edge detector, by
Edge detector generates high fdrequency component edge image;
Step 3.6:By the intermediate value X of gradation of imagemax/ 2 are assigned to initial threshold X0, then it is iterated according to formula (5),
Until Xi+1=XiWhen terminate iteration, take X nowiAs threshold value, and it is designated as XT:
Wherein, XmaxFor the maximum gray scale of image pixel;nkIt is equal to k number of pixels for gray value;
Step 3.7:Defining new membership function is:
Wherein, xmnFor raw data matrix, XTFor threshold value;
Step 3.8:Using formula (6) to membership function muimnNonlinear transformation is carried out on image Fuzzy property domain to obtain
Fuzzy membership matrix:
μ′mn=Tr(μmn)=T1(Tr-1(μmn)) r=1,2 ... (6)
Wherein, μ 'mnFor fuzzy membership matrix, Tr(μmn) it is non-linear transform function, r is iterations;
Step 3.9:Inverse transformation is carried out to fuzzy membership matrix according to formula (7), image transforms to number by fuzzy space
According to space:
Step 3.10:Utilize " Max " and " Min " operator extraction low frequency part image border;
Step 3.11:Step 3.5 gained high fdrequency component edge image and 3.10 gained low frequency component image borders are carried out
Image algebraic operation synthesizes;
Step 3.12:The first address of low-frequency edge image and the height and width of image are obtained, open up one piece of core buffer,
And it is initialized as 255;
Step 3.13:The first address of high frequency edge image and the height and width of image for carrying out adding computing are chosen, to two width
Pixel corresponding to image carries out plus computing, if being as a result more than 255, it is 255 to put the point, is otherwise preserved result, so
Result in internal memory is copied back into the data field of low-frequency edge image afterwards.
Specific overhaul flow chart as shown in figure 4, by emulation experiment as shown in figure 5, the relevant parameter used in experiment such as
Under:What Roberts algorithms were selected is the window of 3 × 3 neighborhoods;The discrimination threshold of Canny edge detection operators is 0.1;Draw pula
This Gauss operator uses the sharpening template in four directions;This step proposes that the wavelet decomposition number of plies of algorithm is 1.The present invention proposes to be based on
The edge detection method that the LVQ1 neutral nets and Fast Fuzzy algorithm of wavelet decomposition blend has good complementarity, it
While Bone Edge can be extracted, the extraction of fine edge can also be extracted so that there is larger change at the edge of image
It is kind.Wherein Fig. 5 (a) is that Roberts algorithms detect to obtain stamped workpieces edge image, and Fig. 5 (b) is Canny algorithm edge images;
Fig. 5 (c) is that Laplce's Gauss operator detects edge image;Fig. 5 (d) is that fuzzy algorithmic approach detects edge image;Fig. 5 (e) is with originally
The neutral net and Fast Fuzzy algorithm that chapter proposes blend the stamped workpieces edge image that method detects to obtain.
Step 4, stamped workpieces defects detection:
Step 4.1:Using thick, the smart two-stage template based on boundary moment invariant to step 3 gained stamped workpieces edge image
Matched with template image:Initialization scan point first, using first position positioned at (x, y) on the left summit of image as scanning
Put;Scan image, carry out coarse search.Assuming that image size to be matched is M × M, template image is N × N.Taken on template image
Go out pixel value of the interlacing every row point, then take sub-sampling to scan on image to be matched, calculate the correlation of two corresponding pixel points
Value R simultaneously sorts;If R is less than the M being set, all pixels less than the threshold value and their neighborhood point are taken as essence
Candidate pixel point with the stage, and enter smart matching stage;Otherwise, it fails to match;
Wherein, the matched stage is:If one of matching candidate point (i, j), in its neighborhood, with (i-1, j-1), (i
+ 1, j+1) for search matching in diagonal rectangle, calculate that each in this region puts resulting has minimum R values
Point, the R values of pixel in all candidate's neighborhoods of a point are calculated by that analogy, take the position wherein corresponding to minimum correlation value R to be
Optimal relevant matches point.
Step 4.2:After matching terminates, two-way poor shadow image is obtained by formula (8) and (9):
sneg(x, y)=- [f (x, y)-g (x, y)] f (x, y) < g (x, y) (8)
spos(x, y)=f (x, y)-g (x, y) f (x, y) >=g (x, y) (9)
Wherein, g (x, y) is image to be detected, and f (x, y) is target image, snsg(x, y) is minus tolerance shadow image, spos(x,
Y) it is principal-employment shadow image;
Step 4.3:Binaryzation is carried out to the image of poor movie queen, and bianry image is designated as T (x, y), by formula (10) and
(11) mathematical morphological operation is carried out to T (x, y):
When structural element S origin is moved to point (x, y) position, if S is completely contained in X, after corrosion on image
The point is 1, is otherwise 0;Θ represents erosion operation;
When structural element S origin is moved to point (x, y) position, if comprising the point that at least one pixel value is 1 in S,
Then the point is 1 on image upon inflation, is otherwise 0;Represent dilation operation;
Step 4.4:Calculate the connected region area A of dissimilarity 0 on bianry image T (x, y)S, then by ASWith given detection
Precision h is compared, if ASValue be more than h, then representing has the defects of certain in image to be detected, then calculate defect image
Characteristic parameter and carry out defect classification;Otherwise, representing does not have defect in image to be detected.
Using the inventive method overhaul flow chart as shown in fig. 6, testing result is as shown in fig. 7, wherein Fig. 7 (a) is to be checked
Altimetric image, 5 defects is included in this figure, 1 is linear discontinuities, and 2 be discrete shape defect, and 3,4,5 be block defect.Fig. 7 (b) is used
Two-way difference shadow method carries out poor shadow, poor shadow result such as Fig. 7 (c), the defects of being obtained to poor shadow result after binary conversion treatment image, such as
Shown in Fig. 7 (d);Through defect after zone marker and connectivity analysis, the spy of defect in Fig. 7 (d) in this step is extracted
Sign parameter is simultaneously classified to defect, and each the defect characteristic parameter and type shown;
According to the label of defect, the number of defect is determined;According to area parameters, the accuracy of detection (10 of stamped workpieces is set
Individual pixel), if defect area is less than 10 pixels, just it is deleted when removing small defect point;According to the circularity of defect,
It is line or point that defect, which can substantially be judged,.Round circularity is 0.0796, and for line defect, its circularity can be less than
0.0796, such as defect 1;For point-like or block defect, its edge is typically more complicated than circular, therefore the circularity of its defect is more than
0.0796, such as defect 0,2,3,4,5;According to barycentric coodinates, position of the defect in stamped workpieces image is obtained;According to dutycycle
Discrete defect and block defect can be differentiated, given threshold Th_D_R=0.95 is block defect the defects of more than threshold value as lacked
0,2,3 is fallen into, is discrete shape defect less than the threshold value, such as defect 3.
Contourlet transformation is combined to obtain a kind of new enhancing side by the present invention with small survival environment particle sub-group optimization algorithm
Method, this algorithm is subjected to enhancing processing to a large amount of stamped workpieces images.It is shown experimentally that, the method is calculated with traditional images enhancing
Method is compared, and not only improves the contrast of image, and most importantly it can effectively strengthen edge at workpiece, defect
Details, the characteristics of image of fault location is saved well.
Claims (2)
1. a kind of stamped workpieces defect inspection method based on image procossing, it is characterised in that concretely comprise the following steps:
Step 1, stamped workpieces image is obtained, image is carried out at denoising using the method for adaptive ballot Fast Median Filtering
Reason;
The process of image denoising is:
Step 1.1:The workpiece image of acquisition is divided into N × N number of filtering sliding window, wherein, N >=3, and N is odd number;
Step 1.2:Pixel in filtering sliding window obtained by step 1.1 is scanned one by one, by the pixel value of central point
xijWith the pixel value θ of its neighborhood territory pixel pointabIt is compared, works as xij=θabWhen, gray value ballot is carried out to the neighborhood territory pixel point;
And judge xijWhether it is extreme value, if xijFor extreme value, then step 1.3 is carried out;
Step 1.3:The value of the number statistics ballot box array occurred according to gray value, and meet formula (1) or (2) by first
The gray value of pixel replaces central point pixel value, realizes medium filtering:
Mmin+ M >=0.5 × (N × N+1), (1)
Or Mmax+ M >=0.5 × (N × N+1), (2)
Wherein, M is equal to the number of pixels of central point pixel value, M for gray valueminFor the gray value picture smaller than central point pixel value
Plain number, MmaxFor the gray value number of pixels bigger than central point pixel value;
Step 2, image enhaucament is carried out using contourlet transformation and compound small survival environment particle sub-group optimization algorithm;
Image enhancement processes are:
Step 2.1:Contourlet transformation is carried out to step 1 gained image, obtains the low pass and band logical director of workpiece image
Band;
Step 2.2:Band logical directional subband is adaptively adjusted using nonlinear gain function, i.e.,:
Wherein,Coefficient after being adjusted for k-th of subband on s-th of yardstick,(x ∈ R), Strengthen intensity for k-th of sub-band images on s-th of yardstick,
For the maximum of coefficient above book band, b is image enhaucament scope, and its value is [0,1], and c is image enhaucament intensity, its value
For [1,10];
Step 2.3:The optimal solution of band logical subband undetermined coefficient is calculated using compound small survival environment particle sub-group optimization algorithm;To population
Initialized:Imputation method population is made up of Z sub- populations, and optimum individual is P in every sub- populationzbest;
Step 2.4:Judge the distance between optimum individual d in two sub- populationsijWhether the radius R of microhabitat is less thannicheIt is if small
In comparing the fitness of two microhabitat optimum individuals, high person keeps constant, low person's zero setting;
Step 2.5:The optimum individual of zero setting in step 2.4 is reinitialized, and reselected in the microhabitat where it
Optimum individual, until each microhabitat has optimum individual, subsequent particle comes according to formula (3) and (4) renewal speed formula
More new position and speed:
Vi(t+1)=wV (t)+c1r1[pbesti(t)-Xi(t)]+c2r2[pbesti(t)-Xi(t)], (3)
Xi(t+1)=Xi(t)+Vi(t+1), (4)
Wherein, Vi(t+1) it is speed of the particle i at the t+1 moment;pbesti(t) locally optimal solution of current particle individual is represented;
Xi(t+1) for particle i in the position at t+1 moment;V (t) represents speed of the particle i in t;c1, c2For Studying factors, generally
c1=c2=2;r1, r2It is the random number met on (0,1);W is non-negative inertial factor;
Step 2.6:From increasing, when iterations reaches maximum, optimizing terminates loop iteration, now obtains band logical directional subband system
Several optimal values;Otherwise step 2.3 is gone to;
Step 2.7:Contourlet inverse transformations are done using the optimal value of step 2.6 gained band logical directional subband coefficient, you can
To stamped workpieces image enhancement processing design sketch;
Step 3, edge detection process is carried out to image;
Image carries out edge detection process process:
Step 3.1:Wavelet decomposition is carried out to step 2 gained image, obtains the high fdrequency component and low frequency component of image;
Step 3.2:Intermediate value characteristic quantity M is extracted using LVQ1 neutral nets successively from high fdrequency component imageI, j, directivity information it is special
Sign amount QI, j, Kirsch operator characteristic quantities KI, j, thus 3 prototype vector composition characteristic vector PI, j=[MI, j, QI, j, KI, j]T;
Step 3.3:Each neuron of input layer is assigned to an output neuron, obtains weight matrix W2, i.e.,
Step 3.4:Each iterative process, an input vector PijNetwork is provided to, and calculates each prototype vector and Pij
Distance;The neuron of input layer is at war with, if i-th of neuron i*Win, then the output vector a of first layer neuron1's
I-th element is arranged to 1, and remaining element is 0;Then a1With the weight matrix W of second layer neuron2It is multiplied so as to obtain most
Whole output vector a2, a2And only nonzero element a k*, a2Row k element, show PijIt is assigned to kth class;
If a, PijClassification be correct, the then triumph neuron i of first layer*Weights i*W1(q) to PijIt is mobile:
i*W1(q)=i*W1(q-1)+α(Pij(q)-i*W1(q-1)),
Wherein:Q represents the number of iteration;α is learning rate, W1For a random matrix;
If b, PijClassification be wrong, mobile weights i*W2(q) away from Pij:
i*W2(q)=i*W2(q-1)-α(Pij(q)-i*W2(q-1)),
Successively to each input vector P of gray level imageijLearnt, obtain discriminant function parameter W1;
Step 3.5:By step 3.4 gained discriminant function parameter W1It is input in edge detector as input parameter, is examined by edge
Survey device generation high fdrequency component edge image;
Step 3.6:By the intermediate value X of gradation of imagemax/ 2 are assigned to initial threshold X0, then it is iterated according to formula (5), until
Xi+1=XiWhen terminate iteration, take X nowiAs threshold value, and it is designated as XT:
Wherein, nkIt is equal to k number of pixels, X for gray valuemaxFor the maximum of gradation of image;
Step 3.7:Defining new membership function is:
Wherein, xmnFor raw data matrix, XTFor threshold value;
Step 3.8:Using formula (6) to membership function muimnNonlinear transformation is carried out on image Fuzzy property domain to be obscured
Subordinated-degree matrix:
μ′mn=Tr(μmn)=T1(Tr-1(μmn)) r=1,2 ..., (6)
Wherein, μ 'mnFor fuzzy membership matrix, Tr(μmn) it is non-linear transform function, r is iterations;
Step 3.9:Inverse transformation is carried out to fuzzy membership matrix according to formula (7), image transforms to data sky by fuzzy space
Between:
Step 3.10:Utilize " Max " and " Min " operator extraction low frequency part image border;
Step 3.11:Step 3.5 gained high fdrequency component edge image and step 3.10 gained low frequency component image border are carried out
Image algebraic operation synthesizes;
Step 3.12:The first address of low-frequency edge image and the height and width of image are obtained, open up one piece of core buffer, and just
Beginning turns to 255;
Step 3.13:The first address of high frequency edge image and the height and width of image for carrying out adding computing are chosen, to two images
Corresponding pixel carries out plus computing, if being as a result more than 255, it is 255 to put the point, otherwise preserves result, then will
Result in internal memory copies back into the data field of low-frequency edge image;
Step 4, stamped workpieces defects detection.
A kind of 2. stamped workpieces defect inspection method based on image procossing according to claim 1, it is characterised in that step
In rapid 4, stamped workpieces defect inspection method is:
Step 4.1:Using thick, the smart two-stage template based on boundary moment invariant to step 3 gained stamped workpieces edge image and mould
Plate image is matched;
Step 4.2:After matching terminates, two-way poor shadow image is obtained by formula (8) and (9):
sneg(x, y)=- [f (x, y)-g (x, y)] f (x, y) < g (x, y), (8)
spos(x, y)=f (x, y)-g (x, y) f (x, y) >=g (x, y), (9)
Wherein, g (x, y) is image to be detected, and f (x, y) is target image, sneg(x, y) is minus tolerance shadow image, spos(x, y) is
Principal-employment shadow image;
Step 4.3:Binaryzation is carried out to the image of poor movie queen, and bianry image is designated as T (x, y), by formula (10) and (11)
Mathematical morphological operation is carried out to T (x, y):
When structural element S origin is moved to point (x, y) position, if S is completely contained in X, point on image after corrosion
It is otherwise 0 for 1;Θ represents erosion operation;SxyExpression and the value of structural element S corresponding to point (x, y);
When structural element S origin is moved to point (x, y) position, if comprising the point that at least one pixel value is 1 in S,
The point is 1 on image after expansion, is otherwise 0;Represent dilation operation;X represents processed object;
Step 4.4:Calculate the connected region area A of dissimilarity 0 on bianry image T (x, y)S, by ASEnter with given accuracy of detection h
Row compares, if ASValue be more than h, then representing has the defects of certain in image to be detected, then calculate defect image feature
Parameter simultaneously carries out defect classification;Otherwise, representing does not have defect in image to be detected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510541955.2A CN105069807B (en) | 2015-08-28 | 2015-08-28 | A kind of stamped workpieces defect inspection method based on image procossing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510541955.2A CN105069807B (en) | 2015-08-28 | 2015-08-28 | A kind of stamped workpieces defect inspection method based on image procossing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105069807A CN105069807A (en) | 2015-11-18 |
CN105069807B true CN105069807B (en) | 2018-03-23 |
Family
ID=54499164
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510541955.2A Expired - Fee Related CN105069807B (en) | 2015-08-28 | 2015-08-28 | A kind of stamped workpieces defect inspection method based on image procossing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105069807B (en) |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105654496B (en) * | 2016-01-08 | 2018-06-29 | 华北理工大学 | The bionical adaptive fuzzy edge detection method of view-based access control model characteristic |
CN105976383A (en) * | 2016-05-16 | 2016-09-28 | 国网河南省电力公司电力科学研究院 | Power transmission equipment fault diagnosis method based on limit learning machine image recognition |
CN106023185B (en) * | 2016-05-16 | 2019-07-30 | 国网河南省电力公司电力科学研究院 | A kind of transmission facility method for diagnosing faults |
CN107274356B (en) * | 2017-05-23 | 2020-07-21 | 浙江大学 | Self-adaptive gray level image enhancement system |
CN107807126A (en) * | 2017-10-25 | 2018-03-16 | 宝鸡金昱食品机械制造有限公司 | A kind of flour bran speck detection method based on PCNN |
CN108020554A (en) * | 2017-10-31 | 2018-05-11 | 无锡港湾网络科技有限公司 | A kind of steel strip surface defect recognition detection method |
CN108629775B (en) * | 2018-05-14 | 2021-08-03 | 华中科技大学 | Thermal state high-speed wire rod surface image processing method |
CN109030494B (en) * | 2018-06-11 | 2021-04-20 | 昆明理工大学 | Machine vision-based method for detecting quality of cells of cylinder of laser-engraved gravure printing plate |
CN108827983A (en) * | 2018-08-28 | 2018-11-16 | 佛山职业技术学院 | A kind of optical disc automatic detection device and method |
CN111630565B (en) * | 2018-09-10 | 2024-03-01 | 深圳配天机器人技术有限公司 | Image processing method, edge extraction method, processing apparatus, and storage medium |
CN109741351A (en) * | 2018-12-12 | 2019-05-10 | 中国科学院深圳先进技术研究院 | A kind of classification responsive type edge detection method based on deep learning |
TWI783200B (en) | 2019-12-30 | 2022-11-11 | 緯創資通股份有限公司 | Method and device for determining whether object has defect |
CN112862770B (en) * | 2021-01-29 | 2023-02-14 | 珠海迪沃航空工程有限公司 | Defect analysis and diagnosis system, method and device based on artificial intelligence |
US11875502B2 (en) | 2021-04-08 | 2024-01-16 | Ford Global Technologies, Llc | Production-speed component inspection system and method |
US11475553B1 (en) | 2021-04-08 | 2022-10-18 | Ford Global Technologies, Llc | Production-speed component inspection system and method |
CN116630813B (en) * | 2023-07-24 | 2023-09-26 | 青岛奥维特智能科技有限公司 | Highway road surface construction quality intelligent detection system |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1815212A (en) * | 2005-02-05 | 2006-08-09 | 香港中文大学 | Diagnosis method for metal punching course and apparatus thereof |
-
2015
- 2015-08-28 CN CN201510541955.2A patent/CN105069807B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1815212A (en) * | 2005-02-05 | 2006-08-09 | 香港中文大学 | Diagnosis method for metal punching course and apparatus thereof |
Non-Patent Citations (3)
Title |
---|
《基于数字图像处理的冲压工件增强算法研究》;王延年等;《激光杂志》;20141231;第35卷(第10期);第80-83页 * |
《异型冲压工件边缘检测算法研究》;王延年等;《微处理机》;20141231(第6期);第43-46页 * |
《自适应投票快速中值滤波算法研究》;张欣等;《计算机工程与应用》;20101231;第46卷(第6期);第148-150页 * |
Also Published As
Publication number | Publication date |
---|---|
CN105069807A (en) | 2015-11-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105069807B (en) | A kind of stamped workpieces defect inspection method based on image procossing | |
Guo et al. | License plate localization and character segmentation with feedback self-learning and hybrid binarization techniques | |
Wang et al. | Deep learning for asphalt pavement cracking recognition using convolutional neural network | |
CN109902715B (en) | Infrared dim target detection method based on context aggregation network | |
Aldahdooh et al. | Reveal of vision transformers robustness against adversarial attacks | |
CN103955922B (en) | Method for detecting flaws of printed fabric based on Gabor filter | |
CN107389701A (en) | A kind of PCB visual defects automatic checkout system and method based on image | |
Chatterjee et al. | Genetic algorithms for feature selection of image analysis-based quality monitoring model: An application to an iron mine | |
CN109859181A (en) | A kind of PCB welding point defect detection method | |
CN105654121A (en) | Complex jacquard fabric defect detection method based on deep learning | |
Khalifa et al. | Malaysian Vehicle License Plate Recognition. | |
CN109101976B (en) | Method for detecting surface defects of arc-extinguishing grid plate | |
CN113221881B (en) | Multi-level smart phone screen defect detection method | |
CN111091111A (en) | Vehicle bottom dangerous target identification method | |
Valliammal et al. | A novel approach for plant leaf image segmentation using fuzzy clustering | |
CN110348289A (en) | A kind of finger vein identification method based on binary map | |
Gyimah et al. | A robust completed local binary pattern (rclbp) for surface defect detection | |
CN109726660A (en) | A kind of remote sensing images ship identification method | |
CN110751667B (en) | Method for detecting infrared dim and small targets under complex background based on human visual system | |
CN109934102B (en) | Finger vein identification method based on image super-resolution | |
CN116934762B (en) | System and method for detecting surface defects of lithium battery pole piece | |
CN112101283A (en) | Intelligent identification method and system for traffic signs | |
Jun et al. | Locating car license plate under various illumination conditions using genetic algorithm | |
CN116079713A (en) | Multi-drill-arm cooperative control method, system, equipment and medium for drilling and anchoring robot | |
CN112037243B (en) | Passive terahertz security inspection method, system and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20180323 Termination date: 20200828 |