A kind of crack detecting method on hard plastic material surface
Technical field
The present invention relates to a kind of crack detecting method on hard plastic material surface, specifically one kind is mainly used to detection profit
By the use of hard plastic material as the detection method of the device surface crackle of product encapsulating material.
Background technology
Hard plastic material is as a kind of common object building block, such as the protection of the packaging of electronic device, Medical Devices
Shell, daily necessities etc. or even can be additionally used in building field, application range be it is very extensive, it is excessive with traditional material
Consumption, large quantities of synthesis hard plastic materials are developed to cover the shortage.The quality of hard plastic material product is non-key, and surface is split
Line is a key factor of hard plastic material quality, and crackle may cause electric leakage, leak etc. in use, reduce device
Bulk life time, even result in accident.Since hard plastic material brings considerable economic benefit dosage also continuing to increase, it is
Ensure the quality of hard plastic material, seek a kind of crack detecting method to adapt to the advanced means of production be extremely important.
With the lasting enhancing of computer performance, digital image processing techniques are also developing rapidly, and emerge one in recent years
The crack detecting method based on Digital Image Processing is criticized, main with good grounds crackle removes noise measuring with noise different characteristics and splits
Line;Detection to crackle is realized based on BP neural network algorithm, using crack as the input factor of neutral net, passes through
The standard that will be output as judging crackle is practised, but neural network structure is excessively complicated, and computational complexity is big, is unfavorable for examining online
It surveys;According to the linear feature of crackle, crackle is resolved into different line segments by some algorithms, judges to split by the complexity for judging slope
Line, but in hard plastic material face crack, many crackles are caused by being squeezed due to gravity, and crackle presentation is netted, and the linearity is non-
It is often complicated, it is unfavorable for linearizing;It is by crack by the crack detection algorithm that fuzzy logic and artificial neural network are combined
As the input of model, by output result judgement crackle.In addition there is the crack detection algorithm based on wavelet transformation, be based on
The detection method of statistics with histogram analysis, the detection method being combined based on histogram projection with morphological operator.More than crackle
Detection method is for concrete, road surface crackle, and such crackle is rolled by burn into weight to be caused, and fracture edges have apparent
Burr.Hard plastic material face crack is mainly caused by the physical factors such as squeezing, hitting, due to hard plastic material material characteristic crackle side
Echinid thorn is less.In addition common circularity diagnostic method can not exclude this linear non-crack defect of cut, so with top
Method is not particularly suited for the detection of hard plastic material face crack.
With the development of productivity, advanced production equipment can produce a large amount of finished product hard plastic materials in a short time, be
Ensure production efficiency, improve product testing quality, it is most important to seek a kind of detection method that can adapt to production environment, it is desirable that
Detection algorithm has rapidity, stability, high efficiency.
The content of the invention
Hard plastic material face crack can quickly, be precisely detected the technical problem to be solved in the present invention is to provide a kind of
Detection method.
In order to solve the above-mentioned technical problem, the present invention takes following technical scheme:
A kind of crack detecting method on hard plastic material surface, comprises the following steps:
S1 obtains hard plastic material surface gray level image;
S2 carries out binary conversion treatment to the gray level image acquired and obtains bianry image, extracts in the gray level image
Slit region ROI image makes the ROI be separated with the background in gray level image;
S3 obtains the single pixel framework information in ROI image;
S4 carries out pixel point analysis to the single pixel framework information of ROI image, will meet the product of crack into rower
Note.
During the progress binary conversion treatment to gray level image, handled using percolation algorithm, specifically include following steps:
S2.1 sets maximized window as M × M, and current window size is N × N, and the pixel at current window center is set
For sub-pixel point, which is permeable areasD p Interior point permeates, the sub-pixel since the sub-pixel point
The brightness I (ps) of point is arranged to initial threshold T;
S2.2, permeable areas Dp8 neighborhoods be Dc, judge permeable areas DcBetween interior pixel brightness and initial threshold T
Magnitude relationship, if 8 neighborhood DcThe brightness value of some interior pixel is less than initial threshold T, then belongs to the pixel and ooze
Saturating region Dp, the pixel is otherwise belonged into background Db;
S2.3 judges permeable areasD p Whether current window border is arrived at, if permeable areasD p Current window side is not arrived at
Boundary, then return to step S2.2 continue current process of osmosis;If permeable areasD p Current window border is arrived at, then expands current window
Size, make N=N+2;
S2.4 using the window after expansion as current window, starts the pixel infiltration of a new round, judges current permeable areas
Dp8 neighborhood DcMagnitude relationship between interior pixel brightness and initial threshold T;If DcInside there are brightness to be less than initial threshold
The pixel is then belonged to permeable areas D by the pixel of value Tp;If DcIt is interior that there is no the pictures that brightness value is less than initial threshold T
Vegetarian refreshments then terminates process of osmosis;
S2.5, judges whether current window size is more than maximum window size, i.e. whether N is more than M, if more than then terminating to ooze
Through journey, if being less than, otherwise return to step S2.3, carries out the process of osmosis of a new round, until infiltration terminates, obtains binary picture
Picture extracts the ROI in image.
The brightness value of pixel in the window is calculated by following equation update, whereinI(p) represent pixel
Point brightness:
。
Single pixel framework information in the acquisition ROI image, specifically includes:
By each pixel in the ROI in binary image, eliminate template with pre-set 8 and matched,
If there is no identical elimination templates, retain current pixel point;If there are identical elimination template by current pixel point again
Retain template with 9 to be matched, if there are identical reservation templates, retain current pixel point, if there is no identical guarantors
Template is stayed then to delete current pixel point, until all pixels point in ROI is matched one by one, obtains the single pixel skeleton of ROI.
In the step S4, crackle judgement specifically is carried out using 8 neighborhood criterion, if containing neighborhood in the single pixel skeleton
Point number is more than 2 pixel, then current hard plastic material surface has crackle.
The present invention can quickly, precisely detect hard plastic material face crack, be especially adapted for use in as product package material
The device of material(Such as current transformer)The detection method of face crack promotes the quality of product.
Description of the drawings
Attached drawing 1 is flow diagram of the present invention;
Attached drawing 2 is the process flow schematic diagram of percolation algorithm of the present invention;
Attached drawing 3 is hard plastic material face crack gray level image schematic diagram;
Attached drawing 4 is the binary image schematic diagram in the present invention after binary conversion treatment;
Attached drawing 5 is the extraction field schematic diagram of current pixel point in the present invention;
Attached drawing 6 is the pre-defined elimination template schematic diagram of the present invention;
Attached drawing 7 is the pre-defined reservation template schematic diagram of the present invention;
Attached drawing 8 is the single pixel skeleton schematic diagram obtained in the present invention;
Attached drawing 9 is 8 neighborhood schematic diagrames of pixel in the present invention;
Attached drawing 10 is that 8 neighborhood of single pixel skeleton judges that result is the schematic diagram with crackle in the present invention.
Specific embodiment
For the ease of the understanding of those skilled in the art, the invention will be further described below in conjunction with the accompanying drawings.
As shown in attached drawing 1~5, a kind of crack detecting method on hard plastic material surface comprises the following steps:
S1 obtains hard plastic material surface gray level image.Target product to be detected is imaged, obtains its gray level image, such as
Shown in attached drawing 3.
S2 carries out binary conversion treatment to the gray level image acquired and obtains bianry image, extracts in the gray level image
Slit region ROI image makes the ROI be separated with the background in gray level image, as shown in Figure 4.The ROI image is gray scale
Target slit region in image.
S3 obtains the single pixel framework information in ROI image, as shown in Figure 8, to get rid of the pixel framework of background letter
Breath.
S4 carries out pixel point analysis to the single pixel framework information of ROI image, will meet the product of crack into rower
Note specifically carries out crackle judgement using 8 neighborhood criterion, if containing pixel of the neighborhood point number more than 2 in the single pixel skeleton
Point, then current hard plastic material surface is with crackle.As shown in Figure 10, it is the product with crackle.
In addition, when carrying out binary conversion treatment to gray level image, handled using percolation algorithm, as shown in Figure 2, tool
Body comprises the following steps:
S2.1 sets maximized window as M × M, and current window size is N × N, and the pixel at current window center is set
For sub-pixel point, which is permeable areasD p Interior point permeates, the sub-pixel since the sub-pixel point
The brightness I (ps) of point is arranged to initial threshold T.
S2.2, permeable areas Dp8 neighborhoods be Dc, permeable areas of breaking DcBetween interior pixel brightness and initial threshold T
Magnitude relationship, if 8 neighborhood DcThe brightness value of some interior pixel is less than initial threshold T, then the pixel is belonged to infiltration
Region Dp, the pixel is otherwise belonged into background Db.The point centered on sub-pixel point starts, to constantly infiltration around, often to ooze
A saturating pixel, all by the brightness value of the pixel compared with initial threshold T.
S2.3 judges permeable areasD p Whether current window border is arrived at, if permeable areasD p Current window side is not arrived at
Boundary has not yet permeated all pixels point in current window, then return to step S2.2 continues current process of osmosis;If it oozes
Saturating regionD p Current window border is arrived at, i.e., all pixels point in current window is permeated and completed, then expand current window
The size of mouth, makes N=N+2, that is to say, that expand as size N × N of original window(N+2)×(N+2), it is radix with+2.
Among the process of seeing through, for the value of different pixels point brightness, under listing formula is calculated, inI(p) table
Show pixel brightness, i.e., often brightness value is all calculated, then compared with initial threshold T by a pixel.
。
S2.4 using the window after expansion as current window, starts the pixel infiltration of a new round, judges current permeable areas
Dp8 neighborhood DcMagnitude relationship between interior pixel brightness and initial threshold T;If 8 neighborhood DcInside there are brightness to be less than just
The pixel of beginning threshold value T, then belong to permeable areas D by the pixelp;If 8 neighborhood DcThe interior brightness value that is not present is less than initially
The pixel of threshold value T, then terminate process of osmosis, shows that also there is no belong to permeable areas D after expansion windowpPixel.
S2.5, judges whether current window size is more than maximum window size, i.e. whether N is more than M, if more than then terminating to ooze
Through journey, if being less than, otherwise return to step S2.3, carries out the process of osmosis of a new round, until infiltration terminates, obtains binary picture
Picture extracts the ROI in image.N herein is the numerical value after expanding.If that is, by step S2.3 and step
Window size after the first round expansion of S2.4 has been above maximum window size, then terminates process of osmosis.If by step
Window size after the expansion of the first round of S2.3 and step S2.4 is less than maximum window size, then expands current window again,
The N of the size of current window is made to add 2 again.It is then back to the infiltration that step S2.3 and S2.4 carry out a new round.In this way, through excessive wheel
Greyscale image transitions are binary image, ROI are made to be separated from background by the infiltration to pixel, are enhanced between ROI and background
Contrast, as shown in figures 3 and 4.
For obtaining the single pixel framework information in ROI image, obtained using modified OPTA algorithms, modified
OPTA algorithm detailed processes are as follows, are provided with current detection pixel and areP, neighbor pixel isQ, according to the pumping shown in Fig. 5
Field is taken, the pixel of 1 expression ROI in deleting template, retaining template, 0 represents background dot.
By each pixel in the ROI in binary image, eliminate template with pre-set 8 and matched,
If there is no identical elimination templates, retain current pixel point;If there are identical elimination template by current pixel point again
Retain template with 9 to be matched, if there are identical reservation templates, retain current pixel point, if there is no identical guarantors
Template is stayed then to delete current pixel point, until all pixels point in ROI is matched one by one, obtains the single pixel skeleton of ROI.
That is, first all pixels point of ROI in current bianry image and pre-defined 8 shown in Fig. 6 are disappeared
Removing template compares, if there are certain pixels and a certain template matches, continues to retain template progress with pre-set 9
Match somebody with somebody, otherwise retain the pixel.It then proceedes to be matched with 9 pre-set reservation templates shown in Fig. 7, if in the presence of
Certain pixel and a certain template matches, then retain the pixel, and the pixel is otherwise set to be deleted for background dot from pixel framework
It removes.Finally determine whether that all pixels point all with eliminating template and retaining template matched, if it is, terminate, if
It is not the matching for then continuing matching until completing all pixels point.In this way, by above-mentioned more wheel iteration, obtain such as 8 institute of attached drawing
The single pixel skeleton shown.
Finally, the defects of judgement of crackle, block spot, greasy dirt, crackle are contained in hard plastic material surface, according to different defects
Geometric properties provide following determination step.
According to the difference of defect geometry shape using circularity, the ROI that block defect is extracted from process percolation algorithm
Middle removal, the final ROI obtained containing only the range of linearity.Circularity is as shown by the following formula.WhereinPRepresent the perimeter of ROI,SFor
The area of ROI,CFor circularity.Circularity is used for judging linear complexity, and the circularity in point or sheet region is close to 1, circularity
Show that region is linearly more complicated more greatly.If circularity threshold value isT circle , willCIt is less thanT circle ROI delete.
Skeletal extraction is carried out to ROI.Hard plastic material particularity and the mechanism for forming crackle so that hard plastic material surface
Crackle have the characteristics that it is elongated, complicated, and with bifurcation.Slit region single pixel skeleton letter is obtained using improved OPTA
Breath, analyzes and determines crackle skeleton by 8 neighborhood point diagnostic methods, and 8 neighborhood methods are as shown in figure 9, (i, j) is current picture in figure
Vegetarian refreshments, N1, N2 ... .., N8 are 8 neighborhood points.It chooses crack image such as Fig. 8 and cut image is as shown in Figure 10.It is deposited according to slight crack
In the characteristic of bifurcation, if being determined as crackle, i.e., such as Figure 10 institutes there are the pixel that neighborhood point number is more than 2 in skeleton image
Show, containing pixel tool of the neighborhood point number more than 2 there are two crotch in Fig. 8, the pixel at the two punishment forks center has
Two neighborhood point numbers, show to contain crackle in hard plastic material surface image.Certainly, in practice, may have 3,4 or
More neighborhood points, as long as the neighborhood point number more than 2, is all determined as with crackle.
It should be noted that described above is not the restriction to technical solution of the present invention, the wound of the present invention is not being departed from
On the premise of making design, any obvious replacement is within protection scope of the present invention.