Summary of the invention
A kind of multiple edge defect inspection method and device are provided in the embodiment of the present invention, to solve inspection in the prior art
It surveys
The problem of low efficiency.
In order to solve the above-mentioned technical problem, the embodiment of the present invention has invented following technical solution:
The embodiment of the invention provides a kind of multiple edge defect inspection methods, this method comprises:
From detection target image, the marginal point of the detection target is obtained, wherein the detection target image includes more
Edge;
By the group of edge points on each edge at reference edge group;
It scores the reference edge group, determines that the high reference edge group that scores is fitting edge group and candidate edge
Group;
Marginal point in fitting edge group is fitted, obtains being fitted edge accordingly;
When the distance at the marginal point in candidate edge group to corresponding fitting edge is greater than defect threshold distance, described in determination
Marginal point in candidate edge group is the Defect Edge point of respective edges.
Optionally, carrying out scoring to the reference edge group includes:
Determine marginal dimension threshold value;
Calculate the reference distance between the neighboring edge point in reference edge group;
According to the difference of the reference distance and the marginal dimension threshold value, the scoring of the reference edge group is calculated.
Optionally, according to the difference of the reference distance and the size threshold, the scoring of the reference edge group is calculated,
Include:
According to the complexity of detection object edge, multiple difference ranges corresponding with scoring are preset;
When the difference belongs to the difference range, determine that the corresponding scoring of the difference range is used as the reference edge
The scoring of edge group.
Optionally, from detection target image, the marginal point of the detection target is obtained, comprising:
Determine that any one edge in detection target image is reference edge;
Along the reference edge, it will test target image and be divided into multiple sample projection regions, wherein the sample projection
Extending direction of the region perpendicular to the reference edge;
From the sample projection region, the marginal point of the detection target is extracted.
Optionally, the determining marginal dimension threshold value, comprising:
According to the overlapping positions in the sample projection region and the reference edge, the marginal dimension threshold value is determined.
Optionally, the group of edge points by each edge is at reference edge group, comprising:
Determine the position range of each actual edge in detection target image;
By the group of edge points within the scope of different location at reference edge group.
The embodiment of the present invention also provides a kind of multiple edge defect detecting device, which includes:
Marginal point obtains module, for from detection target image, obtaining the marginal point of the detection target, wherein institute
Stating detection target image includes a plurality of edge;
Reference edge group generation module, for by the group of edge points on each edge at reference edge group;
Reference edge group grading module determines the high reference edge that scores for scoring the reference edge group
Group is fitting edge group and candidate edge group;
Edge group fitting module obtains being fitted edge accordingly for being fitted the marginal point in fitting edge group;
Edge defect determining module is big to intramarginal distance is fitted accordingly for working as the marginal point in candidate edge group
When defect threshold distance, determine that the marginal point of the candidate edge group is the Defect Edge point of respective edges.
Optionally, the reference edge group grading module includes:
Marginal dimension threshold determination module, for determining marginal dimension threshold value;
Reference distance computing module, for calculating the reference distance between each marginal point in reference edge group;
Reference edge group scoring computing module is calculated for the difference according to the reference distance and the size threshold
The scoring of the reference edge group.
Optionally, the reference edge group scoring computing module includes:
Difference range presetting module is preset corresponding multiple with scoring for the complexity according to detection object edge
Difference range;
Reference edge group scoring determining module, for determining the difference when the difference belongs to the difference range
Scoring of the corresponding scoring of range as the reference edge group.
Optionally, the marginal point acquisition module includes:
Reference edge determining module, for determining that any one edge in detection target image is reference edge;
Sample projection region division module, for will test target image and be divided into multiple samplings along the reference edge
View field, wherein extending direction of the sample projection region perpendicular to the reference edge;
Edge point extraction module, for from the sample projection region, extracting the marginal point of the detection target.
Optionally, the marginal dimension threshold determination module, for according to the sample projection region and the reference edge
The overlapping positions of edge determine the marginal dimension threshold value.
Optionally, the reference edge group generation module includes:
Position range determining module, for determining the position range at each edge in detection target image;
Reference edge group molded tissue block, for by the group of edge points within the scope of different location at reference edge group.
The technical solution that the embodiment of the present invention provides can include the following benefits: provided in an embodiment of the present invention one
Kind multiple edge defect inspection method and device, it is described by from detection target image, obtaining the marginal point of the detection target
Detecting target image includes a plurality of edge;By the group of edge points on each edge at reference edge group;To the reference edge group
It scores, determines that the high reference edge group that scores is fitting edge group and candidate edge group;To the edge in fitting edge group
Point is fitted, and obtains being fitted edge accordingly;When the distance at the marginal point in candidate edge group to corresponding fitting edge is greater than
When defect threshold distance, determine that the marginal point in the candidate edge group is the Defect Edge point of respective edges.The edge defect
Detection method can be to a plurality of edge of detection target, while carrying out edge positioning and defects detection, effectively increases edge and lacks
Fall into detection efficiency.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
It can the limitation present invention.
Specific embodiment
Technical solution in order to enable those skilled in the art to better understand the present invention, below in conjunction with of the invention real
The attached drawing in example is applied, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described implementation
Example is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, this field is common
Technical staff's every other embodiment obtained without making creative work, all should belong to protection of the present invention
Range.
The embodiment of the present invention provides a kind of multiple edge defect inspection method, first to the multiple edge defect of the embodiment of the present invention
Detection method is illustrated, referring to Fig. 1, for a kind of process signal of multiple edge defect inspection method provided in an embodiment of the present invention
Figure, this method comprises:
Step S101: from detection target image, the marginal point of the detection target is obtained, wherein the detection target
Image includes a plurality of edge.
When carrying out defects detection in the edge to detection target, the detection target may include a plurality of edge.Mobile phone
Side generally include 2 edges in top edge and lower edge, need to detect top edge and lower edge with the presence or absence of convex epirelief or dent
Defect;Liquid crystal display generally includes inside casing and outline border, therefore on length or width direction, corresponding two edges of inside casing, outside
Frame corresponds to two edges, that is, needs to detect 4 edges with the presence or absence of defect.In the detection process, capture apparatus obtains detection mesh
Image;Such as capture apparatus can shoot the side of mobile phone, obtain include 2 edges in top edge and lower edge detection target
Image;Capture apparatus can shoot entire liquid crystal display, obtain include 4 edges detection target image.
Moreover, detection target further includes different types of edge, such as linear edge or arc edge etc..The top of mobile phone
Edge and lower edge, it can be understood as linear edge;Bolt washer is a kind of circular ring structure, including two edges of inner ring and outer rings,
The inner annular edge and outer ring edge can be understood as arc edge.
In detection target image, since edge usually corresponds to biggish gray scale difference, by detection target image
Carrying out gray analysis can determine multiple edges in the detection target image, and then by any on edge as the edge
Marginal point.In the specific implementation, the detection target image may include black white image or color image;By to black white image
Gray analysis, determine detection target marginal point;For color image, the color image can be converted into grayscale image,
Gray analysis is carried out again, so that it is determined that the marginal point of detection target.Moreover, in the detection process, detection ambient lighting, shooting are set
Standby hardware parameter setting and testing product are uneven, so that may include void from the marginal point that detection target image extracts
False marginal point, that is, the number of edge points actually obtained are greater than the actual edge number of detection target.
It referring to fig. 2, is a kind of flow diagram of marginal point acquisition methods provided in an embodiment of the present invention, this method includes
Following steps:
Step S1011: determine that any one edge in detection target image is reference edge.
Target image is being detected referring to Fig. 3 for a kind of schematic diagram for detecting target image provided in an embodiment of the present invention
In, detection target 110 includes edge 111 and edge 112, and the edge 111 and edge 112 are linear edge, can be with
Select wherein any one edge as the reference edge.Such as it regard edge 111 as reference edge, or by edge 112
As reference edge.
It equally, can be corresponding by the corresponding edge of inner ring or outer ring when the edge for detecting target is radiused edges
Edge is as reference edge.
Step S1012: along the reference edge, it will test target image and be divided into multiple sample projection regions, wherein institute
Sample projection region is stated perpendicular to the extending direction of the reference edge.
According to step S1011's as a result, the embodiment of the present invention using edge 111 as reference edge, to sample projection region
Partition process be described in detail.
See also Fig. 3, extending direction along reference edge, that is, edge 111 will test target image and be divided into multiple adopt
Sample view field 113.Wherein, in embodiments of the present invention, the sample projection region 113 is affine rectangle;The sampling is thrown
The central axes in shadow zone domain 113 perpendicular to edge 111, and multiple sample projection regions 113 with same intervals, be uniformly distributed.When
So in the specific implementation, the sample projection region 113 can also be other affine shapes such as circle, ellipse;Moreover, described adopt
Sample view field 113 also need not be perpendicular to the extending direction at edge 111, such as the central axes in the sample projection region can be with
Edge 111 is at an acute angle etc..
For arc edge, reference edge be also it is arc-shaped, multiple samplings can be divided along the circular arc of the reference edge
View field.
Step S1013: from the sample projection region, the marginal point of the detection target is extracted.
Referring to fig. 4, the partial enlargement diagram in a kind of Projection Sampling region provided for present example, in each sampling
In view field, according to gray scale difference value, it can determine multiple marginal points.In embodiments of the present invention, in a sample projection area
4 marginal points, i.e. marginal point 1, marginal point 2, marginal point 3 and marginal point 4 have been determined in domain 113;In this 4 marginal points,
There are the marginal points of the marginal point of actual edge and false edge point.It equally, can be in phase for other sample projection regions
In the sample projection region answered, extraction obtains corresponding multiple marginal points.
Multiple sample projection regions are divided by will test target image, and extract the side in the sample projection region
Marginal point of the edge point as detection target, a large amount of marginal point can more accurately describe the practical shape at the detection each edge of target
Condition, to improve the precision of edge defect detection.
Step S102: by the group of edge points on each edge at reference edge group.
By the group of edge points on each edge at reference edge group, wherein the number of marginal point in the reference edge group
It is equal with the detection actual edge number of target.In order to detect the defect of mobile phone side, detection target has 2 actual edges,
Then 4 marginal point combination of two as shown in Figure 4 are formed 6 references including 2 marginal points by each reference edge group
Edge group.Specifically, reference edge edge group includes the first reference edge group (marginal point 1, marginal point 2), the second reference edge
Edge group (marginal point 1, marginal point 3), third reference edge group (marginal point 1, marginal point 4), the 4th reference edge group (marginal point 2,
Marginal point 3), the 5th reference edge group (marginal point 2, marginal point 4), the 6th reference edge group (marginal point 3, marginal point 4).
When detection target has 3 actual edges, then each reference edge group includes 3 marginal points, will be as described in Figure 4
Any three group of edge points are at the reference edge group in 4 marginal points.Specifically, the reference edge group includes the first reference
Edge group (marginal point 1, marginal point 2, marginal point 3), the second reference edge group (marginal point 1, marginal point 2, marginal point 4), third
Reference edge group (marginal point 1, marginal point 3, marginal point 4).
Moreover, when forming the reference edge group, it is suitable with the corresponding marginal point of permanent order tissue, such as the fixation
It can be sequence etc. from top to bottom or from inside to outside.Then in above-mentioned reference edge group, a reference edge is certainly existed
Group guarantees that marginal point therein is corresponding in turn to the actual edge of detection target.
In order to improve the formation efficiency of reference edge group, the embodiment of the present invention also provides a kind of generation side of reference edge group
Method, method includes the following steps:
Step S1021: the position range of each actual edge in detection target image is determined.
When detecting target has linear edge, such as detection target is mobile phone, carries out defects detection to the side of mobile phone.
In the detection target image of acquisition, actual edge, that is, top edge of mobile phone and lower edge have fixed position, it is contemplated that inspection
Error during survey can determine top edge and the corresponding position range of lower edge.For example, establishing corresponding detection mesh
Logo image coordinate system, the actual edge of mobile phone are parallel to X-axis setting, then the variation range of corresponding Y direction, that is, reality
The position range at edge.
When detecting target has arc edge, such as detection target is bolt washer, is carried out to the edge of bolt washer
Defects detection.In the detection target image of acquisition, the actual edge, that is, inner annular edge and outer ring edge of bolt washer have solid
Fixed position, it also is contemplated that the error into detection process can determine inner annular edge and the corresponding position of outer annular edge edge
Range.For example, detection target image coordinate system is established, to detect the center of circle of the corresponding arc edge of target as origin, inner ring
The position range at edge or outer ring edge corresponds to corresponding annulus range.
Step S1022: by the group of edge points within the scope of different location at reference edge group.
2 actual edges are determined according to step S1021 when detecting target has 2 actual edges see also Fig. 4
Corresponding position range determines that marginal point 1 and marginal point 2 belong to the corresponding position range of first actual edge, edge
Point 3 belongs to the corresponding position range of Article 2 actual edge with marginal point 4, then by the group of edge points within the scope of different location at ginseng
Examine edge group.Specifically, the reference edge group be (marginal point 1, marginal point 3), (marginal point 1, marginal point 4), (marginal point 2,
Marginal point 3) and (marginal point 2, marginal point 4).
When detecting target has 3 actual edges, marginal point 1 belongs to the position range of first actual edge, edge
Point 2 belongs to the position range of Article 2 actual edge, and marginal point 3 and marginal point 4 belong to the position range of Article 3 actual edge,
The reference edge group then formed is (marginal point 1, marginal point 2, marginal point 3) and (marginal point 1, marginal point 2, marginal point 4).
By the way that the group of edge points of different location range at reference edge group, can be effectively improved the generation of reference edge group
Efficiency, and by the screening of the position range, false edge point can be effectively rejected, is equally beneficial for improving edge detection
Efficiency.
Step S103: scoring to the reference edge group, determines that the high reference edge group that scores is fitting edge group
With candidate edge group.
In order to be screened to reference edge group, in the embodiment of the present invention, to each reference edge determined in step S102
Edge group is scored by " to size " interpretational criteria.It is a kind of reference edge group provided in an embodiment of the present invention referring to Fig. 5
The flow diagram of methods of marking, method includes the following steps:
Step S1031: marginal dimension threshold value is determined.
Since the position in different sample projection regions or the axis in sample projection region and the angle of actual edge are different
When, different marginal dimension threshold values may be corresponded to, therefore, in the specific implementation, it is thus necessary to determine that corresponding marginal dimension threshold value.
Under the first performance, the actual edge for detecting target is linear edge, the linear edge is parallel to each other,
And adjacent linear edge has constant spacing.If the axis in sample projection region, can be with perpendicular to the linear edge
The marginal dimension threshold value that the constant spacing of adjacent linear edge is used as.For example, if detection target has 3 edges, then will
2 conduct of space D between space D 1 and Article 2 edge and Article 3 edge between one edge and Article 2 edge
The marginal dimension threshold value.If the axis in sample projection region and the linear edge out of plumb, such as at an angle, then
Corresponding marginal dimension threshold value can be obtained with the conversion of the angle according to the constant spacing;If equally detection target tool
Have 3 edges, can according to the angle of the axis in sample projection region and the linear edge, calculate to make a call to one edge and
The corresponding marginal dimension threshold value in the corresponding marginal dimension threshold value D1 ' in Article 2 edge and Article 2 edge and Article 3 edge
D2 ', by D1 ' and D2 ' is used as the marginal dimension threshold value.
Under second of performance, the actual edge for detecting target is linear edge, but the linear edge is not parallel.
According to the reference edge that step S101 is determined, if the axis in sample projection region is perpendicular to reference edge, adjacent straight line
Spacing between the edge regular variation according to the overlapping positions of view field and the reference edge, optionally, according to adopting
The overlapping positions of sample view field and the reference edge determine the marginal dimension threshold value.If the axis in sample projection region
It is not orthogonal to reference edge, then is thrown according to the angle and the sampling of the axis in sample projection region and the reference edge
The overlapping positions in shadow zone domain and the reference edge calculate and determine the marginal dimension threshold value.
Under the third performance, the actual edge for detecting target is arc edge, and the arc edge is concentric circles.
If the axis in sample projection region is perpendicular to the normal direction of a wherein arc edge, by the radius at adjacent circular arc edge
Difference is used as the marginal dimension threshold value.If the axis in sample projection region is not orthogonal to the normal side of a wherein arc edge
To, then according to the semidiameter at adjacent circular arc edge and the angle of the axis in sample projection region and arc edge normal direction,
Conversion obtains the marginal dimension threshold value.
Under the 4th kind of performance, the actual edge for detecting target is arc edge, and the arc edge is off-centre operation,
That is the spacing at adjacent circular arc edge is unequal.According to the reference edge that step S101 is determined, when the axis in sample projection region hangs down
It directly when the normal of reference edge, is converted according to geometry, sample projection region and reference edge difference overlapping positions can be calculated
Corresponding marginal dimension threshold value.Equally, when the axis in sample projection region is not orthogonal to the normal of reference edge, according to adopting
The angle of the normal of the axis and reference edge of sample view field is converted available corresponding marginal dimension threshold by geometry
Value.
Step S1032: the reference distance between the neighboring edge point in reference edge group is calculated.
According to step 102 determine reference edge group, when detect target have 2 actual edges when, calculate marginal point 1 with
Reference distance of the distance between the marginal point 2 as the first reference edge group;Calculate the distance between marginal point 1 and marginal point 3
Reference distance as the second reference edge group;It calculates the distance between marginal point 1 and marginal point 3 and is used as third reference edge group
Reference distance;Calculate the reference distance of the distance between marginal point 2 and marginal point 3 as the 4th reference edge group;Calculate side
The reference distance of the distance between edge point 2 and marginal point 4 as the 5th reference edge group;It calculates between marginal point 3 and marginal point 4
Reference distance of the distance as the 6th reference edge group.
When detecting target has 3 actual edges, the distance between marginal point 1 and marginal point 2 and marginal point are calculated
The distance between 2 and marginal point 3, the reference distance as the first reference edge group;It calculates between marginal point 1 and marginal point 2
Distance and the distance between marginal point 2 and marginal point 4, the reference distance as the second reference edge group;Calculate marginal point 1
The distance between marginal point 3 and the distance between marginal point 3 and marginal point 4, as third reference edge group reference away from
From.
Step S1033: according to the difference of the reference distance and the marginal dimension threshold value, the reference edge group is calculated
Scoring.
In the specific implementation, the mathematical conversion relationship that can establish the scoring of the difference and reference edge group, thus really
The scoring of fixed each reference edge group.For example, when detecting target has 2 actual edges, the reference of the first reference edge group
The scoring of the first reference edge group is calculated by the difference multiplied by proportionality coefficient in the difference of distance and marginal dimension threshold value
It is 70;Correspondingly, the scoring for obtaining the second reference edge group is 80, third reference edge group by same calculation
It is the scoring of the 75, the 5th reference edge group is 60 and the 6th reference edge group that scoring, which is the scoring of the 90, the 4th reference edge group,
Frequency division be 50.
Equally, when detecting target has 3 actual edges, each reference edge group has 2 reference distances, accordingly
The marginal dimension threshold value also has 2 marginal dimension threshold values, since the marginal point in reference edge group is arranged in a fixed order
Sequence, then the reference distance also carries out difference calculating with corresponding marginal dimension threshold value.Specifically, the edge in reference edge group
Point arranges in accordance with the order from top to bottom, i.e., corresponding first actual edge, the second actual edge and third actual edge it is suitable
It is real to the reference distance of marginal point 2 and the first actual edge and second to calculate marginal point 1 then for the first reference edge group for sequence
The difference of the corresponding marginal dimension threshold value in border edge, and calculate reference distance and second practical side of the marginal point 2 to marginal point 3
The difference of edge marginal dimension threshold value corresponding with third actual edge is referred to according to the mean value calculation first of above-mentioned 2 differences
The scoring of edge group.Calculate the reference edge in the same way for the second reference edge group and third reference edge group
The scoring of group.
It should be noted that in embodiments of the present invention without limitation to above-mentioned mathematics transformational relation, and the reference
The scoring of edge group is also not limited to hundred-mark system, such as can also be 5 points of systems, ten point systems etc.;And above-mentioned reference distance can also
Think the distance between any two marginal point in reference edge group, above-mentioned marginal dimension threshold value may be any two reality
The marginal dimension threshold value that edge determines need to only guarantee the position of the sequence and actual edge of edge point position corresponding to reference distance
Sequence consensus, i.e., the reference that the marginal point of first position and the marginal point of the third place determine in reference edge group away from
From the marginal dimension threshold value determined with first actual edge and Article 3 actual edge carries out difference calculating.
In addition, referring to Fig. 6, being in embodiments of the present invention to improve the flexibility and precision of the scoring of reference edge group
The flow diagram of another kind reference edge group methods of marking provided in an embodiment of the present invention, this method method shown in Fig. 5
On the basis of show a kind of calculation method of reference edge group scoring, comprising:
Step S1034: according to the complexity of detection object edge, multiple difference ranges corresponding with scoring are preset.
In the specific implementation, for same detection target, on different zones position, the actual edge of the detection target
Complexity may be different, such as lean in some region actual edges it is close, and in some region actual edge wide aparts;
Alternatively, having done some wire drawing process near some region actual edges, it is possible to create more complex texture causes to interfere, and
Other region actual edges are relatively smooth.In embodiments of the present invention, lean on close of actual edge or due to making work
The corresponding complexity in region that skill etc. introduces more interference is higher.
In the detection higher region of object edge complexity, the difference model of multiple smaller spacing corresponding with scoring is set
It encloses.For example, the difference range, difference range [- 0.05,0.05] is arranged with 0.1 spacing, corresponding scoring is 100;Difference
Range [- 0.1, -0.05), (0.05,0.1], corresponding scoring is 90 etc..
In the detection lower region of object edge complexity, the difference model of multiple larger spacing corresponding with scoring row is set
It encloses.For example, the difference range, difference range [- 0.1,0.1] is arranged with 0.2 spacing, corresponding scoring is 100;Difference model
Enclose [- 0.2, -0.1), (0.1,0.2], corresponding scoring is 90 etc..
Certainly, in the specific implementation, in same detection object edge region, the spacing of the difference range also needs not be flat
It is respectively provided with, such as the spacing of 100 corresponding difference ranges of scoring is 0.1, the spacing of 90 corresponding difference ranges of scoring can be
0.2 etc..
Step S1035: when the difference belongs to the difference range, the corresponding scoring conduct of the difference range is determined
The scoring of the reference edge group.
When the difference of reference distance and respective edges size threshold, when belonging to corresponding difference range, by the difference model
Enclose scoring of the corresponding scoring as the reference edge group.Specifically, for the detection target including 2 actual edges, such as
Fruit corresponds to sample projection region and is located at the detection higher region of object edge complexity, then according to the first reference edge group to the 6th
Difference range belonging to the corresponding difference of reference edge group determines the scoring of each reference edge group.Such as first ginseng
The difference for examining edge group belongs to the range of [- 0.1, -0.05), (0.05,0.1], then the scoring of the first reference edge group is 90, the
The difference of two reference edge groups belongs to [0.05,0.05], then the scoring of the second reference edge group is 100 etc..
For the detection target of 3 actual edges, if corresponding sample projection region is located at detection object edge complexity
Lower region, then the difference model according to belonging to the first reference edge group to third reference edge group corresponding difference
It encloses, determines the scoring of each reference edge group.Such as first the difference of reference edge group belong to [- 0.1,0.1], then the first reference
The scoring of edge group is 100, and the difference of the second reference edge group belongs to [- 0.2, -0.1), (0.1,0.2], then the second reference edge
The scoring of edge group is 90 etc..
Further, in order to accurately score each reference edge group, other interpretational criterias can also be used, such as
" one edge " standard comments criterion, " most strong edge " interpretational criteria.
Wherein, described " one edge " interpretational criteria are as follows: according to reference edge point each in reference edge group close to phase
The degree for answering edge determines the scoring of the reference edge group.Specifically, when detecting target has 2 edges, in the first ginseng
It examines in edge group, marginal point 1 is closer to the top edge of detection target, then the scoring of marginal point 1 is higher, and marginal point 2 is closer to inspection
The lower edge of target is surveyed, then the scoring of marginal point 2 is higher, the average value that marginal point 1 and marginal point 2 are scored, as the first ginseng
Examine the scoring of edge group;In the same way, the scoring of the second reference edge group to the 6th reference edge group is calculated.When detection mesh
When mark has 3 edges, in the first reference edge group, marginal point 1 is closer to the top edge of detection target, then marginal point 1
It scores higher, marginal point 3 is closer to the lower edge of detection target, then the scoring of marginal point 3 is higher, and marginal point 2 is closer to detection
The middle line of target, then the scoring of marginal point 2 is higher, using the average value of the scoring of marginal point 1, marginal point 2 and marginal point 3 as
The scoring of one reference edge group;In the same way, the scoring of the second reference edge group to third reference edge group is calculated.
" most strong edge " interpretational criteria are as follows: according to the contrast of reference edge point, determine the scoring of reference edge group,
The contrast of reference edge point is higher, and corresponding scoring is higher.Specifically, when detecting target has 2 edges, in the first ginseng
It examines in edge group, according to the contrast of marginal point 1, determines the scoring of marginal point 1, according to the contrast of marginal point 2, determine edge
The scoring of point 2, the average value that marginal point 1 and marginal point 2 are scored is as the scoring of the first reference edge group;With same side
Formula calculates the scoring of the second reference edge group to the 6th reference edge group.When detecting target has 3 edges, in the first ginseng
It examines in edge group, according to the contrast of marginal point 1, calculates the scoring of marginal point 1, according to marginal point 2 to comparison, calculate edge
The scoring of point 2 calculates the scoring of marginal point 3, by the scoring of marginal point 1, the scoring of marginal point 2 according to the contrast of marginal point 3
And scoring of the average value of the scoring of marginal point 3 as the first reference edge group;In the same way, the second reference edge is calculated
Edge group to third reference edge group scoring.
It should be noted that in the specific implementation, it can be quasi- using any one above-mentioned interpretational criteria, any two evaluation
The mode that combination or three interpretational criterias then uses simultaneously, scores to reference edge group.When while using above-mentioned two
When a interpretational criteria, commenting for each reference edge group can be calculated by the mathematical computations mode such as arithmetic average or weighted average
Point.
By above description, score each reference edge group in all sample projection regions, each
In the corresponding reference edge group of view field, determine the highest reference edge group that scores as fitting edge group and candidate edge
Group.Such as when detecting target includes 2 actual edges, corresponding 6 reference edge groups, pass through in a sample projection region
Scoring, the scoring highest of the first reference edge group, then using the first reference edge group as fitting edge group and candidate edge group;With
Same mode determines the corresponding highest reference edge group of scoring in each sample projection region as corresponding fitting edge group
With candidate edge group.
Step S104: the marginal point in the fitting edge group is fitted, obtains being fitted edge accordingly.
Each sample projection region corresponding determine has corresponding fitting edge group, by identical bits in each fitting edge group
The marginal point set is fitted to corresponding fitting edge.
When detecting target includes 2 actual edges, the fitting edge group includes 2 marginal points;By each fitting side
The marginal point of first position in edge group, fitting obtain the first fitting edge;By the edge of the second position in each fitting edge group
Point, fitting obtain the second fitting edge.
When detecting target includes 3 actual edges, the fitting edge group includes 3 marginal points;By each fitting side
The marginal point of first position in edge group, fitting obtain the first fitting edge;By the edge of the second position in each fitting edge group
Point, fitting obtain the second fitting edge;By the marginal point of the third place in each fitting edge group, fitting obtains third fitting side
Edge.
Equally, available equal with actual edge number a plurality of for having a detection target at any a plurality of edge
It is fitted edge.
After obtaining being fitted edge accordingly, more accurately fitting edge, raising edge defect detection are smart in order to obtain
Degree, optionally, further comprising the steps of:
Step S201: when the distance at the marginal point in fitting edge group to corresponding fitting edge is greater than outlier threshold distance
When, corresponding marginal point is rejected, fitting updates corresponding fitting edge again.
For including the detection target of 2 actual edges, after obtaining the first fitting edge and the second fitting edge,
In digital simulation edge group the marginal point of first position to first fitting edge distance, if the distance greater than outlier threshold away from
From, then the marginal point of first position in the fitting edge group is rejected, if the distance is less than or equal to outlier threshold distance,
Any operation is not done then;In digital simulation edge group the marginal point of the second position to the second fitting edge distance, if should be away from
From be greater than outlier threshold with a distance from, then by it is described fitting edge group in the second position marginal point reject, if the distance be less than or
Equal to outlier threshold distance, then any operation is not done.
After carrying out above-mentioned processing to the fitting edge group in each sample projection region, edge group first is fitted so that treated
The marginal point of position reappears fitting, updates the first fitting edge, the marginal point weight of the edge group second position is fitted so that treated
New fitting updates the second fitting edge.
Step S202: it in each sample projection region, is accordingly fitted according to marginal point in reference edge group to after updating
The distance at edge scores again to reference edge group, and the reference edge group for scoring high is updated to candidate edge group and is intended
Close edge group.
Equally for including the detection target of 2 actual edges, in each sample projection region, each reference edge
Group includes 2 marginal points, the marginal point distance first of first position is fitted that Edge Distance is closer, then the marginal point of first position
It scores higher;The fitting Edge Distance of second position marginal point distance second is closer, then the scoring of the marginal point of the second position is higher;
The scoring of first position marginal point and the scoring of second position marginal point are averaged, it is right as the scoring of reference edge group
All reference edge groups are scored again.The reference edge group for scoring high is updated to candidate edge group and fitting edge
Group.
It should be noted that in the specific implementation, above-mentioned steps S104, step S201 and step S202 can be carried out
Successive ignition, to obtain the fitting edge for being best suitable for actual edge, to optimize edge defect detection accuracy.
Step S105: when the distance at the marginal point in candidate edge group to corresponding fitting edge is greater than defect threshold distance
When, determine that the marginal point in the candidate edge group is the Defect Edge point of respective edges.
For the detection target including 2 actual edges, the marginal point of first position in candidate edge group is calculated to first
It is fitted the distance at edge, if the distance is greater than defect threshold distance, it is determined that first position in the candidate edge group
Marginal point be first actual edge (such as top edge) edge defect point, if the distance less than or equal to defect threshold value away from
From the marginal point of the first position in the candidate edge group is normal marginal point;Calculate the second position in candidate edge group
The distance that marginal point is fitted edge to second, if the distance is greater than defect threshold distance, it is determined that in the candidate edge group
The marginal point of the second position is the edge defect point of Article 2 actual edge (such as lower edge), if the distance is less than or equal to
Defect threshold distance, then the marginal point of the second position in the candidate edge group is normal marginal point.
Equally, when detecting target has 3 or 3 or more actual edges, in the manner described above, it can determine that each item is real
The Defect Edge point at border edge.Then, Defect Edge point is merged, the flaw size and area of respective edges can be calculated
Deng quantifying to defect, it is for statistical analysis to edge defect to be convenient for technical staff.
By above-described embodiment description as it can be seen that multiple edge defect inspection method provided in an embodiment of the present invention, by from detection
In target image, the marginal point of the detection target is obtained, the detection target image includes a plurality of edge;It will be on each edge
Group of edge points at reference edge group;It scores the reference edge group, determines that the high reference edge group that scores is fitting
Edge group and candidate edge group;Marginal point in fitting edge group is fitted, obtains being fitted edge accordingly;When candidate side
When the distance at marginal point to corresponding fitting edge in edge group is greater than defect threshold distance, the side in the candidate edge group is determined
Edge point is the Defect Edge point of respective edges.The edge defect detection algorithm can to detection target a plurality of edge, while into
The positioning of row edge and defects detection, effectively increase edge defect detection efficiency.
By the description of above embodiment of the method, it is apparent to those skilled in the art that the present invention can
Realize by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases the former
It is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially makes tribute to the prior art in other words
The part offered can be embodied in the form of software products, which is stored in a storage medium, packet
Some instructions are included to use so that a computer equipment (can be personal computer, server or the network equipment etc.) executes
All or part of the steps of the method according to each embodiment of the present invention.And storage medium above-mentioned includes: read-only memory
(ROM), the various media that can store program code such as random access memory (RAM), magnetic or disk.
Corresponding with multiple edge defect inspection method embodiment provided by the invention, the present invention also provides a kind of multiple edges
Defect detecting device.
It is a kind of structural schematic diagram of multiple edge defect detecting device provided in an embodiment of the present invention, the device referring to Fig. 7
Include:
Marginal point obtains module 11, for from detection target image, obtaining the marginal point of the detection target, wherein
The detection target image includes a plurality of edge;
Reference edge group generation module 12, for by the group of edge points on each edge at reference edge group;
Reference edge group grading module 13 determines the high reference edge that scores for scoring the reference edge group
Edge group is fitting edge group and candidate edge group;
Edge group fitting module 14 obtains being fitted side accordingly for being fitted the marginal point in fitting edge group
Edge;
Edge defect determining module 15, for the marginal point in the candidate edge group to being fitted intramarginal distance accordingly
When greater than defect threshold distance, determine that the marginal point of the candidate edge group is the Defect Edge point of respective edges.
In order to be screened to reference edge group, in the embodiment of the present invention, determined in reference edge group generation module 12
Each reference edge group, scored by " to size " interpretational criteria, be provided in an embodiment of the present invention one referring to Fig. 8
The structural schematic diagram of kind reference edge group grading module, the reference edge group grading module 13 include:
Marginal dimension threshold determination module 131, for determining marginal dimension threshold value;Moreover, in the specific implementation, the side
Edge size threshold determining module 131 can also be determined according to the overlapping positions in the sample projection region and the reference edge
The marginal dimension threshold value;
Reference distance computing module 132, for calculating the reference distance between each marginal point in reference edge group;
Reference edge group scoring computing module 133, for the difference according to the reference distance and the size threshold, meter
Calculate the scoring of the reference edge group.
It is provided in an embodiment of the present invention another referring to Fig. 9 to improve the flexibility and precision of the scoring of reference edge group
The structural schematic diagram of kind reference edge group grading module, the reference edge group grading module 13 can also include:
Difference range presetting module 134 is preset corresponding more with scoring for the complexity according to detection object edge
A difference range;
Reference edge group scoring determining module 135, for determining the difference when the difference belongs to the difference range
It is worth scoring of the corresponding scoring of range as the reference edge group.
In order to more accurately describe the actual state at the detection each edge of target, to improve the essence of edge defect detection
Degree, referring to Figure 10, for a kind of structural schematic diagram of marginal point acquisition module provided in an embodiment of the present invention, the marginal point is obtained
Module 11 includes:
Reference edge determining module 111, for determining that any one edge in detection target image is reference edge;
Sample projection region division module 112, for will test target image and be divided into multiple adopt along the reference edge
Sample view field, wherein extending direction of the sample projection region perpendicular to the reference edge;
Edge point extraction module 113, for from the sample projection region, extracting the marginal point of the detection target.
Moreover, referring to Figure 11, being a seed ginseng provided in an embodiment of the present invention to improve the formation efficiency of reference edge group
The structural schematic diagram of edge group generation module is examined, the reference edge group generation module 12 includes:
Position range determining module 121, for determining the position range of each actual edge in detection target image;
Reference edge group molded tissue block 122, for by the group of edge points within the scope of different location at reference edge group.
More accurately fitting edge, a kind of multiple edge defect detecting device provided in an embodiment of the present invention also wrap in order to obtain
Include fitting edge update module 21 and reference edge group grading module 22 again, in which:
Fitting edge update module 21, for when the marginal point in fitting edge group to the distance at corresponding fitting edge
Greater than outlier threshold apart from when, corresponding marginal point is rejected, fitting updates corresponding fitting edge again;
Reference edge group grading module 22 again, in each sample projection region, according to reference edge group
Middle marginal point is accordingly fitted the distance at edge to after updating, and is scored again reference edge group, by the high reference edge that scores
Edge group is updated to candidate edge group and fitting edge group.
As seen from the above-described embodiment, multiple edge defect detecting device provided in an embodiment of the present invention, by from detection target
In image, the marginal point of the detection target is obtained, the detection target image includes a plurality of edge;By the side on each edge
Edge point forms reference edge group;It scores the reference edge group, determines that the high reference edge group that scores is fitting edge
Group and candidate edge group;Marginal point in fitting edge group is fitted, obtains being fitted edge accordingly;When candidate edge group
In the distance at marginal point to corresponding fitting edge when being greater than defect threshold distance, determine the marginal point in the candidate edge group
For the Defect Edge point of respective edges.The edge defect detection algorithm can be to a plurality of edge of detection target, while carrying out side
Edge positioning and defects detection, effectively increase edge defect detection efficiency.
It should be noted that, in this document, the relational terms of such as " first " and " second " or the like are used merely to one
A entity or operation with another entity or operate distinguish, without necessarily requiring or implying these entities or operation it
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant are intended to
Cover non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or setting
Standby intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in the process, method, article or apparatus that includes the element.
The above is only a specific embodiment of the invention, is made skilled artisans appreciate that or realizing this hair
It is bright.Various modifications to these embodiments will be apparent to one skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention
It is not intended to be limited to the embodiments shown herein, and is to fit to the principle and features of novelty phase one invented with this paper
The widest scope of cause.