Summary of the invention
A kind of edge defect detection algorithm and device is provided, to solve edge defect accuracy of detection of the prior art difference and inefficient problem in the embodiment of the present invention.
In order to solve the problems of the technologies described above, the embodiment of the invention discloses following technical scheme:
A kind of edge defect detection algorithm, described method comprises:
According to the image of the object under test of capture apparatus shooting, obtain the marginal point of described object under test;
Mark to described marginal point, the height according to scoring determines matching marginal point and candidate marginal;
According to the edge of described matching marginal point matching object under test, obtain the matching edge of described object under test;
Calculate and draw the distance of described candidate marginal to described matching edge, and judging whether described distance is greater than defect threshold distance;
If described distance is greater than described defect threshold distance, then described candidate marginal is Defect Edge point;
According to described Defect Edge point, obtain edge defect testing result.
Alternatively, according to the image of the object under test that described capture apparatus is taken, before obtaining the marginal point of described object under test, described method also comprises:
By the image of described object under test along marginal position segmentation, segmented image is corresponding with described marginal point.
Alternatively, described method also comprises:
According to the contrast of object under test image, determine the marginal point of described object under test.
Alternatively, according to the contrast of described marginal point and the position of marginal point, described marginal point is marked, comprising:
According to the contrast of marginal point, obtain the intensity ratings of described marginal point;
According to the position of marginal point, obtain the location score of described marginal point;
Calculated by the combination of described intensity ratings and described location score, obtain the scoring of described marginal point.
Alternatively, after the edge according to described matching marginal point matching object under test, described method also comprises:
Digital simulation marginal point to the distance at matching edge, and judges whether described distance is greater than outlier threshold distance;
If described distance is greater than described outlier threshold distance, reject corresponding matching marginal point, the edge of object under test according to current matching marginal point matching, upgrade the matching edge of object under test;
Described outlier threshold distance is greater than described defect threshold distance.
Alternatively, after obtaining the matching edge of described object under test, described method also comprises:
According to the distance of marginal point to current matching edge, described marginal point is marked again;
According to the height of scoring, upgrade matching marginal point and candidate marginal;
According to current matching marginal point matching again, and upgrade matching edge.
Alternatively, after again marking to described marginal point, described method also comprises:
Judge that matching marginal point is the need of renewal; And,
If matching marginal point needs to upgrade, upgrade matching marginal point, according to the matching again of current matching marginal point, and upgrade matching edge.
A kind of edge defect pick-up unit, described device comprises:
Marginal point acquisition module, for the image of object under test taken according to capture apparatus, obtains the marginal point of described object under test;
Marginal point grading module, for marking to described marginal point, the height according to scoring determines matching marginal point and candidate marginal;
Edge fitting module, for the edge according to described matching marginal point matching object under test, obtains the matching edge of described object under test;
Defect dipoles module, for calculating and drawing the distance of described candidate marginal to described matching edge, and judges whether described distance is greater than defect threshold distance; If described distance is greater than described defect threshold distance, then described candidate marginal is Defect Edge point;
Testing result generation module, for according to described Defect Edge point, obtains edge defect testing result.
Alternatively, described marginal point acquisition module also for by the image of described object under test along marginal position segmentation, segmented image is corresponding with described marginal point.
Alternatively, described marginal point acquisition module, according to the contrast of object under test image, determines the marginal point of described object under test.
Alternatively, the contrast of described edge grading module according to described marginal point and the position of marginal point, described marginal point is marked, comprising:
Described edge grading module, according to the contrast of marginal point, obtains the intensity ratings of described marginal point;
Described edge grading module, according to the position of marginal point, obtains the location score of described marginal point;
Described edge grading module calculates according to the combination of described intensity ratings and described location score, obtains the scoring of described marginal point.
Alternatively, described device also comprises abnormal marginal point screening module:
Described abnormal marginal point screening module digital simulation marginal point to the distance at matching edge, and judges whether described distance is greater than outlier threshold distance;
If described distance is greater than described outlier threshold distance, described abnormal marginal point screening module rejects corresponding matching marginal point; The edge of described edge fitting module object under test according to current matching marginal point matching, upgrades the matching edge of object under test;
Described outlier threshold distance is greater than defect threshold distance.
Alternatively, described device also comprises grading module again:
Described grading module again, according to the distance of marginal point to current matching edge, is marked again to described marginal point;
Described grading module again, according to the height of scoring, upgrades matching marginal point and candidate marginal;
Described edge fitting module according to current matching marginal point matching again, and upgrades matching edge.
Alternatively, described device also comprises renewal judge module:
Described renewal judge module judges that matching marginal point is the need of renewal; And,
If matching marginal point needs to upgrade, upgrade matching marginal point, and send fitting instructions to edge fitting module, indicate described edge fitting module according to the matching again of current matching marginal point, and upgrade matching edge.
From above technical scheme, a kind of edge defect detection algorithm that the embodiment of the present invention provides and device, according to the image of the object under test of capture apparatus shooting, obtain the marginal point of described object under test; Mark to described marginal point, the height according to scoring determines matching marginal point and candidate marginal; Then according to the edge of described matching marginal point matching object under test, obtain the matching edge of object under test, calculated candidate marginal point is to the distance at matching edge, if described distance is greater than defect threshold distance, then described candidate marginal is Defect Edge point, finally obtains edge defect testing result according to described Defect Edge point.In whole defect inspection process, described capture apparatus itself has very high precision, by the analysis of object under test image obtained capture apparatus, and use the mode of scoring further, effectively can obtain the marginal point of object under test, the object under test edge utilizing described marginal point to simulate and the actual ideal edge of object under test have minimum even negligible error, finally by the Distance Judgment whether existing defects of marginal point to matching edge, effectively improve the precision that edge defect detects; And, in above-mentioned testing process, without the need to manpower intervention, avoid tired due to technician's human eye vision and detection efficiency that is that cause declines.
Embodiment
Technical scheme in the present invention is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
In traditional industrial processes, the length of industrial products is mainly paid close attention in the quality inspection of industrial products, whether width equidimension meets standard technical specifications, and checks whether the surface of industrial products has obviously distortion or defect.Along with the progress of manufacturing technology, the quality requirements of industrial products improves constantly, and especially in the high mobile phone of accuracy standard and IC manufacturing field, the rim condition of industrial products becomes the key factor of its quality of restriction and yield gradually.Such as manufacture field at mobile phone, mobile phone screen comprises outer mobile phone screen, touch screen and display screen three layers, and outer mobile phone screen is generally rectangular chemically reinforced glass screen; In mobile phone assembling process, outer mobile phone screen just must can complete with cellphone body precision-matched and assembles and play a protective role to the touch screen of interior of mobile phone and display screen, therefore must ensure that the edge of outer mobile phone screen does not have defect; If the defect of indenture or convex epirelief appears in outer mobile phone screen, will the assembling of mobile phone be had a strong impact on, and even cause mobile phone normally to use.In IC manufacturing field, integrated circuit silicon chip is generally the circular silicon chip of 8 cun or 12 cun and surrounding correspondence position arranges 4 straight line trimmings, and namely the edge of integrated circuit silicon chip is the combination edge be made up of circular arc and straight line; In ic manufacturing process, integrated circuit silicon chip needs through the technique such as photoetching, doping, if there is the edge defect such as indenture or convex epirelief, the change of edge's integrated circuit technology environment will be caused, make the chip based on integrated circuit silicon chip to reach design specification, finally cause yield to decline.Therefore, the edge defect detection of industrial products is important guarantees of industrial product quality.
At present, the main mode using manual detection is detected to the edge defect of industrial products, by high Definition CCD (ChargeCoupledDevice, charge coupled cell) industrial camera takes the edge of industrial products to be measured, obtain the edge image of industrial products to be measured, technician judges whether existing defects by macroscopic mode; Above-mentioned edge defect detection algorithm can meet the detection demand of the lower industrial products of accuracy requirement, such as packing box, computer casing etc., but manufactures field for high precision, be then difficult to reach industrial accuracy requirement; Commercial production is generally production line balance simultaneously, and the efficiency requirements of output huge edge defects detection is high, and the edge defect relying on the visual inspection of human eye to be difficult to satisfied a large amount of industrial products completely detects.The edge defect detection algorithm that the embodiment of the present invention provides and device, by the marginal point of accurately locating industrial products to be measured of sampling, then edge comment point screening, make to be coincide with minimum even negligible error by the matching edge of marginal point matching the edge of industrial products specification requirement to be measured, whether last exist edge defect according to the Distance Judgment of marginal point to matching edge and draw testing result, whole edge defect testing process, without the need to artificial participation, ensures that the high precision of edge defect detection is with efficient.
In addition, it should be noted that the edge defect detection algorithm that the embodiment of the present invention provides and device, mainly for the industrial products with regular edge, such as comprise the industrial products at one or more edges of circular arc, straight line, ellipse etc., described regular edge can be understood as the edge having regular-expression, easily carry out Mathematical Fitting.
The embodiment that method of the present invention is corresponding
As shown in Figure 2, be the schematic flow sheet of a kind of edge defect detection algorithm that the embodiment of the present invention provides, described edge defect detection algorithm comprises:
Step S101: according to the image of the object under test of capture apparatus shooting, obtain the marginal point of described object under test.
In order to ensure the sharpness of object under test image, described capture apparatus can be industrial CCD camera or industrial CMOS (ComplementaryMetalOxideSemiconductor, complementary metal oxide semiconductor (CMOS)) camera etc.Described capture apparatus can take entirety or the local of described object under test, such as, when edge defect detection being carried out to outer mobile phone screen, described capture apparatus can be taken pictures, to obtain the complete image of described outer mobile phone screen directly over described outer mobile phone screen, by the visual field that described capture apparatus is all included at described outer mobile phone screen 4 edges in; Certainly, described capture apparatus also once only can take 1 edge of described outer mobile phone screen or the local at described 1 edge.
The object under test image that described capture apparatus obtains can be black white image or coloured image; For coloured image, can gray processing process be carried out, be converted to gray level image by coloured image.Gray scale refers to the shade of pixel in black white image, and scope is from 0 to 255, and white is 255, and black is 0; Coloured image is made up of red green blue tricolor, the gray processing of coloured image is treated to the brightness value of red green blue tricolor corresponding for pixel each in original color image, be adjusted to equal with certain algorithm as floating-point arithmetic, integer method and mean value method etc., namely obtain gray level image.In the specific implementation, described gray level image is made up of a large amount of pixels, the gray-scale value that each pixel is corresponding is well-determined, in order to determine the position of marginal point, first must determine the direction of scanning of pixel, if the actual edge direction of such as described direction of scanning and object under test overlaps or has very little acute angle, then the determination efficiency that can reduce marginal point even causes finding false marginal point; Described direction of scanning can obtain in the following manner: in the mode of sampling or travel through along multiple directions scanning element point, thus obtain the shade of gray of respective direction, described shade of gray can be understood as the variable quantity of unit picture element distance gray scale, the traversal direction that described shade of gray maximal value is corresponding or sample direction are described direction of scanning, and described direction of scanning is perpendicular to the edge of object under test; On described direction of scanning, can obtain the distribution waveform of shade of gray, described distribution waveform medium wave peak or pixel corresponding to trough can be defined as marginal point.Certainly, in actual production process, can according to the edge type of object under test, preset the visual field of capture apparatus, thus described direction of scanning need not be determined by the mode of sampling or travel through, such as the detection at outer mobile phone screen isoline type edge, the visual field of described capture apparatus can be adjusted, the X-direction of the image that described capture apparatus is taken is parallel or be acute angle with the edge of described outer mobile phone screen, then can scan each pixel along the Y-direction of shooting image, determine the shade of gray distribution of pixel, thus determine marginal point.
Alternatively, by the contrast of object under test image, determine the marginal point of described object under test.Contrast refer to light and shade region in piece image the brightest in vain and the darkest black between the measurement of different brightness level, namely refer to the anti-extent of piece image gray scale.In embodiments of the present invention, described contrast can be understood as image zones of different gray value differences.Concrete determining step comprises: the direction of scanning determined according to above-mentioned steps, obtains the gray-scale value of pixel on described direction of scanning; Calculate the gray value differences of neighbor pixel; Judge whether described gray value differences is greater than a gray threshold, if described gray value differences is greater than described gray threshold, then the pixel that described gray value differences is corresponding is marginal point; Described gray threshold is pre-set gray threshold, such as, can be 30,50 or other any number.Certainly, in actual testing process, multiple gray threshold can be set, such as arrange the first gray threshold be 50 and second gray threshold be 35, if judge that described gray value differences is more than or equal to described first gray threshold, then described pixel is the marginal point that most probable and described object under test edge match; If judge that described gray value differences is more than or equal to described second gray threshold 35 and is less than described first gray threshold, then described pixel is the marginal point at doubtful object under test edge; If described gray value differences is less than described second gray threshold, then ignore corresponding pixel.
Alternatively, according to the image of the object under test that described capture apparatus is taken, before obtaining the marginal point of described object under test, also comprise by the image of described object under test along marginal position segmentation, segmented image is corresponding with described marginal point.After the image obtaining described object under test, along the direction vertical with direction of scanning described in above-mentioned steps, by the image segmentation of described object under test, every section represents with affine rectangle.Described affine rectangle is the common technology of image processing field, is that rectangular image obtains after affined transformation, and common square, rectangle, parallelogram are all affine rectangles, and described affine rectangle is the affine rectangle of rectangle in embodiments of the present invention; Described affine rectangle is used for marking interested region at the adjacent edges of described object under test, thus effectively improves the efficiency of edge defect detection.As shown in Figure 3, be the structural representation after the segmentation of object under test edge image, comprise edge 210 and affine rectangle 220.In concrete application scenarios, such as described object under test is outer mobile phone screen, and the image photographed is the image of a Linear edge of outer mobile phone screen, described image is divided into 7 or any number of affine rectangles along the direction vertical with direction of scanning, and the spacing of the width of described affine rectangle and adjacent described affine rectangle does not limit in embodiments of the present invention, those skilled in the art can arrange described width and described spacing is arbitrary value.After completing the segmentation of described object under test edge image, can analyze by the image corresponding to each affine rectangle, by the method in above-mentioned steps, determine marginal point; Each described affine rectangle all comprises the edge of described object under test, and corresponding with described marginal point, in the specific implementation, and corresponding 7 marginal points of described 7 affine rectangles.
Step S102: mark to described marginal point, the height according to scoring determines matching marginal point and candidate marginal.
By the marginal point that described step S101 determines, often comprise multiple marginal point, as shown in Figure 4, be the affine rectangular image schematic diagram in object under test edge, described affine rectangular image comprises 3 marginal points: the first marginal point 310, second marginal point 320 and the 3rd marginal point 330.Wherein, the contrast of described first marginal point 310 is 35, and the contrast of described second marginal point 320 is 50, and the contrast of described 3rd marginal point 330 is 40.Described first marginal point 310, described second marginal point 320 and described 3rd marginal point 330 are marked, according to the height of scoring, determine more close to the marginal point of object under test true edge, and using described marginal point as matching marginal point and candidate marginal; Described matching marginal point is used for carrying out edge fitting, and described candidate marginal is used for judging whether to there is indenture or convex epirelief defect.
Alternatively, according to the contrast of described marginal point and the position of marginal point, described marginal point is marked, is illustrated in figure 5 the schematic flow sheet of a kind of marginal point scoring that the embodiment of the present invention provides, comprises the following steps:
Step S201: according to the contrast of marginal point, obtains the intensity ratings of described marginal point.
As shown in Figure 4, an affine rectangle comprises 3 marginal points in embodiments of the present invention: the first marginal point 310, second marginal point 320 and the 3rd marginal point 330; According to the contrast of described marginal point, obtain the intensity ratings of described marginal point.Described intensity ratings criterion is " the strongest edge " criterion, and namely the contrast of described marginal point is higher, and corresponding described intensity ratings is higher.In the specific implementation, such as described intensity ratings is centesimal system, and scope of namely marking is 0-100, and the score value of intensity ratings is higher, and corresponding intensity is higher, and the contrast of corresponding marginal point is also higher.According to mentioned above principle, determine the intensity ratings of the first marginal point 310 to be the intensity ratings of the 75, second marginal point 320 be that the intensity ratings of the 95, three marginal point 330 is 80.Certainly, those skilled in the art can adopt other mathematics quantization methods to obtain described intensity ratings, set up the mathematical conversion relation of described marginal point contrast and intensity ratings, the contrast * a+b of the intensity ratings=marginal point of such as marginal point, wherein a is scale factor constant, and b is constant etc.
Step S202: according to the position of marginal point, obtains the location score of described marginal point.
Equally as shown in Figure 4, location score is carried out to the marginal point in described affine rectangle.Described location score criterion is " Article 1 edge " criterion, and namely the position of marginal point is more forward, and the score value of described location score is higher.The position of described marginal point is forward, can be understood as, and described marginal point is away from the inside of object under test.Shown in Fig. 43 marginal point, is followed successively by the first marginal point 310, second marginal point 320 and the 3rd marginal point 330 from inside to outside, and according to described " Article 1 edge " criterion, the position of described 3rd marginal point 330 is the most forward, and location score is 100; More rearward, location score is 75 in the position of described second marginal point 320; The position of described first marginal point 310 is last, and location score is 50.Described location score can be uniformly distributed according to the position linearity of marginal point, or non-uniform Distribution etc.
Step S203: calculated by the combination of described intensity ratings and described location score, obtain the scoring of described marginal point.
The described intensity ratings obtained respectively according to step S201 and step S202 and described location score, obtain the scoring of described marginal point.In the specific implementation, the intensity ratings of such as, the first marginal point 310 shown in Fig. 4 is 75, and location score is 50; The intensity ratings of the second marginal point 320 is 95, and location score is 75; The intensity ratings of the 3rd marginal point 330 is 80, and location score is 100.In embodiments of the present invention, the mode that described intensity ratings and described location score can be used to be added obtains the scoring of described marginal point, and thus, the scoring of described first marginal point 310 is 125, the scoring of described second marginal point 320 is 170, and the scoring of described 3rd marginal point 330 is 180.Certainly, those skilled in the art can use other mathematical algorithms to calculate the scoring of described marginal point, such as, consider the influence power that described intensity ratings and described location score are determined described marginal point, use weighting factor to determine the scoring of respective edges point; Consider that intensity ratings is the key determining marginal point, the weighting factor arranging intensity ratings is 0.6, and consider that location score is to determining that the influence power of marginal point is less, the weighting factor of setting position scoring is 0.4; Then the scoring of the first marginal point 310 is 0.6 × 75+0.4 × 50=65, and the scoring of the second marginal point 320 is 0.6 × 95+0.4 × 75=87, and the scoring of the 3rd marginal point 330 is 0.6 × 80+0.4 × 100=88 etc.
Use after above-mentioned marking mode marks to all marginal points in affine rectangle, according to the height of scoring, determine further, the matching marginal point corresponding to corresponding affine rectangle and candidate marginal.In the specific implementation, the scoring of the marginal point such as determined according to above-mentioned steps, due to the scoring of scoring > first marginal point 310 of scoring > second marginal point 320 of the 3rd marginal point 330, determine that the 3rd marginal point 330 in the affine rectangle shown in Fig. 4 is the matching marginal point and candidate marginal that described affine rectangle is corresponding.According to said method, other affine rectangles are judged accordingly, thus determine the matching marginal point that each affine rectangle is corresponding and candidate marginal.
Step S103: according to the edge of described matching marginal point matching object under test, obtain the matching edge of described object under test.
According to the matching marginal point that step S102 determines, carry out Mathematical Fitting, obtain the matching edge of described object under test.In concrete Mathematical Fitting process, if the edge of object under test is the edge of single type, such as outer mobile phone screen has 4 Linear edges, Mathematical Fitting can be carried out to corresponding 4 Linear edges, and for Linear edge, matching can be carried out, to improve matching speed by the less marginal point of choice for use; If the edge of object under test is the mixed edge of straight line and circular arc, matching can be carried out respectively to described linear edge and described arc edge, to obtain the matching edge of object under test.
Alternatively, after the edge according to described matching marginal point matching object under test, as shown in Figure 6, be the schematic flow sheet of a kind of abnormal marginal point filter method that the embodiment of the present invention provides, described edge defect detection algorithm is further comprising the steps of:
Step S301: digital simulation marginal point to the distance at matching edge, and judges whether described distance is greater than outlier threshold distance.
After obtaining described matching edge, digital simulation marginal point is to the distance at described matching edge.In the specific implementation, if such as described matching edge is Linear edge, calculate the distance of described matching marginal point to described Linear edge; If described matching edge is circular arc type edge, described matching marginal point, to a bit in the unique corresponding described radiused edges of line in the center of circle, circular arc type edge, calculates the distance of described matching marginal point to any in described radiused edges; If described matching edge is oval rim, according to the distance of the focus calculation of described oval rim above-mentioned matching marginal point to described oval rim; If described matching edge is the combination edge of straight line and circular arc, then according to the account form of corresponding Linear edge and radiused edges, obtain the distance of corresponding marginal point to described matching edge respectively.According to the distance of described distance, judge whether described marginal point is abnormal marginal point, described abnormal marginal point can be understood as when analyzing described object under test edge pattern, the marginal point of the vacation of introducing.When carrying out edge fitting, the marginal point of the overwhelming majority is all gathered in around described matching edge, and described abnormal marginal point is often far away apart from described matching edge.By the size of more described distance with outlier threshold distance, judge whether described marginal point is abnormal marginal point; Described outlier threshold distance can be set to any number, such as 5mm etc.
Step S302: if described distance is greater than described outlier threshold distance, reject corresponding matching marginal point, the edge of object under test according to current matching marginal point matching, upgrades the matching edge of object under test.
Obtain the distance of marginal point to matching edge according to step S301, if described distance is more than or equal to described outlier threshold distance, then described matching marginal point is abnormal marginal point.Described matching marginal point need be rejected, according to the matching marginal point after rejecting, marginal point described in Mathematical Fitting, obtains the matching edge of new object under test, replaces former matching edge, complete the renewal to matching edge with the matching edge of described new object under test.Described matching edge after renewal effectively eliminates abnormal marginal point, makes the matching edge after described renewal more meet the actual edge of object under test, improves the degree of accuracy that edge defect detects.
Alternatively, after obtaining the matching edge of described object under test, as shown in Figure 7, the schematic flow sheet that a kind of marginal point provided for the embodiment of the present invention is marked again, described edge defect detection algorithm is further comprising the steps of:
Step S401: according to the distance of marginal point to current matching edge, described marginal point is marked again.
After obtaining the matching edge of described object under test, as shown in Figure 8, for the affine rectangular image schematic diagram in object under test edge after edge fitting, described affine rectangular image comprises 5 marginal points and current matching edge 410, and wherein said 5 marginal points comprise primary importance marginal point 420, second place marginal point 430, the 3rd position marginal point 440, the 4th position marginal point 450 and the 5th position marginal point 460.According to the distance of marginal point to current matching edge, described marginal point is marked again; Described marginal point, the closer to described current matching edge 410, is marked higher, and scoring can be the centesimal system of 0-100, and distributes according to the distance homogenous linear of described marginal point to described current matching edge; In the embodiment that the inventive method provides, primary importance marginal point 420 overlaps with described current matching edge 410, and the scoring of described primary importance marginal point is 100 points; Described second place marginal point 430 is away from described current matching edge 410, and the scoring of described second place marginal point 430 is 75 points; The described 3rd described further away from each other current matching edge 410 of position marginal point 440, the scoring of described 3rd position matching marginal point is 50 points; According to said method, determine that the scoring of described 4th position marginal point 450 be the scoring of 25 points and described 5th position marginal point 460 is 0 point respectively.Certainly, those skilled in the art can arrange arbitrarily corresponding standards of grading, and the form of such as described scoring can not be centesimal system, can be 5 points of systems etc.; Described scoring also need not distribute for homogenous linear; Described scoring also according to the mathematical relation of marginal point to current matching Edge Distance, can determine corresponding scoring etc.
Step S402: according to the height of scoring, upgrades matching marginal point and candidate marginal.
Obtain the marginal point scoring height in affine rectangular image according to step S401, upgrade matching marginal point and candidate marginal.In the specific implementation, in affine rectangular image such as shown in Fig. 8, the scoring of the 5th position marginal point 460 described in the scoring > of the 4th position marginal point 450 described in the scoring > of the 3rd position marginal point 440 described in the scoring > of second place marginal point 430 described in the scoring > of described primary importance marginal point 420, determines that described primary importance marginal point is the matching marginal point and candidate marginal that described affine rectangular graph is corresponding thus.According to same method, further the marginal point in other affine rectangles is marked again, and upgrade matching marginal point corresponding to other affine rectangles and candidate marginal according to the height of scoring.
Step S403: according to current matching marginal point matching again, and upgrade matching edge.
Through step S402, described matching marginal point upgrades again, according to current matching marginal point, with the edge of the mode of Mathematical Fitting again matching object under test, and the matching edge after matching is again replaced original matching edge, completes the renewal at matching edge.
Alternatively, in above-mentioned steps S401, after again marking to described marginal point, described edge defect detection algorithm also comprises: judge that matching marginal point is the need of renewal; And, if matching marginal point needs to upgrade, upgrade matching marginal point, according to the matching again of current matching marginal point, and upgrade matching edge.
After marginal point is marked again, if the current matching marginal point that in affine rectangle, the highest marginal point of scoring is corresponding with described affine rectangle is consistent, such as, be all the 3rd position marginal point 440, then the matching marginal point that described affine rectangle is corresponding is without the need to renewal; Further, judge whether that matching marginal point that all affine rectangles are corresponding is the need of renewal; If travel through all affine rectangles, judge that corresponding matching marginal point does not all need to upgrade, then without the need to carrying out matching again according to current matching marginal point, and upgrading matching edge, avoiding the computing resource waste caused because upgrading matching edge.If judge have the matching edge of any one affine rectangle to need to upgrade, then upgrade matching marginal point, according to the matching marginal point matching again after renewal, and upgrade matching edge.
Certainly, can also according to the Distance Judgment of marginal point the need of renewal matching edge.In the specific implementation, such as, in affine rectangle, current matching marginal point is second place marginal point 430, and again after scoring, the scoring of primary importance marginal point 420 is the highest; Further, judge the distance between described primary importance marginal point 420 and described second place marginal point 430, if described distance is less than a threshold distance such as 1mm, even if the matching marginal point that then affine rectangle is corresponding is updated to, the impact of described primary importance marginal point 420 on final matching edge result is also limited even can be ignored, therefore the matching edge that described affine rectangle is corresponding without the need to upgrade, also without the need to carrying out matching again to upgrade matching edge.
Step S104: calculate and draw the distance of described candidate marginal to described matching edge, and judging whether described distance is greater than defect threshold distance.
Determined the matching edge of described object under test by step S103 after, calculated candidate marginal point is to the distance at described matching edge, and circular can refer step S301, does not repeat them here.Preset defect threshold distance, for judging whether described candidate marginal is Defect Edge point, and described defect threshold distance can be set to 3mm, and described defect threshold distance is less than the outlier threshold distance described in step S301.Certainly, described defect threshold distance can be set to other any number according to the needs of actual accuracy of detection by those skilled in the art.
Step S105: if described distance is greater than described defect threshold distance, then described candidate marginal is Defect Edge point.
Described candidate marginal, to the distance at matching edge, if be greater than described defect threshold distance, then judges that described candidate marginal is Defect Edge point.By positional information records such as coordinates corresponding for described Defect Edge point, use in order to subsequent step.
Step S106: according to described Defect Edge point, obtain edge defect testing result.
Statistical study is carried out to the Defect Edge point obtained in step S105, if described Defect Edge point does not detect in step S105, then judge that described object under test does not exist edge defect, and drawing the normal testing result in edge, the normal testing result in described edge can be the examining report or the only Detection Information frame etc. that passes through of label detection that comprise the statisticss such as detection time; If the number of the Defect Edge point detected in step S105 is less than a defect number threshold value, described defect number threshold value can be 2 or 3 etc., the described Defect Edge point then likely detected is for checking wrong redundancy, and ignore, thus judge that described object under test does not exist edge defect, and draw the normal testing result in described edge.
If judge that described object under test exists edge defect, further, affine rectangle corresponding to adjacent edge defect point is merged; By the shape of the formation at edge defect point and matching edge, can the length of edge calculation defect and area, and the statistics such as the ratio of edge defect, finally draw the edge defect testing result comprising described statistics.Those skilled in the art according to the actual requirements, can design the form of described edge defect testing result and specify the data message etc. that described edge defect testing result comprises.
Certainly, in order to improve edge defect detection efficiency, this area and personnel can use above-mentioned edge defect detection algorithm, carry out edge defect detection concurrently simultaneously, and draw edge defect testing result to two or many edges.
The edge defect detection algorithm that the embodiment of the present invention provides, by the image using high-precision capture apparatus to obtain object under test, obtains the marginal point of object under test; And then described marginal point is marked, height according to scoring determines matching marginal point and candidate marginal, the matching marginal point determined thus obtains the matching edge of object under test by the mode of matching, and described matching edge to coincide actual object under test edge with high precision; Further by the distance of calculated candidate marginal point to described matching edge, judge whether described matching marginal point is Defect Edge point, finally obtains edge defect testing result according to described Defect Edge point.In whole edge defect testing process, obtain edge defect testing result by the treatment and analyses of measuring targets image, there is high precision; And whole process is without the need to artificial participation, effectively ensure the efficiency that edge defect detects.
By the description of above embodiment of the method, those skilled in the art can be well understood to the mode that the present invention can add required general hardware platform by software and realize, hardware can certainly be passed through, but in a lot of situation, the former is better embodiment.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: ROM (read-only memory) (ROM), random access memory (RAM), magnetic disc or CD etc. various can be program code stored medium.
The embodiment that device of the present invention is corresponding
Corresponding with a kind of edge defect detection algorithm embodiment provided by the invention, present invention also offers a kind of embodiment of edge defect pick-up unit.See Fig. 9, be the structural representation of a kind of edge defect pick-up unit that the embodiment of the present invention provides, described edge defect pick-up unit comprises:
Marginal point acquisition module 510, for the image of object under test taken according to capture apparatus, obtains the marginal point of described object under test;
Marginal point grading module 520, for marking to described marginal point, the height having more scoring determines matching marginal point and candidate marginal;
Edge fitting module 530, for the edge according to described matching marginal point matching object under test, obtains the matching edge of described object under test;
Defect dipoles module 540, for calculating and drawing the distance of described candidate marginal to described matching edge, and judges whether described distance is greater than defect threshold distance; If described distance is greater than described defect threshold distance, then described candidate edge is decided to be Defect Edge point;
Testing result generation module 550, for according to described Defect Edge point, obtains edge defect testing result.
Alternatively, described marginal point acquisition module 510 also for by the image of described object under test along marginal position segmentation, segmented image is corresponding with described marginal point.
Alternatively, described marginal point acquisition module 510, according to the contrast of object under test image, determines the marginal point of described object under test.
Alternatively, described edge grading module 520, according to the contrast of described marginal point and the position of marginal point, is marked to described marginal point, being comprised:
Described edge grading module 520, according to the contrast of marginal point, obtains the intensity ratings of described marginal point;
Described edge grading module 520, according to the position of marginal point, obtains the location score of described marginal point;
Described edge grading module 520 is calculated by the combination of described intensity ratings and described location score, obtains the scoring of described marginal point.
Alternatively, described edge defect pick-up unit also comprises abnormal marginal point screening module:
Described abnormal marginal point screening module digital simulation marginal point to the distance at matching edge, and judges whether described distance is greater than outlier threshold distance;
If described distance is greater than described outlier threshold distance, described abnormal marginal point screening module rejects corresponding matching marginal point; The edge of described edge fitting module 530 object under test according to current matching marginal point matching, upgrades the matching edge of object under test;
Described outlier threshold distance is greater than defect threshold distance.
Alternatively, described edge defect pick-up unit also comprises grading module again:
Described grading module again, according to the distance of marginal point to current matching edge, is marked again to described marginal point;
Described grading module again, according to the height of scoring, upgrades matching marginal point and candidate marginal;
Described edge fitting module 530 according to current matching marginal point matching again, and upgrades matching edge.
Alternatively, described edge defect pick-up unit also comprises renewal judge module:
Described renewal judge module judges that matching marginal point is the need of renewal; And,
If matching marginal point needs to upgrade, upgrade matching marginal point, and send fitting instructions to edge fitting module 530, indicate described edge fitting module 530 according to the matching again of current matching marginal point, and upgrade matching edge.
For convenience of description, various unit is divided into describe respectively with function when describing above device.Certainly, the function of each unit can be realized in same or multiple software and/or hardware when implementing of the present invention.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiments.Especially, for device or system embodiment, because it is substantially similar to embodiment of the method, so describe fairly simple, relevant part illustrates see the part of embodiment of the method.Apparatus and system embodiment described above is only schematic, the wherein said unit illustrated as separating component or can may not be and physically separates, parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of module wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
It should be noted that, in this article, the such as relational terms of " first " and " second " etc. and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
The above is only the specific embodiment of the present invention, those skilled in the art is understood or realizes the present invention.To be apparent to one skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.