A kind of detection method and application based on Computer Image Processing and pattern-recognitionTechnical field
The present invention relates to technical field of image processing, specially a kind of inspection based on Computer Image Processing and pattern-recognitionSurvey method and application.
Background technique
Visual pattern detection is exactly to replace human eye with machine to measure and judge.With computer technology and information technologyDevelopment, image recognition technology is more and more widely used.The digital processing of image be centered on computer, includingIt is carried out on digital image processing system including various inputs, output and display equipment, is to become continuous analog imageAfter discrete digital picture, the process control worked out on the basis of specific physical model and mathematical model with foundation, operation is simultaneouslyRealize the processing of various requirements.
During industrial production, need to detect the product produced, so that it is guaranteed that there is defectsProduct is separated, and the detection method detection efficiency of existing method is low, and labor intensity is high, and there is missing inspections and false detection rate to compareHeight, in addition, detecting intuitive in speed, ease for operation and detection process etc., conveniently there is also many problems.For this purpose, weIt is proposed a kind of detection method and application based on Computer Image Processing and pattern-recognition.
Summary of the invention
The purpose of the present invention is to provide a kind of detection method and application based on Computer Image Processing and pattern-recognition,To solve the problems mentioned in the above background technology.
To achieve the above object, the invention provides the following technical scheme: a kind of known based on Computer Image Processing and modeOther detection method is somebody's turn to do the detection method based on Computer Image Processing and pattern-recognition and is included the following steps:
S1: sample Image Acquisition: being realized using image capture device and carry out Image Acquisition to the qualified product of standard, andThe qualified product of the standard of acquisition is subjected to image image as image sample;
S2: image preprocessing: the image sample in step S1 is subjected to image grayscale and binary conversion treatment, is then carried out againPicture smooth treatment and image sharpening processing;
S3: image segmentation: the image pre-processed is split, by interested foreground image from uninterested backIt is split in scape image;
S4: image boundary tracking and extraction: use empties interior point method and comes out the contours extract of image first, then from ashA marginal point sets out in degree image, successively searches for and connects neighboring edge point, the tracking of image boundary is realized, finally to imageThe measurement of perimeter and area;
S5: detection image acquisition: the image information for the product that acquisition needs to acquire, and installation steps S2 is carried out at imageReason;
S6: defect analysis: will test image and sample image penetrates and carries out image analysis and classification in classifier, thus realNow to the defect dipoles of detection image.
Preferably, the image capture device in the step S1 includes one saturating with light source, CCD camera, CCD imagingThe packaging body of mirror, the packaging body connect the image pick-up card being plugged on expanded slot of computer by video line.
Preferably, image grayscale and binary conversion treatment in the step S1 method particularly includes: by the image sample of acquisitionWhole pixels carry out gray-scale statistical, then in plane coordinate system carry out curve graph drafting, which is indicated with ordinatePossessed number of pixels indicates gray value with abscissa, so that the drafting to intensity profile histogram is realized, then according to ashIt spends distribution histogram and carries out binary conversion treatment.
Preferably, image segmentation in the step S3 method particularly includes: each zonule in image is carried out firstLabel, a label indicate the presence in a region, and the minimum as gradient is forced in the region for then going to these sides, then is shieldedOther minimums in gradient image are covered, then using this processing as basis, carry out going for noise further according to morphological operationIt removes, the segmentation of image is finally carried out using watershed segmentation method.
Preferably, the specific steps of interior point method are emptied in the step S4 are as follows: the image to be extracted is carried out two-value firstChange processing is converted into binary image, then judges 8 pixels around each pixel one by one, if 8 of surroundingThe gray value of pixel is identical as this gray value, then this pixel must be internal point, then carries out the deletion of internal point, ifIt is not it is determined that marginal point, is retained, until all pixels have all been handled, the image that remaining pixel is constituted isThe image outline for needing to extract.
Preferably, the defects of described step S6 judgment method are as follows: establish a tested production by containing all kinds of defectsThe sample space image of the image composition of product, analyzes images all in sample space, finds out the main spy of all kinds of defectsThe inner link sought peace between them, finally extracts best feature composition characteristic vector, is established according to extracted featureClassifying rules, and classifying rules is converted into threshold rule, measurement space is divided into the region not overlapped, each correspondenceJust the object is included into corresponding classification if characteristic value falls in some region in one or more regions.
Preferably, when defect is not identified accurately, the modification to the threshold value of characteristic parameter is needed.
A kind of application of the detection method based on Computer Image Processing and pattern-recognition should be based on Computer Image ProcessingIt is applied to the defects detection of product with the detection method of pattern-recognition.
Compared with prior art, the beneficial effects of the present invention are: one kind that the invention proposes is based on Computer Image ProcessingWith the detection method and application of pattern-recognition, realized pair in conjunction with modern photoelectron technology and computer disposal and mode identification technologyThe quick detection of product defects can quickly and accurately determine the location and shape of product defects, by the processing to image,The arithmetic speed for improving computer, greatly improves work efficiency, and the invention is easy to use, convenient for promoting.
Detailed description of the invention
Fig. 1 is detection method flow chart.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, completeSite preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based onEmbodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every otherEmbodiment shall fall within the protection scope of the present invention.
Referring to Fig. 1, the present invention provides a kind of technical solution: a kind of inspection based on Computer Image Processing and pattern-recognitionSurvey method is somebody's turn to do the detection method based on Computer Image Processing and pattern-recognition and is included the following steps:
S1: sample Image Acquisition: being realized using image capture device and carry out Image Acquisition to the qualified product of standard, andThe qualified product of the standard of acquisition is subjected to image image as image sample;
S2: image preprocessing: the image sample in step S1 is subjected to image grayscale and binary conversion treatment, is then carried out againPicture smooth treatment and image sharpening processing;
S3: image segmentation: the image pre-processed is split, by interested foreground image from uninterested backIt is split in scape image;
S4: image boundary tracking and extraction: use empties interior point method and comes out the contours extract of image first, then from ashA marginal point sets out in degree image, successively searches for and connects neighboring edge point, the tracking of image boundary is realized, finally to imageThe measurement of perimeter and area;
S5: detection image acquisition: the image information for the product that acquisition needs to acquire, and installation steps S2 is carried out at imageReason;
S6: defect analysis: will test image and sample image penetrates and carries out image analysis and classification in classifier, thus realNow to the defect dipoles of detection image.
Wherein, the image capture device in the step S1 includes one with light source, CCD camera, CCD imaging lenPackaging body, the packaging body connects the image pick-up card that is plugged on expanded slot of computer, the step S1 by video lineMiddle image grayscale and binary conversion treatment method particularly includes: whole pixels of the image sample of acquisition are subjected to gray-scale statistical, soThe drafting for carrying out curve graph in plane coordinate system afterwards, indicates number of pixels possessed by the gray scale with ordinate, with abscissaIt indicates gray value, to realize the drafting to intensity profile histogram, is then carried out at binaryzation according to intensity profile histogramIt manages, image segmentation in the step S3 method particularly includes: each zonule in image is marked first, a labelIndicate the presence in a region, the minimum as gradient is forced in the region for then going to these sides, then is shielded in gradient imageOther minimums carry out the removal of noise further according to morphological operation then using this processing as basis, finally use and divideWater ridge split plot design carries out the segmentation of image, the specific steps of interior point method is emptied in the step S4 are as follows: first the figure to be extractedIt is converted into binary image as carrying out binary conversion treatment, then judges 8 pixels around each pixel one by one, ifThe gray value of 8 pixels of surrounding is identical as this gray value, then this pixel must be internal point, then carries out internal pointIt deletes, if not it is determined that marginal point, is retained, until all pixels have all been handled, remaining pixel is constitutedThe image image outline that as needs to extract, the defects of described step S6 judgment method are as follows: establish one by containing all kinds ofThe sample space image of the image composition of the tested product of defect, analyzes images all in sample space, finds out eachThe main feature of class defect and the inner link between them finally extract best feature composition characteristic vector, according to instituteThe feature of extraction establishes classifying rules, and classifying rules is converted into threshold rule, will measure space and is divided into and does not overlapRegion, each corresponds to one or more regions and the object is just included into corresponding classification if characteristic value falls in some regionIn, when defect is not identified accurately, need the modification to the threshold value of characteristic parameter.
A kind of application of the detection method based on Computer Image Processing and pattern-recognition should be based on Computer Image ProcessingIt is applied to the defects detection of product with the detection method of pattern-recognition.
It although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, can be withA variety of variations, modification, replacement can be carried out to these embodiments without departing from the principles and spirit of the present invention by understandingAnd modification, the scope of the present invention is defined by the appended.