Noncontinuity lithium battery film defects detection method and device thereof based on machine vision
Affiliated technical field
The present invention relates to utilize machine vision and image processing techniques to carry out the online technical field detected, relate generally to lithium battery coating machine scene and utilize Vision Builder for Automated Inspection to carry out the online method detected to noncontinuity lithium battery film defects.
Background technology
The quality testing of tradition lithium battery film surface realizes by artificial online range estimation and the sampling observation of off-line finished product, is only suitable for the occasion that production scale is little.Manual detection is usingd subjective impression as examination criteria, the consistance between the different product that is difficult to reach horizontal and vertically detected on different time, the restriction of examined speed and sampling observation frequency in addition, and the restriction that is subject to human eye vision sensitivity and resolution, the product quality of manual detection is difficult to be guaranteed.In addition, the method all has great infringement to testing staff's health and psychology.Thereby exploitation defect automatic checkout system replaces traditional manual detection, be target and the direction of lithium battery film surface quality detection technology development always.
Machine vision technique is with machine, to replace human eye to do to measure and judgement.Vision Builder for Automated Inspection refers to that the target that will detect by machine vision product (being image-pickup device) converts digital signal to, these digital signals send special-purpose image processing system again to, image processing system arranges Detection task according to the mission requirements that will detect, and then records testing result or controls on-the-spot device action according to the result of differentiating.Machine vision technique is applied to surface imperfection and detects online, is a new research direction of the online detection of surface quality.
For noncontinuity, be separated with the lithium battery film of aluminium film, if adopt conventional needle the aluminium membrane portions can be judged as to film defects to continuity film defects detection algorithm, produce erroneous judgement.Can realize the extraction of continuity film in the noncontinuity film by the searching of catastrophe point position, adopt solving of image optimal threshold can realize cutting apart of defect and background image in the continuity film, area in defect image, the ratio of major diameter and minor axis, girth, circularity, waveform character in the zero degree directional projection feature, pulse characteristics, the peak value feature, the nargin feature, the feature extraction of flexure value and kurtosis value can realize identification and the classification of defect, what finally can draw according to the type analysis of defect the defect generation is to come from environmental factor, technological factor or apparatus factor, can stop from source like this regeneration with reduce injection defect, better improve quality and reduce production costs.
Summary of the invention
Purpose of the present invention: a kind of noncontinuity lithium battery film defects online automatic detection method based on machine vision is provided, and it both can reduce the workman and detect labour intensity, can improve again the production efficiency of lithium battery film.
Noncontinuity lithium battery film defects detection method based on machine vision of the present invention, comprise the steps:
The threshold decision method realizes in noncontinuity zero defect film extracting continuity zero defect film and is realized by step 1, and the structure of continuity defects thin-film template eigenwert is realized by step 2.
Step 1, employing threshold decision method realize in noncontinuity zero defect film extracting continuity zero defect film;
Step 1.1, the parameter of the industrial camera of shooting clear image is set;
Step 1.2, employing industrial camera are taken noncontinuity zero defect film, and the standard picture of acquisition is delivered to computing machine;
Step 1.3, standard picture is carried out to the gray processing processing;
Step 1.4, the standard picture after gray processing is processed carry out 3 * 3 medium filterings;
Step 1.5, on the standard picture vertical direction, choose respectively 1/4,1/2 and 3/4 the height horizontal scanning line;
Step 1.6, searching catastrophe point position;
Step 1.7, the minimum value of choosing gray scale catastrophe point on 3 sweep traces deduct 10% of minimum value, are the threshold value Gat that noncontinuity zero defect film from containing aluminium foil extracts continuity zero defect film, and formula is as follows:
Gat=min(ωω(0),ωω(1),ωω(2))-min(ωω(0),ωω(1),ωω(2))×10%
The structure in step 2, defect image template characteristic storehouse;
Step 2.1, the parameter of the industrial camera of shooting clear image is set;
Step 2.2, employing industrial camera are taken noncontinuity defectiveness film, and the defectiveness film image of acquisition is delivered to computing machine;
Step 2.3, defectiveness film image is carried out to the gray processing processing;
Step 2.4, the defectiveness film image after gray processing is processed carry out 3 * 3 medium filterings;
Step 2.5, defectiveness film image is carried out to solving of image optimal threshold;
Step 2.6, get optimal threshold, the image after step 2.4 is processed carries out binary conversion treatment, gray-scale value is less than or equal to the pixel assignment 0 of optimal threshold, and gray-scale value is greater than the pixel assignment 1 of optimal threshold;
Step 2.7, to the image after binary conversion treatment, retain 1 value pixel and form the maximum area zone, by other the 1 value pixel assignment beyond the maximum area zone, be 0;
Step 2.8, characteristic parameter extraction (this step is shown in below);
Step 3, extract lithium battery film continuity image-region to be detected;
Step 3.1, the parameter of the industrial camera of shooting clear image is set;
Step 3.2, employing industrial camera are taken lithium battery film to be detected, and the lithium battery film image to be detected obtained is delivered to computing machine;
Step 3.3, lithium battery film image to be detected is carried out to the gray processing processing;
Step 3.4, lithium battery film image to be detected is carried out to 3 * 3 medium filterings;
Step 3.5, choose the horizontal scanning line of 1/2 height on lithium battery film image vertical direction to be detected, add up the gray scale catastrophe point number that 1/2 height is greater than the threshold value Gat in step 1.7 on sweep trace,
If gray scale catastrophe point number is 0, be lithium battery film continuity image to be detected;
If gray scale catastrophe point number is 1, and catastrophe point maximum position value is less than the image level pixel value half, as shown in Fig. 1 (b), gets maximum position in the gray scale catastrophe point and add again 4, with lithium battery film right margin, form lithium battery film continuity image to be detected;
If the catastrophe point number is 1, and catastrophe point minimum position value is greater than the image level pixel value half, as shown in Fig. 1 (f), gets lithium battery film left margin, and in the gray scale catastrophe point, minimum position subtracts 4 again, forms continuity lithium battery film zone;
If the catastrophe point number is 2, as shown in Fig. 1 (c-e), get lithium battery film left margin, left side gray scale catastrophe point minimum position subtracts 4 again, form continuity lithium battery film zone 1, get maximum position in the gray scale catastrophe point of right side and add again 4, with lithium battery film right margin, form continuity lithium battery film zone 1, zone 1 and zone 2 form continuity lithium battery film zone;
Feature extraction, the detection and Identification of step 4, lithium battery film continuity image to be detected
Step 4.1, by step 3, obtain lithium battery film continuity image to be detected;
Step 4.2, lithium battery film continuity image to be detected is carried out to solving of image optimal threshold;
Step 4.3, get optimal threshold, lithium battery film continuity image to be detected is carried out to binary conversion treatment, gray-scale value is less than or equal to the pixel assignment 0 of optimal threshold, gray-scale value is greater than the pixel assignment 1 of optimal threshold;
Step 4.4, to the image after binary conversion treatment, retain 1 value pixel and form the maximum area zone, other the 1 value pixel assignment beyond the maximum area zone is 0;
Step 4.5, characteristic parameter extraction;
Step 4.6, the accuracy rating that detects parameter is set, described detection parameter is that in the image after binary conversion treatment, 1 value pixel accounts for image pixel number percent;
The detection judgement of step 4.7, testing image.
If percent value reaches accuracy rating, be continuity zero defect film, computing machine judgement film is qualified.Otherwise be the continuity defects film, be judged as defective;
The identification of step 4.8, testing image.
By step 4.7, if film is judged as defective, the characteristic parameter that in the characteristic parameter the continuity defects film image of taking in real time in step 4.5 extracted and step 2.8, recognition template extracts adopts the minimum euclidean distance algorithm to realize identification fast and classification.
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said image optimal threshold to solve concrete steps as follows:
(a) will carry out after gray processing is processed the image that obtains, according to the gray-scale value of pixel, be divided into 256 grades, the progression that i is pixel, the span of i is 0~255, the total pixel number of image is N,
n wherein
ithe number that means i level pixel, the probability that i level pixel occurs is P
i, P
i=N
i/ N;
(b) get threshold value k (0≤k≤255), each pixel is divided into to two classes: first kind pixel is the pixel of gray-scale value in 0~k closed interval, and the set of first kind pixel is C
0, the Equations of The Second Kind pixel is the pixels of all gray-scale values in k+1~255 closed intervals, the set of Equations of The Second Kind pixel is C
1;
(c) the overall average gray level μ of computed image
μ,
c
0average gray level be μ
0(k),
c
1average gray level be μ
1(k), μ
1(k)=μ
t-μ
0(k);
(d) calculate C
0the proportion omegab of area occupied
0,
calculate C
1the proportion omegab of area occupied
1,
(e) k is increased gradually by 0 beginning, makes μ
0=μ
0(k)/ω
0, μ
1=μ
1(k)/ω
1, μ wherein
0for C
0average gray level and C
0the area occupied proportion omegab
0ratio, μ
1for C
1average gray level and C
1the area occupied proportion omegab
0ratio, calculate ω
0(μ
0-μ
t)
2+ ω
1(μ
1-μ
t)
2, work as ω
0(μ
0-μ
t)
2+ ω
1(μ
1-μ
t)
2when maximum, threshold value now is optimal threshold.
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said characteristic parameter extraction concrete steps are as follows:
Extract corresponding characteristic parameter and be stored in computing machine, as the recognition feature library template, described characteristic parameter comprises ratio, girth and the circularity of area, major diameter and minor axis in the geometric properties of defect image, waveform character in the zero degree directional projection feature, pulse characteristics, peak value feature, nargin feature, flexure value and kurtosis value, the content that described characteristic parameter is this area formula, the formula of characteristic parameter is as follows:
(a) area S:
x wherein
1for horizontal ordinate, y
1for ordinate, R
dfor pixel value be 1 zone, n
1for the region point number;
(b) ratio of major diameter and minor axis
l wherein
1major diameter, L
2it is minor axis;
(c) girth PP:
x wherein
2for horizontal ordinate, y
2for ordinate, R
bfor pixel value be 1 zone, n
2for the region point number;
(d) circularity e:
wherein S is area, and PP is girth;
(f) projection waveform character F
b:
wherein xx (t) is zero degree direction projection value, 1≤t≤T, and T is zero degree direction projection total value;
(g) projection pulse characteristics F
m:
(h) projection peak value feature F
f:
(i) projection nargin feature F
y:
(j) projection flexure value F
s:
be wherein that p (xx) is the probability density function of xx (t);
(k) projection kurtosis value F
k:
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said searching catastrophe point position concrete steps are as follows:
The gray-scale value A of nearest 3 pixels in pixel right side on the note sweep trace
1, A
2, A
3, the gray-scale value B of 3 nearest pixels on the left of pixel on the note sweep trace
1, B
2, B
3,
A
1=xy
1(v
1-3)+xy
1(v
1-2)+xy
1(v
1-1)
A
2=xy
2(v
2-3)+xy
2(v
2-2)+xy
2(v
2-1)
A
3=xy
3(v
3-3)+xy
3(v
3-2)+xy
3(v
3-1)
B
1=xy
1(v
1+1)+xy
1(v
1+2)+xy
1(v
1+3)
B
2=xy
2(v
2+1)+xy
2(v
2+2)+xy
2(v
2+3)
B
3=xy
3(v
3+1)+xy
3(v
3+2)+xy
3(v
3+3)
V wherein
1, v
2, v
3be respectively the abscissa value of pixel of the horizontal scanning line of 1/4,1/2,3/4 height, 4≤v
1≤ MM-4,4≤v
2≤ MM-4,4≤v
3≤ MM-4, MM is image horizontal ordinate maximal value; Xy wherein
1(v
1) be 1/4 the height horizontal scanning line on v
1pixel value, xy
2(v
2) be 1/2 the height horizontal scanning line on v
2pixel value, xy
3(v
3) be 3/4 the height horizontal scanning line on v
3pixel value;
A
1with B
1the absolute value of difference, A
2with B
2the absolute value of difference, A
3with B
3the absolute value of difference is designated as respectively C
1, C
2, C
3; C
1=| A
1-B
1|, C
2=| A
2-B
2|, C
3=| A
3-B
3|;
Progressively increase v
1, v
2, v
3value, work as C
1while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (0) on 1/4 sweep trace; Work as C
2while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (1) on 1/2 sweep trace; Work as C
3while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (2) on 3/4 sweep trace.
Advantage of the present invention: a kind of noncontinuity lithium battery film defects online automatic detection method based on machine vision is provided, the method adopts the adjacent gray scale point differentiation method of three horizontal scanning lines to obtain the gray scale catastrophe point, thereby determine between the continuity thin film region, adopt the optimal threshold algorithm to realize the binarization segmentation of gray level image, adopt and retain large tracts of land defect method location defect target for binary image, extract defect geometry and projection properties as identification parameter, finally adopt minimum euclidean distance to realize defect target identification and classification fast.The invention provides the recognition methods based on machine vision, parameter can be adjusted according to actual needs, and recognition efficiency is high, and discrimination is stable, can enhance productivity and reduce production costs.
The accompanying drawing explanation
Fig. 1 is six kinds of noncontinuity lithium battery film images, and wherein grey represents the lithium battery film, and white represents the aluminium film.
The horizontal scanning line schematic diagram of 1/4,1/2 and 3/4 height of choosing on Fig. 2 image vertical direction.
The structure process flow diagram in Fig. 3 defect image template characteristic storehouse.
The threshold value that Fig. 4 extracts continuity zero defect film from the noncontinuity zero defect film that contains aluminium foil is determined process flow diagram.
The identification process figure of Fig. 5 defect image to be measured.
Embodiment
Embodiment 1,
Noncontinuity lithium battery film defects detection method based on machine vision of the present invention, comprise the steps:
The threshold decision method realizes in noncontinuity zero defect film extracting continuity zero defect film and is realized by step 1, and the structure of continuity defects thin-film template eigenwert is realized by step 2.
Step 1, employing threshold decision method realize in noncontinuity zero defect film extracting continuity zero defect film;
Step 1.1, the parameter of the industrial camera of shooting clear image is set;
Step 1.2, employing industrial camera are taken noncontinuity zero defect film, and the standard picture of acquisition is delivered to computing machine;
Step 1.3, standard picture is carried out to the gray processing processing;
Step 1.4, the standard picture after gray processing is processed carry out 3 * 3 medium filterings;
Step 1.5, on the standard picture vertical direction, choose respectively 1/4,1/2 and 3/4 the height horizontal scanning line;
Step 1.6, searching catastrophe point position;
Step 1.7, the minimum value of choosing gray scale catastrophe point on 3 sweep traces deduct 10% of minimum value, are the threshold value Gat that noncontinuity zero defect film from containing aluminium foil extracts continuity zero defect film, and formula is as follows:
Gat=min(ωω(0),ωω(1),ωω(2))-min(ωω(0),ωω(1),ωω(2))×10%
The structure in step 2, defect image template characteristic storehouse;
Step 2.1, the parameter of the industrial camera of shooting clear image is set;
Step 2.2, employing industrial camera are taken noncontinuity defectiveness film, and the defectiveness film image of acquisition is delivered to computing machine;
Step 2.3, defectiveness film image is carried out to the gray processing processing;
Step 2.4, the defectiveness film image after gray processing is processed carry out 3 * 3 medium filterings;
Step 2.5, defectiveness film image is carried out to solving of image optimal threshold;
Step 2.6, get optimal threshold, the image after step 2.4 is processed carries out binary conversion treatment, gray-scale value is less than or equal to the pixel assignment 0 of optimal threshold, and gray-scale value is greater than the pixel assignment 1 of optimal threshold;
Step 2.7, to the image after binary conversion treatment, retain 1 value pixel and form the maximum area zone, by other the 1 value pixel assignment beyond the maximum area zone, be 0;
Step 2.8, characteristic parameter extraction (this step is shown in below);
Step 3, extract lithium battery film continuity image-region to be detected;
Step 3.1, the parameter of the industrial camera of shooting clear image is set;
Step 3.2, employing industrial camera are taken lithium battery film to be detected, and the lithium battery film image to be detected obtained is delivered to computing machine;
Step 3.3, lithium battery film image to be detected is carried out to the gray processing processing;
Step 3.4, lithium battery film image to be detected is carried out to 3 * 3 medium filterings;
Step 3.5, choose the horizontal scanning line of 1/2 height on lithium battery film image vertical direction to be detected, add up the gray scale catastrophe point number that 1/2 height is greater than the threshold value Gat in step 1.7 on sweep trace,
If gray scale catastrophe point number is 0, be lithium battery film continuity image to be detected;
If gray scale catastrophe point number is 1, and catastrophe point maximum position value is less than the image level pixel value half, as shown in Fig. 1 (b), gets maximum position in the gray scale catastrophe point and add again 4, with lithium battery film right margin, form lithium battery film continuity image to be detected;
If the catastrophe point number is 1, and catastrophe point minimum position value is greater than the image level pixel value half, as shown in Fig. 1 (f), gets lithium battery film left margin, and in the gray scale catastrophe point, minimum position subtracts 4 again, forms continuity lithium battery film zone;
If the catastrophe point number is 2, as shown in Fig. 1 (c-e), get lithium battery film left margin, left side gray scale catastrophe point minimum position subtracts 4 again, form continuity lithium battery film zone 1, get maximum position in the gray scale catastrophe point of right side and add again 4, with lithium battery film right margin, form continuity lithium battery film zone 1, zone 1 and zone 2 form continuity lithium battery film zone;
Feature extraction, the detection and Identification of step 4, lithium battery film continuity image to be detected
Step 4.1, by step 3, obtain lithium battery film continuity image to be detected;
Step 4.2, lithium battery film continuity image to be detected is carried out to solving of image optimal threshold;
Step 4.3, get optimal threshold, lithium battery film continuity image to be detected is carried out to binary conversion treatment, gray-scale value is less than or equal to the pixel assignment 0 of optimal threshold, gray-scale value is greater than the pixel assignment 1 of optimal threshold;
Step 4.4, to the image after binary conversion treatment, retain 1 value pixel and form the maximum area zone, other the 1 value pixel assignment beyond the maximum area zone is 0;
Step 4.5, characteristic parameter extraction;
Step 4.6, the accuracy rating that detects parameter is set, described detection parameter is that in the image after binary conversion treatment, 1 value pixel accounts for image pixel number percent;
The detection judgement of step 4.7, testing image.
If percent value reaches accuracy rating, be continuity zero defect film, computing machine judgement film is qualified.Otherwise be the continuity defects film, be judged as defective;
The identification of step 4.8, testing image.
By step 4.7, if film is judged as defective, the characteristic parameter that in the characteristic parameter the continuity defects film image of taking in real time in step 4.5 extracted and step 2.8, recognition template extracts adopts the minimum euclidean distance algorithm to realize identification fast and classification.
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said image optimal threshold to solve concrete steps as follows:
(a) will carry out after gray processing is processed the image that obtains, according to the gray-scale value of pixel, be divided into 256 grades, the progression that i is pixel, the span of i is 0~255, the total pixel number of image is N,
n wherein
ithe number that means i level pixel, the probability that i level pixel occurs is P
i, P
i=N
i/ N;
(b) get threshold value k (0≤k≤255), each pixel is divided into to two classes: first kind pixel is the pixel of gray-scale value in 0~k closed interval, and the set of first kind pixel is C
0, the Equations of The Second Kind pixel is the pixels of all gray-scale values in k+1~255 closed intervals, the set of Equations of The Second Kind pixel is C
1;
(c) the overall average gray level μ of computed image
t,
c
0average gray level be μ
0(k),
c
1average gray level be μ 1 (k), μ
1(k)=μ
t-μ
0(k);
(d) calculate C
0the proportion omegab of area occupied
0,
calculate C
1the proportion omegab of area occupied
1,
(e) k is increased gradually by 0 beginning, makes μ
0=μ
0(k)/ω
0, μ
1=μ
1(k)/ω
1, μ wherein
0for C
0average gray level and C
0the area occupied proportion omegab
0ratio, μ
1for C
1average gray level and C
1the area occupied proportion omegab
0ratio, calculate ω
0(μ
0-μ
t)
2+ ω
1(μ
1-μ
t)
2, work as ω
0(μ
0-μ
t)
2+ ω
1(μ
1-μ
t)
2when maximum, threshold value now is optimal threshold.
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said characteristic parameter extraction concrete steps are as follows:
Extract corresponding characteristic parameter and be stored in computing machine, as the recognition feature library template, described characteristic parameter comprises ratio, girth and the circularity of area, major diameter and minor axis in the geometric properties of defect image, waveform character in the zero degree directional projection feature, pulse characteristics, peak value feature, nargin feature, flexure value and kurtosis value, above-mentioned characteristic formula is as follows:
(a) area S:
x wherein
1for horizontal ordinate, y
1for ordinate, R
dfor pixel value be 1 zone, n
1for the region point number;
(b) ratio of major diameter and minor axis
l wherein
1major diameter, L
2it is minor axis;
(c) girth PP:
x wherein
2for horizontal ordinate, y
2for ordinate, R
bfor pixel value be 1 zone, n
2for the region point number;
(d) circularity e:
wherein S is area, and PP is girth;
(f) projection waveform character F
b:
wherein xx (t) is zero degree direction projection value, 1≤t≤T, and T is zero degree direction projection total value;
(g) projection pulse characteristics F
m:
(h) projection peak value feature F
f:
(i) projection nargin feature F
y:
(j) projection flexure value F
s:
be wherein that p (xx) is the probability density function of xx (t);
(k) projection kurtosis value F
k:
The above-mentioned noncontinuity lithium battery film defects detection method based on machine vision, wherein said searching catastrophe point position concrete steps are as follows:
The gray-scale value A of nearest 3 pixels in pixel right side on the note sweep trace
1, A
2, A
3, the gray-scale value B of 3 nearest pixels on the left of pixel on the note sweep trace
1, B
2, B
3,
A
1=xy
1(v
1-3)+xy
1(v
1-2)+xy
1(v
1-1)
A
2=xy
2(v
2-3)+xy
2(v
2-2)+xy
2(v
2-1)
A
3=xy
3(v
3-3)+xy
3(v
3-2)+xy
3(v
3-1)
B
1=xy
1(v
1+1)+xy
1(v
1+2)+xy
1(v
1+3)
B
2=xy
2(v
2+1)+xy
2(v
2+2)+xy
2(v
2+3)
B
3=xy
3(v
3+1)+xy
3(v
3+2)+xy
3(v
3+3)
V wherein
1, v
2, v
3be respectively the abscissa value of pixel of the horizontal scanning line of 1/4,1/2,3/4 height, 4≤v
1≤ MM-4,4≤v
2≤ MM-4,4≤v
3≤ MM-4, MM is image horizontal ordinate maximal value; Xy wherein
1(v
1) be 1/4 the height horizontal scanning line on v
1pixel value, xy
2(v
2) be 1/2 the height horizontal scanning line on v
2pixel value, xy
3(v
3) be 3/4 the height horizontal scanning line on v
3pixel value;
A
1with B
1the absolute value of difference, A
2with B
2the absolute value of difference, A
3with B
3the absolute value of difference is designated as respectively C
1, C
2, C
3; C
1=| A
1-B
1|, C
2=| A
2-B
2|, C
3=| A
3-B
3|;
Progressively increase v
1, v
2, v
3value, work as C
1while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (0) on 1/4 sweep trace; Work as C
2while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (1) on 1/2 sweep trace; Work as C
3while reaching maximal value, corresponding location of pixels is the gray scale catastrophe point ω ω (2) on 3/4 sweep trace.