Summary of the invention
This application provides a kind of detection method and device of drop circular hole quality, to solve existing drop circular hole quality
Detection method, the low problem of Detection accuracy.
In a first aspect, this application provides a kind of detection methods of drop circular hole quality, this method comprises:
The gray value of unit image is obtained, the gray value of the unit image includes outside prospect hole in sum of the grayscale values background hole
Gray value;
If the gray value of the unit image changes, the center of circle and the radius of drop circular hole are sought;
According to the center of circle of the drop circular hole and radius, unit ideal image is generated;
According to the unit ideal image and the unit image, defect point area and defect point contrast are calculated;
If the defect point area and the defect point contrast are greater than preset value, instruction is scrapped in sending.
Optionally, the center of circle and the radius of drop circular hole are sought as steps described below:
Unit image described in binaryzation, to obtain binary image;
Closed operation processing is carried out to the binary image, to obtain filling image;
Contour extraction processing is carried out to the filling image, to obtain contour images;
The marginal point for obtaining the contour images is fitted circle according to the marginal point, to obtain the first fitting circle;
The center of circle for obtaining first fitting circle, according to the center of circle of first fitting circle, label and first fitting
Marginal point of the round circle center distance in distance threshold is quadratic fit point;
It is fitted circle according to quadratic fit point, to obtain the second fitting circle;
Determine the center of circle and radius of the center of circle and the radius of second fitting circle for drop circular hole.
Optionally, the detection method further include:
Obtain the circular hole center of circle of template image;
Calculate the range difference in the center of circle of the drop circular hole and the circular hole center of circle of the template image;
If the range difference is less than or equal to pre-determined distance threshold value, unit ideal image is generated.
Optionally, the detection method further include:
Obtain the circle hole radius of template image;
Calculate the length difference of the radius of the drop circular hole and the circle hole radius of the template image;
If the length difference is less than or equal to pre-set length threshold, unit ideal image is generated.
Optionally, unit ideal image is generated according to following step:
According to the gray value of the unit image, dividing the unit image is to have intermediate zone semicircle orifice, without intermediate zone half
Circular hole has intermediate zone half bore periphery and without intermediate zone half bore periphery;
It is described to have in intermediate zone semicircle orifice, it determines in the range for being greater than first threshold with the circle center distance of the drop circular hole
It is interior, and it is the first ideal zone that gray value, which is greater than the region of gray value in the background hole,;
It is described to have in intermediate zone semicircle orifice, it determines and is being less than or equal to first threshold with the circle center distance of the drop circular hole
In the range of, and it is secondary ideal region that gray value, which is equal to the region of gray value in the background hole,;
In the no intermediate zone semicircle orifice, determine in the range for being greater than first threshold with the circle center distance of the drop circular hole
It is interior, and it is third ideal zone that gray value, which is greater than the region of gray value in the background hole,;
In the no intermediate zone semicircle orifice, determines and be less than or equal to first threshold with the circle center distance of the drop circular hole
In the range of, and it is the 4th ideal zone that gray value, which is equal to the region of gray value in the background hole,;
It is described to have in intermediate zone half bore periphery, it determines and is being less than or equal to the second threshold with the circle center distance of the drop circular hole
In the range of value, and it is the 5th ideal zone that gray value, which is less than the region of gray value outside the prospect hole,;
It is described to have in intermediate zone half bore periphery, it determines in the model for being greater than second threshold with the circle center distance of the drop circular hole
In enclosing, and it is the 6th ideal zone that gray value, which is equal to the region of gray value outside the prospect hole,;
In the no intermediate zone half bore periphery, determines and be less than or equal to the second threshold with the circle center distance of the drop circular hole
In the range of value, and it is the 7th ideal zone that gray value, which is less than the region of gray value outside the prospect hole,;
In the no intermediate zone half bore periphery, determine in the model for being greater than second threshold with the circle center distance of the drop circular hole
In enclosing, and it is the 8th ideal zone that gray value, which is equal to the region of gray value outside the prospect hole,;
Obtain first ideal zone, the secondary ideal region, the third ideal zone, the 4th ideal area
Domain, the 5th ideal zone, the 6th ideal zone, the 7th ideal zone and the 8th ideal zone figure
Picture, and it is integrated into unit ideal image.
Second aspect, this application provides a kind of detection device of drop circular hole quality, which includes:
Gray value acquiring unit, for obtaining the gray value of unit image, the gray value of the unit image includes prospect
Gray value in sum of the grayscale values background hole outside hole;
Unit is sought, if the gray value for the unit image changes, seeks the center of circle and half of drop circular hole
Diameter;
Image generation unit, for according to the drop circular hole the center of circle and radius, generate unit ideal image;
Defect point computing unit, for calculating defect point area according to the unit ideal image and the unit image
With defect point contrast;
Instruction issue unit is scrapped, if being greater than preset value for the defect point area and the defect point contrast,
It then issues and scraps instruction.
Optionally, further include that the center of circle and the radius of drop circular hole and are sought with lower unit as steps described below:
Binarization unit, for unit image described in binaryzation, to obtain binary image;
Closed operation unit, for carrying out closed operation processing to the binary image, to obtain filling image;
Contours extract unit, for carrying out contour extraction processing to the filling image, to obtain contour images;
Fitting unit, for obtaining the marginal point of the contour images, be fitted according to the marginal point it is round, to obtain the
One fitting circle;
Match point marking unit, for obtaining the center of circle of first fitting circle, according to the center of circle of first fitting circle,
Marginal point of the circle center distance of label and first fitting circle in distance threshold is quadratic fit point;
The fitting unit is also used to be fitted circle according to quadratic fit point, to obtain the second fitting circle;
The center of circle and radius determination unit, for determining the center of circle and the radius of second fitting circle for the center of circle of drop circular hole
And radius.
Optionally, the detection device further include:
Template circular hole center of circle acquiring unit, for obtaining the circular hole center of circle of template image;
Distance of center circle deviation computing unit, for calculating the center of circle of the drop circular hole and the circular hole center of circle of the template image
Range difference;
Described image generation unit generates unit if being less than or equal to pre-determined distance threshold value for the range difference
Ideal image.
Optionally, the detection device further include:
Template circle hole radius acquiring unit, for obtaining the circle hole radius of template image;
Radius length difference computing unit, for calculating the radius of the drop circular hole and the circle hole radius of the template image
Length difference;
Described image generation unit generates unit if being less than or equal to pre-set length threshold for the length difference
Ideal image.
Optionally, further include with lower unit, and according to following step generate unit ideal image:
Division unit, for the gray value according to the unit image, dividing the unit image is to have intermediate zone semicircle
Hole, without intermediate zone semicircle orifice, have intermediate zone half bore periphery and without intermediate zone half bore periphery;
First ideal zone determination unit has in intermediate zone semicircle orifice for described, determine with the drop circular hole
Circle center distance is greater than in the range of first threshold, and it is the first ideal area that gray value, which is greater than the region of gray value in the background hole,
Domain;
Secondary ideal area determination unit has in intermediate zone semicircle orifice for described, determine with the drop circular hole
Circle center distance is less than or equal in the range of first threshold, and it is second that gray value, which is equal to the region of gray value in the background hole,
Ideal zone;
Third ideal zone determination unit, in the no intermediate zone semicircle orifice, determine with the drop circular hole
Circle center distance is greater than in the range of first threshold, and it is third ideal area that gray value, which is greater than the region of gray value in the background hole,
Domain;
4th ideal zone determination unit, in the no intermediate zone semicircle orifice, determine with the drop circular hole
Circle center distance is less than or equal in the range of first threshold, and it is the 4th that gray value, which is equal to the region of gray value in the background hole,
Ideal zone;
5th ideal zone determination unit has in intermediate zone half bore periphery for described, determine with the drop circular hole
Circle center distance be less than or equal in the range of second threshold, and it is that gray value, which is less than the region of the outer gray value in the prospect hole,
Five ideal zones;
6th ideal zone determination unit has in intermediate zone half bore periphery for described, determine with the drop circular hole
Circle center distance be greater than in the range of second threshold, and it is the 6th ideal that gray value, which is equal to the region of the outer gray value in the prospect hole,
Region;
7th ideal zone determination unit, in the no intermediate zone half bore periphery, determine with the drop circular hole
Circle center distance be less than or equal in the range of second threshold, and it is that gray value, which is less than the region of the outer gray value in the prospect hole,
Seven ideal zones;
8th ideal zone determination unit, in the no intermediate zone half bore periphery, determine with the drop circular hole
Circle center distance be greater than in the range of second threshold, and it is the 8th ideal that gray value, which is equal to the region of the outer gray value in the prospect hole,
Region;
Image integration unit, for obtaining first ideal zone, the secondary ideal region, the third ideal area
Domain, the 4th ideal zone, the 5th ideal zone, the 6th ideal zone, the 7th ideal zone and described
The image of 8th ideal zone, and it is integrated into unit ideal image.
By the above technology it is found that this application provides a kind of detection method and device of drop circular hole quality, unit is obtained
The gray value of image, the gray value of the unit image include gray value in sum of the grayscale values background hole outside prospect hole;Described in judgement
The gray value of unit image with the presence or absence of variation, by simple gray-value variation can quickly judge drop whether aperture at
Function.If the gray value of the unit image changes, illustrate drop aperture success, seeks the center of circle and half of drop circular hole at this time
Diameter;According to the center of circle of the drop circular hole and radius, unit ideal image is generated;According to the unit ideal image and the list
Bit image calculates defect point area and defect point contrast;If the defect point area and the defect point contrast are greater than
Preset value illustrates that drop circular hole there are biggish mass defect, be can not ignore, and issues scrap instruction at this time.The application passes through inspection
Survey the gray-value variation of drop circular hole and with the unit ideal image of the shadow-free intermediate zone of generation and the unit figure that in real time generates
The gray value of picture compares, to accurately check drop circular hole quality.
Specific embodiment
Fig. 3 is a kind of detection method flow chart of drop circular hole quality provided by the present application.
Present embodiments provide a kind of detection method of drop circular hole quality, comprising:
S100, the gray value for obtaining unit image, the gray value of the unit image include sum of the grayscale values back outside prospect hole
Gray value in scape hole.
Staff is scanned shooting to drop using photographing devices such as line-scan digital cameras first, obtains the overall diagram of drop
Picture, and the color for the drop image shot and brightness are analyzed by computer, it is especially desirable to pay attention to word on drop
The gray value for according with region, forbids in character region, and away from character region certain distance range open interior, from
And mark off permission opening area.
Drop can generate the subtle protrusion of small bending and circular, will lead to drop in drill process
Product generates certain tilt angle when horizontal positioned, with platform.And during being shot using line-scan digital camera, due to
Line-scan digital camera belongs to dynamic and shoots, and the shooting resolution ratio on transverse and longitudinal direction is different, will cause the error of imaging.It is horizontal by analysis
Longitudinal resolution ratio, does affine transformation to drop circular hole image, to obtain the high figure of the identical validity of transverse and longitudinal resolution ratio
Picture, to improve detection accuracy.
According to certain size, being divided on each drop and obtain unit area, the unit area can be entire drop,
Or the part drop comprising circular hole, the corresponding image obtained of unit area are known as unit image.For example, entire drop is in
The rectangle of 20mm × 40mm, on the symmetry axis of drop length direction, the position apart from drop one end 3mm is provided with radius and is
3mm circular hole.According to above-mentioned condition, the unit area can be entire 20mm × 40mm rectangular region, can also for
The part rectangular region of the 3mm circular hole.
Since the color of each point on unit image and brightness are different, different degrees of ash can be presented in the image shot
Color, is the entity part on drop in addition to circular hole outside prospect hole, in the circular hole hole of drop in background hole, i.e., after drop stripping
Hollow parts, in drop hole, outside hole since one be entity one is air part, the color of the two and brightness are inevitable not
Together;And prospect hole is outside upper is printed on character, and character and the color of drop blank space and brightness are inevitable different.By obtaining unit figure
The gray value of picture, the grey value profile inside and outside the circular hole for analyzing unit image that can be clear and accurate, to judge that drop is
No aperture success, and whether in the permission opening area aperture.
If the gray value of S200, the unit image change, the center of circle and the radius of drop circular hole are sought.
If there are biggish differences with gray value in background hole for gray value outside prospect hole, i.e., the contrast outside in hole and hole
Clearly, i.e. the gray value of unit image changes, and illustrates drop aperture success, needs further to detect opening for drop circular hole at this time
If position, the problems such as whether circle hole radius and stripping are qualified.If the difference of gray value and gray value in background hole outside prospect hole
Unintelligible, explanation may fail for drop aperture;It may be not thorough for stripping after aperture, the corresponding entity part of circular hole is not clear
Reason.
For example, calculating gray value and gray value in background hole outside prospect hole after the gray value of acquisition unit image
Difference, the difference is compared with preset gray scale difference value threshold value, gray scale difference value threshold value people according to the actual situation
For setting.If the difference is greater than or equal to the gray scale difference value threshold value, illustrate outside prospect hole in gray value and background hole
The resolution of gray value is sufficiently high, and the gray value of unit image changes, and change it is significant enough, drop aperture and stripping at
Function.If the difference is less than the gray scale difference value threshold value, illustrate point of gray value and gray value in background hole outside prospect hole
Degree of distinguishing is not high enough, and the gray value of unit image is unchanged, and drop aperture failure or stripping are unqualified.
Meanwhile by obtaining gray value outside prospect hole, the gray value of character on drop can be obtained, according to the gray scale of character
Gray value in value and background hole, both analyses, which whether there is, to intersect, and whether the distance of both generations gray-value variation is less than
The safe distance of preset character zone.Intersect if the gray value of gray value and character exists outside prospect hole, illustrates
Drop mistake aperture is in character zone;If the distance of gray-value variation is less than the peace of preset character zone outside prospect hole
Full distance illustrates that drop position of opening is excessively close apart from character zone, influences client's sense organ, and when in use, is easily destroyed and hangs
The character zone of board.
If drop aperture success, the center of circle and half of drop circular hole can be sought by the method for analyzing the gray value
Diameter marks off the dramatically different region of gray value, to distinguish drop and drop circular hole region, finds drop circular hole region,
It determines that the equidistant point of drop bore edges be the center of circle, is radius from the center of circle to the distance of drop bore edges.
S300, the center of circle according to the drop circular hole and radius generate unit ideal image.
When shooting drop image due to line-scan digital camera, belong to dynamic screening-mode, when circular hole is imaged, camera and it is non-perpendicular to
Lower shooting;And drop, in aperture, there is shearing protrusion in circular hole surrounding, influencing drop itself, there are fluctuations, enable drop
It can not be bonded completely with horizontal plane, so that there are certain angles.By shooting speed and shooting angle collective effect, circle after shooting is enabled
Hole image is oval, and the circular of the upper semi-circle of drop circular hole is there are the shade intermediate zone of black, and the circle of lower half circle
There is no shade intermediate zone around hole.So simple compares the unit image of whole drop with template image, due to yin
The influence of shadow intermediate zone and deformation can not accurately detect the aperture quality of drop circular hole.It needs through comparison drop circular hole and week
The gray value of shade transition band part is enclosed, to distinguish drop circular hole and shade intermediate zone, and marks off relatively accurate discharge
The drop circular hole portion of shade intermediate zone, i.e. unit ideal image.
S400, according to the unit ideal image and the unit image, calculate defect point area and defect point contrast.
The unit ideal image and unit image that are integrally formed are compared and analyzed, unit of account ideal image and unit
The error image of image carries out Blob analysis to the connected region of same pixel in error image, passes through analysis error image
Grey value profile, so that the part that unit ideal image and unit image can not be completely coincident is found, what this can not be completely coincident
Part is defect point.It is analyzed according to Blob as a result, obtaining the area and contrast of defect point.
If S500, the defect point area and the defect point contrast are greater than preset value, instruction is scrapped in sending.
According to drop area, the conditions such as character zone on drop set a preset value, as whether judging defect point
Continue available standard.In defect point area comprising shade intermediate zone area and really due to damage generate defect point face
Product, when the area of defect point is greater than preset value, the area for illustrating that unit ideal image can not be overlapped with unit image is excessive, example
Such as, when punching caused by drop bending it is excessive, to enable shade intermediate zone excessive, be reacted in result just as defect point area mistake
Greatly;Or aperture is excessive, aperture is too small;Or circular tearing it is damaged area it is excessive etc..If defect point area is excessive,
It is then issued by system control and scraps instruction, such as entity indicia is carried out to waste product drop, or directly record waste product in computer
The place station of drop perhaps produces serial number etc. and is again automatically rejected waste product drop by artificial or machine.
Fig. 4 is the flow chart of a kind of center of circle for seeking drop circular hole provided by the embodiments of the present application and radius.
Unit image described in S201, binaryzation, to obtain binary image.
In Digital Image Processing, in order to highlight the circular hole profile in unit image, need unit image carrying out two-value
Change processing, that is, entire unit image is showed into apparent black and white effect.Gray value in unit image is greater than or is waited
It is judged to belonging to certain objects in the pixel of pre-set gray threshold, it is corresponding, drop circular hole is determined as certain objects,
Gray value outside prospect hole is indicated that gray value is indicated with 0 in background hole with 255, in this way for unit image, image
Set property it is only related with the position of point that pixel value is 0 or 255, not in the multilevel values for being related to pixel, enable image procossing
Become simpler, and data processing and decrement reduce, to improve image processing efficiency.
S202, closed operation processing is carried out to the binary image, to obtain filling image.
The binary image obtained after binary conversion treatment is first expanded, then carrying out the process of corrosion treatment is binaryzation
The closed operation of image is handled.Expansion process is carried out to binary image first, is all background dots that will be contacted with certain objects
It being incorporated into the certain objects, the boundary of certain objects is enabled to expand to outside, the certain objects that can be will be switched off are connected, from
And fill up the cavity in object.Binary image after expansion process is subjected to corrosion treatment, the side of certain objects can be eliminated
Boundary's point, enables the boundary of certain objects internally shrink, small to eliminate certain objects, that is, other than drop circular hole and is not intended to
The object of justice, for example, small dirty point etc..By closed operation, treated that binary image can not only fill inside certain objects
Minuscule hole connects adjacent object, smooth boundary, and can not change the area of certain objects, and subsequent image is effectively ensured
The accuracy of comparison.
S203, contour extraction processing is carried out to the filling image, to obtain contour images.
By closed operation treated filling image carry out contour extraction processing, will fill image internal point all eliminate after
Remaining point is extracted, the profile point of image is as filled, is contour images by the image that the profile point forms.
S204, the marginal point for obtaining the contour images are fitted circle according to the marginal point, to obtain the first fitting
Circle.
The marginal point of the contour images is determined according to the contour images of acquisition, and whole marginal points are passed through into minimum
Square law is fitted, and obtains the first fitting circle.
S205, the center of circle for obtaining first fitting circle, according to the center of circle of first fitting circle, label and described first
Marginal point of the circle center distance of fitting circle in distance threshold is quadratic fit point.
There is the pseudo-edge point that part is unable to satisfy fitting condition in the marginal point, for example, with the first fitting circle
Circle center distance is more than or less than the point of pre-set distance threshold, these pseudo-edge points can generate the process of fitting circle dry
It disturbs, enables the fitting circle of generation deviate normal position, there are deviations to enable testing result.It is discharged after pseudo-edge, it will be remaining
The marginal point with the circle center distance of the first fitting circle in distance threshold be marked, be used as quadratic fit.
S206, circle is fitted according to quadratic fit point, to obtain the second fitting circle.
It according to the quadratic fit of label point, is fitted again, obtains the second fitting circle, second fitting circle can change
The fitted figure that the kind interference due to pseudo- match point generates drag partially, deformation the problems such as, to effectively improve the accuracy of detection.
S207, the center of circle for determining second fitting circle and radius are the center of circle and the radius of drop circular hole.
Computer can obtain the center of circle and the radius of second fitting circle, so that it is determined that hanging according to the second fitting circle
The center of circle of board circular hole and radius are prepared to be subsequently generated ideal image.
Fig. 5 is a kind of flow chart of test hole offset provided by the embodiments of the present application.
S601, the circular hole center of circle for obtaining template image.
When punching for drop, the punching template of a reference is needed, which can be metal plate of the entity with circular hole, wood
Plate or hard plastic board etc., or computer virtual template simulates suitable template by computer software, and manipulation is mechanical
The machines such as shearing or laser cutting carry out aperture to drop.According to existing template image, the circle of template image can be obtained
The hole center of circle, and subsequent comparison work is carried out according to the circular hole center of circle.
The range difference in the circular hole center of circle of S602, the center of circle for calculating the drop circular hole and the template image.
Drop circular hole is compared with the circular hole of template image, can choose the outer profile of drop and Prototype drawing first
The outer profile of picture is overlapped, and will be overlapped perspective image scanning or shooting, is uploaded in computer, then measures the circle of drop circular hole
The variation of the distance between circular hole center of circle of the heart and template image difference and angle;Also can choose first by the outer profile of drop with
The outer profile of template image is overlapped, and coordinate system is then established on drop, and label obtains the central coordinate of circle and mould of drop circular hole
The circular hole central coordinate of circle of plate image calculates the range difference in two centers of circle by following formula (1),
In formula, d is expressed as the range difference in two centers of circle, x1It is expressed as the abscissa in the drop center of circle, y1It is expressed as the drop center of circle
Ordinate, x2It is expressed as the center of circle abscissa of template image, y2It is expressed as the center of circle ordinate of template image.
If S603, the range difference are less than or equal to pre-determined distance threshold value, unit ideal image is generated.
The artificial preset distance of conditions such as the area size for allowing to punch according to the size of drop and visual appearance
Threshold value will measure or calculate resulting distance of center circle deviation and is compared with distance threshold.If distance of center circle deviation is greater than setting
Distance threshold, illustrate the opened circular hole of drop compared with the circular hole position of template, deviate it is excessive.The reason of causing this problem may
It is that drop position of opening allows other than opening area in drop, for example, aperture influences user's use, give user in character zone
Cause bad experience sense;It may be position of opening too close to drop edge, be easy that drop circular hole is enabled to tear, lose drop
Effect;Be also possible to be that drop circular hole stripping itself is not thorough enough, cause the positioning of the circular hole center of circle inaccurate, show circle center distance deviation compared with
Big phenomenon.At this point, computer, which needs to send, scraps instruction, after staff, which receives, scraps instruction, screens and mark
The underproof drop of circle center distance deviation, then according to the reason of causing circle center distance deviation, classification handles drop.
If range difference is less than or equal to pre-determined distance threshold value, illustrate that the position of opening of drop circular hole meets regulation,
It does not influence the normal use of user not only, but also meets public Visual Aesthetics, and drop is not easy to damage in tapping.This
When, according to the center of circle of drop circular hole and radius, can continue to acquire unit ideal image.
Method provided by the embodiments of the present application, can be by comparing the center of circle of drop circular hole and the circular hole circle of template image
The heart quickly and accurately finds out circle center distance deviation drop substandard products against regulation, thus scrapped, in case it flows into city
, user's usability and corporate image are impacted.
Fig. 6 is a kind of flow chart for detecting aperture radius provided by the embodiments of the present application.
S701, the circle hole radius for obtaining template image.
According to existing template image, the circular hole center of circle of template image can be obtained, and according to circular hole center of circle measurement or
The circle hole radius of template image is calculated, carries out subsequent comparison work.
The length difference of the circle hole radius of S702, the radius for calculating the drop circular hole and the template image.
Drop circular hole is compared with the circular hole of template image, can choose the drop circular hole center of circle and Prototype drawing first
The circular hole center of circle of picture coincides, and will be overlapped perspective image scanning or shooting, is uploaded in computer, then measures drop circular hole
Length difference between radius and the circle hole radius of template image;Also it can choose and drop circle hole radius data be all uploaded to meter
It in calculation machine, is compared one by one with the circle hole radius of template image, (2) calculate drop circle hole radius and template according to the following formula respectively
The length difference of circle hole radius,
C=| s1-s2| (2),
In formula, c is expressed as the length difference of radius, s1It is expressed as drop circle hole radius, s2It is expressed as the circular hole half of template image
Diameter.
If S703, the length difference are less than or equal to pre-set length threshold, unit ideal image is generated.
According to the size of drop, the conditions such as the area size punched and visual appearance is allowed artificially to preset length
Threshold value.The length difference is absolute value, if the length difference of the circle hole radius of drop circle hole radius and template image is greater than length
Threshold value, explanation may be that drop aperture compared with the circular hole of template image is too small or aperture is excessive;It may be drop circular hole portion
It distinguishes and gives up not enough thoroughly, lead to have residual at circular hole, so that the resulting drop circle hole radius of measurement be enabled to become smaller;It is also possible to be to hanging
When board circular hole portion stripping, excessive tearing is caused to circular hole, so that the resulting drop circle hole radius of measurement be enabled to become larger.At this point, meter
Calculation machine, which needs to send, scraps instruction, after staff, which receives, scraps instruction, screens and to mark radius length underproof
Drop, then according to the reason of causing radial misalignment, classification handles drop.
If the length difference of the circle hole radius of drop circle hole radius and template image is less than or equal to length threshold, explanation is hung
Board aperture radius is suitble to, will not be excessively close apart from drop edge because aperture is excessive, causes drop tearable;It will not be because of opening
Hole is too small, causes drop threading difficult.At this point it is possible to can continue to acquire unit reason according to the center of circle of drop circular hole and radius
Think image.
Method provided by the embodiments of the present application, can be by comparing the radius of drop circular hole and the circular hole half of template image
Diameter quickly and accurately finds out radius drop substandard products against regulation, thus scrapped, in case it comes into the market, to user
Usability and corporate image impact.
Fig. 7 is a kind of flow chart for generating unit ideal image provided by the embodiments of the present application.
S301, according to the gray value of the unit image, dividing the unit image is to have intermediate zone semicircle orifice, without transition
Band semicircle orifice has intermediate zone half bore periphery and without intermediate zone half bore periphery.
Due to dynamic shooting and the factor of drop placed angle, the circular in shooting gained unit image is enabled to exist
Shade intermediate zone, and usually can be according to the position where shade intermediate zone, circular hole, which is divided into, has intermediate zone semicircle orifice, without transition
Band semicircle orifice, and corresponding with the two have intermediate zone half bore periphery, without intermediate zone half bore periphery.
S302, it is described have in intermediate zone semicircle orifice, determine with the circle center distance of the drop circular hole be greater than first threshold
In the range of, and it is the first ideal zone that gray value, which is greater than the region of gray value in the background hole,.
S303, it is described have in intermediate zone semicircle orifice, determine and be less than or equal to the with the circle center distance of the drop circular hole
In the range of one threshold value, and it is secondary ideal region that gray value, which is equal to the region of gray value in the background hole,.
In S304, the no intermediate zone semicircle orifice, determines and be greater than first threshold with the circle center distance of the drop circular hole
In the range of, and it is third ideal zone that gray value, which is greater than the region of gray value in the background hole,.
In S305, the no intermediate zone semicircle orifice, determines and be less than or equal to the with the circle center distance of the drop circular hole
In the range of one threshold value, and it is the 4th ideal zone that gray value, which is equal to the region of gray value in the background hole,.
S306, it is described have in intermediate zone half bore periphery, determination be less than or equal in the circle center distance with the drop circular hole
In the range of second threshold, and it is the 5th ideal zone that gray value, which is less than the region of gray value outside the prospect hole,.
S307, it is described have in intermediate zone half bore periphery, determine with the circle center distance of the drop circular hole be greater than the second threshold
In the range of value, and it is the 6th ideal zone that gray value, which is equal to the region of gray value outside the prospect hole,.
In S308, the no intermediate zone half bore periphery, determination is less than or equal in the circle center distance with the drop circular hole
In the range of second threshold, and it is the 7th ideal zone that gray value, which is less than the region of gray value outside the prospect hole,.
In S309, the no intermediate zone half bore periphery, determines and be greater than the second threshold with the circle center distance of the drop circular hole
In the range of value, and it is the 8th ideal zone that gray value, which is equal to the region of gray value outside the prospect hole,.
For example, if drop circle hole radius is R, first threshold 0.8R is having transition in the circular hole of unit image
In band semicircle orifice, with circular hole center of circle distance d1In the range of 0.8R, i.e., in 0.8R < d1In the range of < R, by gray value
Zone marker greater than gray value in background hole is the first ideal zone, corresponding, in no intermediate zone semicircle orifice, marks the
Three ideal zones;With circular hole center of circle distance d2In the range of 0.8R, i.e., in 0 < d2It, will in the range of≤0.8R
Gray value is secondary ideal region equal or close to the zone marker in gray value in background hole, corresponding, in no intermediate zone
In semicircle orifice, the 4th ideal zone is marked;Second threshold is being set as 1.1R, is being had in intermediate zone half bore periphery, with circular hole circle
The distance d of the heart3In the range of 1.1R, i.e., in R < d3In the range of≤1.1R, gray value is less than outside prospect hole
The zone marker of gray value is the 5th ideal zone, corresponding, in no intermediate zone half bore periphery, marks the 7th ideal area
Domain;Having in intermediate zone half bore periphery, with circular hole center of circle distance d4In the range of 1.1R, i.e., in d4The range of > 1.1R
It is interior, by gray value be greater than or close to gray value outside prospect hole zone marker be the 6th ideal zone, it is corresponding, in no intermediate zone
In half bore periphery, the 8th ideal zone is marked.
S310, first ideal zone, the secondary ideal region, the third ideal zone, the described 4th are obtained
Ideal zone, the 5th ideal zone, the 6th ideal zone, the 7th ideal zone and the 8th ideal zone
Image, and be integrated into unit ideal image.
Resulting each ideal zone will be marked to integrate, obtain unit ideal image.
The method provided in this embodiment for generating unit ideal image, by the way that using shade intermediate zone as condition, drop is justified
It is divided into two parts inside and outside hole, and marks respective ideal zone respectively, to finally be integrated into unit ideal image.Can have
Effect excludes influence of the shade intermediate zone to detection accuracy, to improve the accuracy to drop circular hole quality testing.
Fig. 8 is a kind of structure diagram of detection device of drop circular hole quality provided by the embodiments of the present application.
As shown in figure 8, corresponding with the detection method of drop circular hole quality provided by the present application, present invention also provides one
The detection device of kind drop circular hole quality, for executing detection method provided by the present application, comprising:
Gray value acquiring unit 1, for obtaining the gray value of unit image, the gray value of the unit image includes prospect
Gray value in sum of the grayscale values background hole outside hole;
Unit 2 is sought, if the gray value for the unit image changes, seeks the center of circle and half of drop circular hole
Diameter;
Image generation unit 3, for according to the drop circular hole the center of circle and radius, generate unit ideal image;
Defect point computing unit 4, for calculating defect point area according to the unit ideal image and the unit image
With defect point contrast;
Instruction issue unit 5 is scrapped, if being greater than preset value for the defect point area and the defect point contrast,
It then issues and scraps instruction.
Fig. 9 is the structure drawing of device of a kind of center of circle for seeking drop circular hole provided by the embodiments of the present application and radius.
As shown in figure 9, the device of a kind of center of circle for seeking drop circular hole provided in this embodiment and radius, comprising:
Binarization unit 21, for unit image described in binaryzation, to obtain binary image;
Closed operation unit 22, for carrying out closed operation processing to the binary image, to obtain filling image;
Contours extract unit 23, for carrying out contour extraction processing to the filling image, to obtain contour images;
Fitting unit 24 is fitted circle according to the marginal point for obtaining the marginal point of the contour images, to obtain
First fitting circle;
Match point marking unit 25, for obtaining the center of circle of first fitting circle, according to the circle of first fitting circle
Marginal point of the circle center distance of the heart, label and first fitting circle in distance threshold is quadratic fit point;
The fitting unit 24 is also used to be fitted circle according to quadratic fit point, to obtain the second fitting circle;
The center of circle and radius determination unit 26, for determining the center of circle and the radius of second fitting circle for the circle of drop circular hole
The heart and radius.
As shown in figure 8, a kind of detection device of drop circular hole quality provided in this embodiment, further includes:
Template circular hole center of circle acquiring unit 6, for obtaining the circular hole center of circle of template image;
Distance of center circle deviation computing unit 7, for calculating the center of circle of the drop circular hole and the circular hole circle of the template image
The range difference of the heart;
Described image generation unit 3 generates unit if being less than or equal to pre-determined distance threshold value for the range difference
Ideal image.
Further, the detection device further include:
Template circle hole radius acquiring unit 8, for obtaining the circle hole radius of template image;
Radius length difference computing unit 9, for calculating the radius of the drop circular hole and the circular hole half of the template image
The length difference of diameter;
Described image generation unit 3 generates unit if being less than or equal to pre-set length threshold for the length difference
Ideal image.
Figure 10 is a kind of structure drawing of device for generating unit ideal image provided by the embodiments of the present application.
As shown in Figure 10, a kind of device generating unit ideal image provided by the present application, further includes with lower unit, and root
Unit ideal image is generated according to following step:
Division unit 301, for the gray value according to the unit image, dividing the unit image is to have intermediate zone half
Circular hole, without intermediate zone semicircle orifice, have intermediate zone half bore periphery and without intermediate zone half bore periphery;
First ideal zone determination unit 302 has in intermediate zone semicircle orifice for described, determine with the drop circular hole
Circle center distance be greater than in the range of first threshold, and it is first ideal that gray value, which is greater than the region of gray value in the background hole,
Region;
Secondary ideal area determination unit 303 has in intermediate zone semicircle orifice for described, determine with the drop circular hole
Circle center distance be less than or equal in the range of first threshold, and it is that gray value, which is equal to the region of gray value in the background hole,
Two ideal zones;
Third ideal zone determination unit 304, in the no intermediate zone semicircle orifice, determine with the drop circular hole
Circle center distance be greater than in the range of first threshold, and it is that third is ideal that gray value, which is greater than the region of gray value in the background hole,
Region;
4th ideal zone determination unit 305, in the no intermediate zone semicircle orifice, determine with the drop circular hole
Circle center distance be less than or equal in the range of first threshold, and it is that gray value, which is equal to the region of gray value in the background hole,
Four ideal zones;
5th ideal zone determination unit 306 has in intermediate zone half bore periphery for described, determines round with the drop
The circle center distance in hole is less than or equal in the range of second threshold, and gray value is less than the region of gray value outside the prospect hole
5th ideal zone;
6th ideal zone determination unit 307 has in intermediate zone half bore periphery for described, determines round with the drop
The circle center distance in hole is greater than in the range of second threshold, and it is the 6th reason that gray value, which is equal to the region of gray value outside the prospect hole,
Think region;
7th ideal zone determination unit 308, in the no intermediate zone half bore periphery, determining round with the drop
The circle center distance in hole is less than or equal in the range of second threshold, and gray value is less than the region of gray value outside the prospect hole
7th ideal zone;
8th ideal zone determination unit 309, in the no intermediate zone half bore periphery, determining round with the drop
The circle center distance in hole is greater than in the range of second threshold, and it is the 8th reason that gray value, which is equal to the region of gray value outside the prospect hole,
Think region;
Image integration unit 310, for obtaining first ideal zone, the secondary ideal region, third reason
Think region, the 4th ideal zone, the 5th ideal zone, the 6th ideal zone, the 7th ideal zone and
The image of 8th ideal zone, and it is integrated into unit ideal image.