CN108615039A - Cartridge case defect automatic testing method based on computer vision - Google Patents
Cartridge case defect automatic testing method based on computer vision Download PDFInfo
- Publication number
- CN108615039A CN108615039A CN201611163794.9A CN201611163794A CN108615039A CN 108615039 A CN108615039 A CN 108615039A CN 201611163794 A CN201611163794 A CN 201611163794A CN 108615039 A CN108615039 A CN 108615039A
- Authority
- CN
- China
- Prior art keywords
- image
- defect
- cartridge case
- computer vision
- support vector
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000007547 defect Effects 0.000 title claims abstract description 66
- 238000012360 testing method Methods 0.000 title abstract description 4
- 238000001514 detection method Methods 0.000 claims abstract description 29
- 238000012706 support-vector machine Methods 0.000 claims abstract description 11
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 9
- 238000000034 method Methods 0.000 claims description 24
- 238000012545 processing Methods 0.000 claims description 13
- 238000000605 extraction Methods 0.000 claims description 11
- 238000003708 edge detection Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 claims description 5
- 230000011218 segmentation Effects 0.000 claims description 3
- 230000002950 deficient Effects 0.000 abstract description 3
- 206010057315 Daydreaming Diseases 0.000 abstract 1
- 238000007689 inspection Methods 0.000 abstract 1
- 230000008569 process Effects 0.000 description 7
- 239000013598 vector Substances 0.000 description 5
- 238000005259 measurement Methods 0.000 description 4
- 238000012549 training Methods 0.000 description 4
- 230000000007 visual effect Effects 0.000 description 4
- 230000007797 corrosion Effects 0.000 description 3
- 238000005260 corrosion Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000003909 pattern recognition Methods 0.000 description 2
- 241000878007 Miscanthus Species 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000003628 erosive effect Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000000691 measurement method Methods 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 238000012958 reprocessing Methods 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/30—Noise filtering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- 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/10—Image acquisition modality
- G06T2207/10052—Images from lightfield camera
-
- 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/20036—Morphological image processing
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Multimedia (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- General Engineering & Computer Science (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Quality & Reliability (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
The present invention proposes a kind of cartridge case defect automatic testing method based on computer vision, includes the following steps:S1, image obtain:Image is acquired by the way of based on line-scan digital camera;S2, image procossing:Shell case image is handled, the feature of defect area is obtained;S3, defect recognition:It is identified using algorithm of support vector machine according to defect characteristic is calculated.The present invention program uses computer vision, is not necessarily to human intervention, reduces the absent minded caused missing inspection of worker;In addition, realizing that defect is classified using support vector machines, defects detection is not only realized, sorting is realized to defective shell case also directed to the type of defect.
Description
Technical Field
The invention relates to the field of surface defect detection, in particular to a cartridge case surface defect automatic detection method based on computer vision.
Background
Machine vision is a cross discipline involving many neighborhoods of artificial intelligence, neurobiology, psychophysics, computer science, image processing, pattern recognition, and the like. Machine vision mainly utilizes a computer to simulate a human or reproduce some intelligent behaviors related to human vision, extracts information from an image of an objective thing to process, understands and finally uses for actual detection and control. The robot is mainly applied to industrial detection, industrial flaw detection, precise measurement and control, automatic production lines, postal automation, grain optimization, micro-medical operation, various dangerous occasions, and the like.
The defect detection generally refers to the detection of the surface defects of the article, and the surface defect detection refers to the detection of the defects such as spots, pits, scratches, color differences, defects and the like on the surface of a workpiece by adopting an advanced machine vision detection technology. In the production process of the cartridge case, due to the influence of factors such as stamping equipment, processing technology, raw materials and chemical components, the appearance of the cartridge case has the defects of surface line marks, oil stains, gaps, size deviation and the like. From birth of the cartridge to date, the detection mode of the appearance quality of the cartridge basically depends on the traditional detection method of manual measurement and visual detection. However, the labor intensity of long-time manual measurement and visual detection is high, the attention of detection workers is concentrated, and the detection leakage condition is easy to occur.
Disclosure of Invention
The invention aims to solve the problems that in the existing cartridge case production process, the manual measurement and visual detection are high in labor intensity, the attention of detection workers is concentrated, and the detection leakage condition is easy to occur. The invention provides a method for automatically detecting surface defects of a cartridge case based on computer vision, which is characterized in that a linear array camera is used for quickly acquiring images of the cartridge case, an image processing technology is used for acquiring surface defects and representation characteristics of the cartridge case, and a support vector machine is used for realizing defect classification.
In order to solve the technical problems, the invention adopts the following technical scheme: a cartridge case surface defect automatic detection method based on computer vision comprises the following steps:
s1, image acquisition: acquiring an image by adopting a linear array camera-based mode;
s2, image processing: processing the cartridge case image to obtain the characteristics of the defect area;
s3, defect identification: and identifying the defect features obtained by calculation by using a support vector machine algorithm.
In step S2 of the method for automatically detecting surface defects of cartridge cases based on computer vision, the image processing includes: the method comprises the following steps of S21 image binarization, S22 image denoising, S23 image pixel level edge detection and S24 defect feature extraction, wherein:
s21, binarization: changing the color image into a black-and-white image and realizing the segmentation of the foreground and the background;
s22, image denoising: removing noise around the target cartridge case in the image;
s23, image pixel level edge detection: detecting the edge of a target cartridge case in the image;
s24, defect feature extraction: and extracting the characteristics of the defects in the image.
In step S3 of the method for automatically detecting surface defects of cartridge cases based on computer vision, the image recognition uses a defect recognition method based on a support vector machine.
Compared with a manual measurement method and a visual detection method, the method has the advantages that the computer vision is used, the human intervention is not needed, and the missing detection caused by the inattention of workers is reduced; in addition, defect classification is realized by using a support vector machine, so that not only is defect detection realized, but also the defective cartridge case is sorted according to the type of the defect, and the sorting pressure of subsequent reprocessing is reduced.
Drawings
FIG. 1 is a method flow diagram of one embodiment of the present invention.
Fig. 2 is a flowchart of the method of processing the image in step S2 in the embodiment of the present invention.
Detailed Description
The present invention will now be described more fully hereinafter with reference to the accompanying drawings, in which embodiments of the invention are shown. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention.
As shown in fig. 1, a metal surface defect detection method based on vision in an embodiment of the present invention includes the following steps:
s1, image acquisition: and acquiring images by adopting a linear array camera-based mode.
Due to the factors of the arc-shaped surface and the material of the cartridge case, strong light reflection can be generated when light irradiates the surface, the slight swing of the cartridge case can influence the light incoming amount, and the surface brightness of the cartridge case cannot be uniform by a common light source or a single linear light source. The detection system adopts two white line light sources to illuminate the cartridge case from the left side and the right side, wherein one main light source has lower brightness and plays a main illumination role, and the brightness is low, and the variation caused by the tiny swing of the cartridge case is very small; and the other secondary light source has higher brightness and is used as light source compensation to improve the integral gray scale of the image. In practical application, the optimal relative angle between the camera and the light source can be determined only by performing various adjustment tests on the installation angle of the light source. The shell case is pressed by the top pressing shell case mechanism, the shell case is driven to rotate by the rotating mechanism below the shell case, the linear array camera is used for continuously scanning the surface of the shell case line by line to form a two-dimensional image, and the purpose of collecting the whole image of the whole surface of the shell case is achieved.
S2, image processing: and processing the shell image to obtain the characteristics of the defect area. As shown in fig. 2, the specific steps include: image binarization, image denoising, image pixel level edge detection and defect feature extraction.
S21, image binarization: carrying out image binarization by using a maximum inter-class variance method, and segmenting the foreground and the background of the image, wherein the process comprises the following steps:
1) let L gray levels be total to image, and let n be total to pixel point with gray value iiThe image is sharedWith N pixels, normalizing the gray histogram to obtain
2) Setting a threshold t, and dividing pixel points into c according to gray values0And c1Two types are provided. c. C0Probability of (a) < omega >0Mean value of μ0:
c1Probability of (a) < omega >1Mean value of μ1:
Wherein,thus, c is known0And c1Is between classes of2(t) is:
σ2(t)=ω0(μ-μ0)2+ω1(μ1-μ)2(5)
and then, taking the value of t from 0 to i, and when the sigma is the maximum value, taking t as the optimal threshold value, thus obtaining the optimal binary image.
S22, image denoising: using a block area threshold method to carry out image filtering denoising, and removing noise around a target part in an image, wherein the process is as follows:
and (3) solving the area of the block by adopting a connected component extraction algorithm in binary mathematical morphology, wherein the block smaller than a threshold value is noise, and the noise can be removed by setting the gray value of the pixel point of the block to be 255.
S23, image pixel level edge detection: performing edge detection on the binary image by using a mathematical morphology method to detect the edge of the target part in the image, wherein the process comprises the following steps:
1) the operator for corrosion is Θ, and set A is defined by set B corrosion as:
2) the operator of the expansion isSet a is defined by set B inflation as:
and (4) adopting an expansion corrosion type gradient operator, namely subtracting the corroded image from the expanded image to obtain the edge in the image. Because the edges at this time are not single-pixel wide connected, the edges need to be refined by using a region skeleton extraction algorithm.
3) If B is an image, S (A) represents the skeleton of A, and B is a structural element, then:
where K represents the number of iterations before erosion of a into empty sets, i.e.:
Sk(A) called the skeleton subset, can be written as:
a Θ kB indicates that A is etched with B k consecutive times.
S24, defect feature extraction: the method comprises the following steps of calculating the area, height and width of each defect region, wherein the process comprises the following steps:
counting the number of white pixel points in all defect regions according to the binarized image, wherein the accumulated number of white pixel points in a certain defect region S1 is NS1Then area A of the defective regionS1The calculation formula of (2) is as follows:
a represents the area of the image and N represents the total number of pixels of the image.
Performing transverse scanning on the image, wherein the maximum boundary acquired by the silvergrass is the height H of the defect area; and (4) longitudinally scanning the image, wherein the obtained maximum boundary is the width W of the defect area.
And S3, identifying the target defects by adopting a pattern identification algorithm. After each defect target in the image is obtained through the segmentation algorithm, the target defect is identified by adopting a pattern identification algorithm.
And (5) defect feature extraction. The defect identification is carried out on the premise of feature extraction, and the purpose of image feature extraction and selection is to ensure the accuracy and rapidity of classification, and the features with large inter-class distance and small intra-class variance in a feature vector space need to be selected, namely, the feature values of different classes are far away, and the feature values in the same class are densely gathered. Shell watchThe surface defect has the characteristics of gray scale difference, shape difference, geometric difference and the like, the defect size is random, the characteristic is required not to change along with the change of the size, the gray scale characteristic, the shape characteristic and the geometric characteristic are selected to establish a characteristic database to be used as an input characteristic vector of a pattern classification system, the extracted characteristic quantity and a calculation formula are shown in a table 1, wherein W isMERAnd LMERShort and long sides of MER (minimum circumscribed rectangle), respectively, (x)0,y0) And (x)1,y2) Are two points on a long side, A0And AMERF (i, j) is the gray value of the defect at pixel point (i, j), which is the area of the defect and MER.
TABLE 1 Defect characterization
And (4) designing a classifier. Pattern recognition is also often referred to as pattern classification, a process that employs some processing algorithm or rule to classify patterns into the categories to which they belong. A Support Vector Machine (SVM) is a statistical method developed on the basis of statistical theory, originally proposed for two types of linearly separable problems, and then a kernel function is introduced to solve the problem of nonlinear classification, and a plurality of two classifiers are combined to obtain the classification of the multiple types of problems.
There is a set of n-dimensional feature vectors x and their class labels w. Two types of discrimination functions w · x + b are 0 by defining distinguishable hyperplanes. To maximize the separation, two parallel hyperplanes w · x + b ═ 1, w · x + b ═ 1 are defined, passing through the support vector, and there is no training pattern between them. Then for all training patterns xiThe following inequality must be satisfied:
wi(w·x+b)≥1 (12)
the distance of this hyperplane is 2/| | w |. In order to maximize the interval, the minimum | | | w | | | needs to be minimized, the minimization problem is expressed by applying the Lagrange principle, so that the optimization process is simplified, and finally, the discriminant function is obtained by calculation
This approach can be generalized to the problem of non-linear divisibility using nuclear techniques. The dot product of a linear support vector classifier can be replaced with a non-linear kernel function
k(xi,xj)=Φ(xi)·Φ(xj) (14)
The discriminant function generated is
In practical operation, in this embodiment, 150 groups of cartridge case surface defects are used as training samples, and a defect classifier is obtained by training the samples by using a support vector machine method, where the nonlinear kernel function is Sigmoid functionAnd 50 groups of test samples were classified, and the classification results are shown in table 2:
TABLE 2 results of the classification
The results show that the embodiment of the invention can detect most of defect samples, and can realize accurate detection in hundreds of percent particularly for two fatal defects, namely notch and perforation.
Claims (3)
1. A cartridge case surface defect automatic detection method based on computer vision is characterized by comprising the following steps:
s1, image acquisition: acquiring an image by adopting a linear array camera-based mode;
s2, image processing: processing the cartridge case image to obtain the characteristics of the defect area;
s3, defect identification: and identifying the defect features obtained by calculation by using a support vector machine algorithm.
2. The method for automatically detecting the surface defects of the cartridge case based on the computer vision as claimed in claim 1, wherein the step S2 of image processing comprises: image binarization, image denoising, image pixel level edge detection and defect feature extraction, wherein:
binarization: changing the color image into a black-and-white image and realizing the segmentation of the foreground and the background;
image denoising: removing noise around the target cartridge case in the image;
image pixel level edge detection: detecting the edge of a target cartridge case in the image;
defect feature extraction: and extracting the characteristics of the defects in the image.
3. The method for automatically detecting the surface defects of the cartridge case based on the computer vision as claimed in claim 1, wherein in the step S3, the image recognition uses a defect recognition method based on a support vector machine.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611163794.9A CN108615039A (en) | 2016-12-09 | 2016-12-09 | Cartridge case defect automatic testing method based on computer vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611163794.9A CN108615039A (en) | 2016-12-09 | 2016-12-09 | Cartridge case defect automatic testing method based on computer vision |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108615039A true CN108615039A (en) | 2018-10-02 |
Family
ID=63658158
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611163794.9A Pending CN108615039A (en) | 2016-12-09 | 2016-12-09 | Cartridge case defect automatic testing method based on computer vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108615039A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109492569A (en) * | 2018-10-31 | 2019-03-19 | 国家电网有限公司 | A kind of cable line insulating layer defect detection method and device |
CN110415241A (en) * | 2019-08-02 | 2019-11-05 | 同济大学 | A kind of surface of concrete structure quality determining method based on computer vision |
CN111222551A (en) * | 2019-12-30 | 2020-06-02 | 成都云尚物联环境科技有限公司 | Sewage pipeline defect image identification method and device, storage medium and electronic equipment |
CN112801106A (en) * | 2021-01-28 | 2021-05-14 | 安徽师范大学 | Machining defect classification method of tooth restoration product based on machine vision |
-
2016
- 2016-12-09 CN CN201611163794.9A patent/CN108615039A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109492569A (en) * | 2018-10-31 | 2019-03-19 | 国家电网有限公司 | A kind of cable line insulating layer defect detection method and device |
CN110415241A (en) * | 2019-08-02 | 2019-11-05 | 同济大学 | A kind of surface of concrete structure quality determining method based on computer vision |
CN111222551A (en) * | 2019-12-30 | 2020-06-02 | 成都云尚物联环境科技有限公司 | Sewage pipeline defect image identification method and device, storage medium and electronic equipment |
CN112801106A (en) * | 2021-01-28 | 2021-05-14 | 安徽师范大学 | Machining defect classification method of tooth restoration product based on machine vision |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111179225B (en) | Test paper surface texture defect detection method based on gray gradient clustering | |
CN108305243B (en) | Magnetic shoe surface defect detection method based on deep learning | |
Park et al. | Ambiguous surface defect image classification of AMOLED displays in smartphones | |
CN107545239B (en) | Fake plate detection method based on license plate recognition and vehicle characteristic matching | |
CN107437243B (en) | Tire impurity detection method and device based on X-ray image | |
CN111179251A (en) | Defect detection system and method based on twin neural network and by utilizing template comparison | |
CN103439338B (en) | Film defects sorting technique | |
WO2021168733A1 (en) | Defect detection method and apparatus for defect image, and computer-readable storage medium | |
Bong et al. | Vision-based inspection system for leather surface defect detection and classification | |
CN110827235B (en) | Steel plate surface defect detection method | |
JP2019061484A (en) | Image processing device and control method thereof and program | |
CN108615039A (en) | Cartridge case defect automatic testing method based on computer vision | |
KR101813223B1 (en) | Method and apparatus for detecting and classifying surface defect of image | |
CN113034488A (en) | Visual detection method of ink-jet printed matter | |
CN110096980A (en) | Character machining identifying system | |
CN111487192A (en) | Machine vision surface defect detection device and method based on artificial intelligence | |
CN104867145A (en) | IC element solder joint defect detection method based on VIBE model | |
JP2018096908A (en) | Inspection device and inspection method | |
Abdellah et al. | Defect detection and identification in textile fabric by SVM method | |
Dominguez-Nicolas et al. | Indentation image analysis for Vickers hardness testing | |
Zhang et al. | Fabric defect detection based on visual saliency map and SVM | |
Kuo et al. | Automated inspection of micro-defect recognition system for color filter | |
CN113822836B (en) | Method for marking an image | |
Jothi et al. | Intra-ocular lens defect detection using generalized hough transform | |
Mansano et al. | Inspection of metallic surfaces using local binary patterns |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20181002 |
|
WD01 | Invention patent application deemed withdrawn after publication |