CN102999886B - Image Edge Detector and scale grating grid precision detection system - Google Patents

Image Edge Detector and scale grating grid precision detection system Download PDF

Info

Publication number
CN102999886B
CN102999886B CN201210427491.9A CN201210427491A CN102999886B CN 102999886 B CN102999886 B CN 102999886B CN 201210427491 A CN201210427491 A CN 201210427491A CN 102999886 B CN102999886 B CN 102999886B
Authority
CN
China
Prior art keywords
image
edge
module
value
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201210427491.9A
Other languages
Chinese (zh)
Other versions
CN102999886A (en
Inventor
李英志
王晓峰
王罡
邹晶
董玲
董建
刘季雨
孙秀梅
邹钺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CHANGGUANG DIGITAL DISPLAY TECHNOLOGY Co Ltd
Original Assignee
CHANGGUANG DIGITAL DISPLAY TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CHANGGUANG DIGITAL DISPLAY TECHNOLOGY Co Ltd filed Critical CHANGGUANG DIGITAL DISPLAY TECHNOLOGY Co Ltd
Priority to CN201210427491.9A priority Critical patent/CN102999886B/en
Publication of CN102999886A publication Critical patent/CN102999886A/en
Application granted granted Critical
Publication of CN102999886B publication Critical patent/CN102999886B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention relates to a kind of Image Edge Detector and comprise the scale grating grid precision detection system of this detecting device, the image filtering module of described detecting device is used for filtering image noise and obtains filtered image, and the edge that edge extracting module utilizes double trapezoid arithmetic operators to extract filtered image obtains a width new images; The optimal segmenting threshold T of the new images that Threshold segmentation model choice edge extracting module obtains, then binary conversion treatment is done to new images, second edge extraction module utilizes double trapezoid arithmetic operators again to carry out edge extracting to the image after Threshold segmentation, edge thinning module carries out refinement to the edge that second edge extraction module is extracted, and removes burr.The present invention can extract the edge of image clear, accurately, and the contrast at edge is very high.<!--1-->

Description

Image Edge Detector and scale grating grid precision detection system
Technical field
The invention belongs to technical field of image processing, relate to a kind of Image Edge Detector and comprise the scale grating grid precision detection system of this detecting device.
Background technology
Edge is the most basic feature of image, and rim detection plays an important role in the application such as computer vision, graphical analysis, is the important step of graphical analysis and identification, this is because the edge of image contains the useful information for identifying.So the principal character that rim detection is graphical analysis and pattern-recognition extracts means.
Classical, the simplest edge detection method is to original image certain neighborhood structure boundary operator according to pixels, because original image is often containing noise, and edge and noise show as gray scale in spatial domain larger rising and falling, then react for being both high fdrequency component at frequency domain, this just brings difficulty to rim detection.
Long grating has been widely used in various surveying instrument, lathe digital display, Numeric Control Technology as a kind of novel measuring element.The making precision of long grating will directly have influence on the measuring accuracy of testing tool (as three coordinate machine etc.), and the machining precision of workpiece.Therefore to improve the making precision of grating scale and the reliability of long grating application, must detect the precision index of grating scale, analyze the error component in long grating fabrication process.For working with ensureing optical grating measuring system accurate stable, require that large, the sinusoidal property of electrical signal amplitude of optical grating Moire fringe will be got well, the ratio of bright black level is wanted large (namely contrast will be got well), require simultaneously measurement total length on, the change of grating signal amplitude is little, the change of DC level and drift change that is little, biphase signaling phase differential little.Practical application shows: the quality of grating signal depends primarily on the quality of scale grating.For this reason, usually with the change of grating signal amplitude and DC level in total length, the change of biphase signaling phase differential and grating grid precision etc. three in total length, as the leading indicator evaluating grating scale quality.Practical application also shows: the precision of optical grating measuring system depends primarily on the precision of scale grating grid.First the precision detecting grating grid will extract Moire fringe edge line, accurately then by calculating the pitch of grating.
Summary of the invention
The technical matters that the present invention will solve is to provide a kind of Image Edge Detector can extracting image border clear, exactly.
In order to solve the problems of the technologies described above, Image Edge Detector of the present invention comprises:
Image filtering module: filtering image noise obtains filtered image;
An edge extracting module: utilize double trapezoid arithmetic operators to extract the edge of image, the convolution mask of this operator is as follows:
G x = m 7 m 1 m 4 m 2 m 8 m 5 m 3 m 6 m 9 G y = m 1 m 2 m 3 m 7 m 8 m 9 m 4 m 5 m 6
Wherein: m 1~ m 9be all integer, G xthe arithmetic operators of horizontal direction, G ythe arithmetic operators of vertical direction, m 1=m 3=-m 4=-m 6, m 2=-m 5, m 2>=2 × m 1, m 5>=2 × m 4, m 7=m 9< 0, m 8=-(m 7+ m 9=)=-2 × m 7=-2 × m 9, | m 7|≤| m 1|; If the minor increment in image between adjacent two edges is d, then when d<20 pixel, | m 1|=1 or 2,2≤| m 2|≤5; When d>=20 pixel, 2|m 1|≤5≤, 5≤| m 2|≤10;
Filtered image and convolution mask are obtained a width new images as convolution algorithm;
Threshold segmentation module: the optimal segmenting threshold T of the new images selecting edge extracting module to obtain, then makes binary conversion treatment to new images, the pixel being greater than optimal segmenting threshold T is put maximum gradation value N h, the pixel gray scale being less than optimal segmenting threshold T is set to 0, thus obtains a width binary image;
Second edge extraction module: utilize the method identical with edge extracting module again to carry out edge extracting to the image after Threshold segmentation;
Edge thinning module: carry out refinement to the edge that second edge extraction module is extracted, removes burr.
Image filtering is the pretreatment stage of Image Edge-Detection, mainly filtering image noise, for follow-up edge extracting is prepared.
Edge extracting is normally realized by convolution by spatial domain derivative operator.In fact this process has been similar to by difference method.The corresponding single order of gradient or second derivative, have already been proposed the operator that many kinds are different, at present as RobertCross operator, Prewitt operator, Kirsch operator and Sobel operator etc.Because the contrast on border of these operator extraction is lower, be unfavorable for follow-up Threshold segmentation, therefore the present invention proposes a kind of new arithmetic operators-double trapezoid operator.This operator can extract the edge of image clear, accurately, and the contrast at edge is very high.
Contrast formula: C = 1 M &times; N &Sigma; i = 1 M &Sigma; j = 1 N [ f ( i , j ) - f &OverBar; ] 2
Average gradient formula: G = 1 M &times; N &Sigma; i = 1 M &Sigma; j = 1 N [ ( f ( i , j ) - f ( i - 1 , j ) ) 2 + ( f ( i , j ) - f ( i , j - 1 ) ) 2 ]
Wherein f (i, j) the i-th row j row pixel that is original image, for the average gray value of original image, original image size is the capable N row of M.
Above several arithmetic operators is utilized to carry out edge extracting to original image, the picture contrast after edge extracting and average gradient correlative value, as shown in the table:
Robert Cross Prewitt Kirsch Sobel Double trapezoid operator
Contrast 5 16 43 21 65
Average gradient 2 6 18 8 25
Average gradient is larger, and the edge of key diagram picture is more clear, and contrast is larger, illustrates that the contrast at edge is higher.Double trapezoid operator contrast of the present invention and average gradient are all greater than other operators as can be seen from the table, illustrate that this operator can extract the edge of image clear, accurately, and the contrast at edge are very high.
Due to one time, edge extracting result only describes the rough local edge of piece image, therefore needs to do further aftertreatment to rough edge image.This aftertreatment comprises the process such as Threshold segmentation, edge thinning.
After Threshold segmentation, the edge line of image is comparatively thick, and in order to refinement edge line, the present invention utilizes double trapezoid arithmetic operators that the image after Threshold segmentation is carried out edge extracting again, makes edge line be refined as single pixel.Because the edge line after refinement attaches many " burr " simultaneously.The present invention utilizes edge thinning module to be further processed the edge that second edge extraction module is extracted to remove these " burrs ", obtains clear, image border line accurately thus.
Described image filtering module adopts gaussian filtering method filtering noise.
Image filtering is the pretreatment stage carrying out grating grid accuracy detection, mainly filtering image noise, for follow-up edge extracting is prepared.In the present invention, adopt gaussian filtering method can effective filtering noise.
Described Threshold segmentation module calculates new images statistic histogram, statistic histogram envelope is fitted to a smooth curve, then by the minimum point of smooth curve that finds as a setting with the optimal segmenting threshold T of edge line.
Described Threshold segmentation module adopts the Research on threshold selection based on histogram envelope line.The basic thought of the method is that histogrammic for image statistics envelope is fitted to a smooth curve, and the minimum point of the smooth curve found is the optimal segmenting threshold of background and edge line.The present invention is by the histogrammic characteristic distributions of image statistics, image histogram envelope will represent the minimal value of background and target intersection gray-scale value as optimal segmenting threshold, binary conversion treatment is carried out to image, thus the edge line of image can be partitioned into exactly.
Described Threshold segmentation module by smoothing for new images statistic histogram filtering, adopt first differential method obtain filtering after the local maximum value set of statistic histogram; Utilize local maximum value set to carry out curve fitting, after matching, obtain curve minimum point, and using gray-scale value corresponding for this curve minimum point as optimal segmenting threshold T.
Described Threshold segmentation module utilizes matlab to programme and carries out curve fitting.
Described image filtering module, edge extracting module, Threshold segmentation module, second edge extraction module, an edge thinning module are realized by the com component of VC++ and matlab hybrid programming.
The present invention, when carrying out curve fitting, does not directly realize least square fitting process by VC++, and such computation process is very complicated, and calculated amount is very large.But adopt matlab programming, realized by the com component of VC++ and matlab hybrid programming, substantially reduce calculated amount.Calculate very simple, and it is accurate to ask for threshold value for background and the larger situation of target contrast.
Described edge thinning module stores has multiple 4 × 3 to eliminate template, and 4 × 3 elimination templates are as follows:
P 1 P 2 P 3 P 4 P 5 P 6 P 7 P 8 P 9 P 10 P 11 P 12
Eliminate template and meet following four conditions simultaneously:
A, P 5eight neighborhood element in have 2 ~ 6 elements to be 1, all the other elements are 0, i.e. N=P 1+ P 2+ P 3+ P 4+ P 6+ P 7+ P 8, 2≤N≤6;
B, P 2and P 8one is had at least to be zero, i.e. P 2× P 8=0;
C, P 5eight neighborhood element circulate in the direction of the clock or only have one 0 by counterclockwise circulation, 1 discontinuous point;
D, P 4, P 6and P 8in have at least one to be zero, i.e. P 4× P 6× P 8=0; Or P 8eight neighborhood element circulate in the direction of the clock or there is no 0,1 discontinuous point by counterclockwise circulation or have be greater than 10,1 discontinuous point;
Search for from binary image top left corner pixel, if current pixel gray-scale value is 0, then skip; If current pixel gray-scale value is N h, then this pixel is made to correspond to the element P eliminating template 5, by other pixels around this pixel with eliminate correspondence position element in template and compare, if to eliminate template identical with one of them, current pixel gray scale is set to 0, otherwise current pixel gray-scale value is constant; Repeat said process, until neither one grey scale pixel value is changed in binary image, edge thinning terminates.
The kind of edge thinning method is a lot, can be divided into: sequential thinning, parallel thinning and mixing refinement according to the order of refinement.The thinning method that the present invention adopts belongs to sequential thinning, and its principle is the multiple elimination template of structure, is compared by binary image, determine whether delete certain point with elimination template.The method that the present invention adopts not only can refinement thorough, the single pixel line after refinement is at the center line of edge line, and Glabrous thorn, can ensure next step accuracy calculated.
Edge thinning refers on the basis not affecting edge line connectedness, deletes the edge pixel of edge line, removes " burr " on straight line, till making edge line be single pixel wide.Edge line skeleton after desirable refinement should be the centre position of original edge line, and keeps the connectivity of edge line, topological structure and minutia.A kind of good thinning algorithm should meet following condition:
(1) convergence: iteration must be convergence
(2) connectivity: the connectivity not destroying edge line
(3) Topological: do not cause progressively eating of edge line, keeps the basic structure characteristic of original image
(4) retentivity: the minutia of Protect edge information line
(5) refinement: the width of skeleton edges line is 1 pixel, i.e. single pixel wide.
(6) axis: skeleton is as far as possible close to stripe centerline
(7) rapidity: algorithm is simple, and speed is fast.
The edge thinning method that the present invention adopts can meet above 7 conditions simultaneously, extracts the skeleton of edge line accurately, removes " burr ".
Another technical matters that the present invention will solve is to provide a kind of scale grating grid precision detection system comprising above-mentioned Image Edge Detector.
In order to solve the problems of the technologies described above, scale grating grid precision detection system of the present invention also comprises VTOL (vertical take off and landing) platform 1, be fixed on the CCD camera 2 on VTOL (vertical take off and landing) platform 1, be connected to the enlarging lens 5 in CCD camera 2, be arranged on the coaxial light source 6 on enlarging lens 5, image pick-up card 3, grid line width calculation module; The directional light that coaxial light source 6 sends out impinges upon the grid line district of scale grating 8 from the lens barrel of enlarging lens 5; CCD camera 2 gathers grating grid area image and sends image pick-up card 3 to; The raster image data of collection is transferred to Image Edge Detector by image pick-up card 3, Image Edge Detector extracts the grid line of raster image, in the image that Image Edge Detector detects by grid line width calculation module, every bar grid line is evenly divided into M part, tries to achieve every a grid line width; Then M grid line width is removed N number of maximal value, remove N number of minimum value, the M-2N of a centre value is averaging the width obtaining each grid line; All grid line width of entire image are removed Q maximal value, removes Q minimum value, then average, draw the average grating grid width of this image; Wherein M>2N, grid line number >2Q.
Accompanying drawing explanation
Below in conjunction with the drawings and specific embodiments, the present invention is described in further detail.
Fig. 1 is Image Edge Detector functional module framework figure of the present invention.
Fig. 2 is scale grating grid precision detection system structural representation of the present invention.
Fig. 3 is scale grating grid precision detection system functional module framework figure of the present invention.
Fig. 4 is the statistic histogram of the new images that edge module obtains.
Fig. 5 is the original image in the scale grating grid region that collected by camera arrives.
Fig. 6 is the superimposed image of grating edge line image and the original image detected.
Embodiment
As shown in Figure 1, Image Edge Detector of the present invention comprises image filtering module, edge extracting module, Threshold segmentation module, second edge extraction module and an edge thinning module.
Image is in the process gathered and transmit, often adulterate various noise, cause the Quality Down of image, this edge extracting for image causes very large difficulty, in order to better carry out edge extracting, first must carry out filtering, in the present invention, image filtering module adopts the good gaussian filtering of denoising effect.The discrete Gaussian function expression formula of two dimension zero-mean is:
g [ i , j ] = e - ( i 2 + j 2 ) 2 &sigma; 2
Collection image and Gaussian function convolution obtain filtered image.
One time edge extracting module adopts a kind of new double trapezoid arithmetic operators to carry out edge extracting to the image after filtering, and this operator can extract the edge of image clear, accurately, and the contrast at edge is very high, is conducive to follow-up Threshold segmentation.The convolution mask of this operator is as follows:
G x = m 7 m 1 m 4 m 2 m 8 m 5 m 3 m 6 m 9 G y = m 1 m 2 m 3 m 7 m 8 m 9 m 4 m 5 m 6
Wherein: m 1~ m 9be all integer, G xthe arithmetic operators of horizontal direction, G yit is the arithmetic operators of vertical direction.M 1=m 3=-m 4=-m 6, m 2=-m 5, m 2>=2 × m 1, m 5>=2 × m 4, m 7=m 9< 0, m 8=-(m 7+ m 9=)=-2 × m 7=-2 × m 9, | m 7|≤| m 1|; If the minor increment in image between adjacent two edges is d, then when d<20 pixel, | m 1|=1 or 2,2≤| m 2|≤5; When d>=20 pixel, 2|m 1|≤5≤, 5≤| m 2|≤10.
Filtered image and convolution mask are obtained a width new images as convolution algorithm.
Threshold segmentation module carries out Threshold segmentation to new images.
Although the new images contrast that edge extracting module obtains is higher, but there is larger transitional region between background and edge line, want to be partitioned into edge line accurately, make edge line can not too slightly can not too thin to such an extent as to fracture, suitable threshold value must be selected.The method that Threshold segmentation module of the present invention adopts is the Research on threshold selection based on histogram envelope line.The basic thought of the method is that histogrammic for image statistics envelope is fitted to a smooth curve, finds the minimum point of smooth curve to be the optimal segmenting threshold of background and edge line.First Threshold segmentation module adopts the method for differential to obtain statistic histogram envelope local maximum, then these local maximums is fitted to smooth curve again.When carrying out curve fitting, directly do not realize least square fitting process by VC++, such computation process is very complicated, and calculated amount is very large.But adopt matlab programming, realized by the com component of VC++ and matlab hybrid programming, substantially reduce calculated amount.The method is very simple, and it is accurate to ask for threshold value for background and the larger situation of target contrast.Specific implementation process is as follows:
A, first draw the statistic histogram (see Fig. 4) of new images, in statistic histogram P (i) for gray level on image be the pixel number of i;
B, by smoothing for statistic histogram filtering, that is:
P ( i ) = ( P ( i - u ) + P ( i - u + 1 ) + . . . . . . P ( i - 2 ) + P ( i - 1 ) + P ( i ) + P ( i + 1 ) + P ( i + 2 ) + . . . . . . + P ( i + u ) ) / ( 2 u + 1 )
In formula, u is natural number, and the selection of its numerical value does not have strict regulation, and the larger filter effect of numerical value is better, but the corresponding increase of calculated amount, generally select 3≤u≤7;
C, adopt first differential method obtain filtering after local maximum value set M (j) of statistic histogram, wherein j is the image intensity value that Local modulus maxima is corresponding;
D, local maximum value set M (j) is delivered to matlab by com component carries out curve fitting, obtain curve minimum point after matching, then transmit back VC++, namely draw optimal segmenting threshold T.
After drawing optimal segmenting threshold T, utilize binary conversion treatment f ( i , j ) = N h f ( i , j ) > T 0 f ( i , j ) < T Realize Threshold segmentation, wherein N hbe generally image maximum gray scale.
Described Threshold segmentation module can also adopt maximum variance between clusters to obtain optimal segmenting threshold T.Maximum variance between clusters derives on the basis of the principle of least square, and it is as follows that its threshold value asks for process:
A, first find out most high grade grey level L in image;
B, then to get from each gray level of 0 to L as threshold value th respectively, calculate this threshold value separate two class C 0, C 1respective probability w 0, w 1and average value mu 0, μ 1.If the pixel count that image intensity value is i is n i, then total pixel number is: , the probability of each gray-scale value is: p i=n i/ N.
C 0the probability of group is:
C 1the probability of group is:
C 0the mean value of group is:
C 1the mean value of group is:
The total average gray of c, computed image is: μ=ω 0μ 0+ ω 1μ 1, the variance calculated between two classes is: σ 200-μ) 2+ ω 11-μ) 2.
D, the variance found out between two classes are the threshold value T of maximal value, i.e. σ 2(T)=max (σ 2(th)).
After threshold calculations completes, utilize binary conversion treatment f ( i , j ) = N h f ( i , j ) > T 0 f ( i , j ) < T Realize Threshold segmentation.
The edge line obtaining image after Threshold segmentation is thicker, in order to refinement edge line, second edge extraction module have employed one very simple effective method, and namely identical with edge extracting module method carries out edge extracting again to the image after Threshold segmentation.
After second edge extraction, although the edge of the image drawn is almost single pixel, attach " burr " simultaneously.In order to remove these " burrs ", then take edge thinning process.The kind of edge thinning algorithm is a lot, can be divided into: sequential thinning, parallel thinning and mixing refinement according to the order of refinement.The thinning method that in the present invention, edge thinning module adopts belongs to sequential thinning, and its principle is the multiple elimination template of structure, is compared by the image after edge conjunction, determine whether delete certain point with elimination template.The method that the present invention adopts not only can refinement thorough, the single pixel line after refinement is at the center line of grating grid edge line, and Glabrous thorn, can ensure next step accuracy calculated.
In the present invention, edge thinning module adopts multiple 4 × 3 to eliminate template, as follows:
P 1 P 2 P 3 P 4 P 5 P 6 P 7 P 8 P 9 P 10 P 11 P 12
It is whether deleted by image and this elimination template matching are decided current point.This elimination template the condition that meets respectively:
A, suppose second edge extraction after image in pixel value be 0 use 0 represent, pixel value is N huse 1 represent.P 5eight neighborhood in 1 number between 2 to 6, i.e. N=P 1+ P 2+ P 3+ P 4+ P 6+ P 7+ P 8, 2≤N≤6;
B, P 2and P 8one is had at least to be zero, i.e. P 2× P 8=0.
C, P 5eight neighborhood element to circulate in the direction of the clock or counterclockwise circulation only has one 0,1 discontinuous point.
D, P 4, P 6and P 8in have at least one to be zero, i.e. P 4× P 6× P 8=0; Or at P 4, P 5, P 6, P 9, P 12, P 11, P 10, P 7eight elements circulate in the direction of the clock or counterclockwise circulation there is no 0,1 discontinuous point or have be greater than 10,1 discontinuous point.
Search for from binary image top left corner pixel, if current pixel value is 0, then skip, if current pixel value is N h, then this point is made to correspond to P 5with elimination template matching, if to eliminate template identical with one of them, this point deletion (even if this pixel value sets to 0), otherwise reservation.Repeat said process, until neither one pixel value is changed, edge thinning terminates.
Elaborate below in conjunction with the refinement of several example edge.
If a certain 4 × 3 pixel gray matrixs are on image:
P 1 &prime; P 2 &prime; P 3 &prime; P 4 &prime; P 5 &prime; P 6 &prime; P 7 &prime; P 8 &prime; P 9 &prime; P 10 &prime; P 11 &prime; P 12 &prime;
Wherein P ' 5for current pixel point.
( 1 ) , 1 1 1 0 1 0 0 0 0 1 1 1 ( 2 ) , 1 0 1 1 1 0 1 1 1 0 1 0 ( 3 ) , 1 1 1 1 1 0 1 1 1 0 1 0 ( 5 ) , 1 1 1 0 1 0 0 1 0 0 1 0
( 5 ) , 1 1 1 0 1 0 0 1 0 0 1 0 ( 6 ) , 0 0 0 1 1 1 1 1 1 1 0 1 ( 7 ) , 1 0 0 1 1 1 1 1 1 0 1 0 ( 8 ) , 1 1 1 0 1 0 0 1 0 0 0 0
Suppose that the element in above-mentioned eight matrixes corresponds to the pixel of eight parts on image.Must meet above-mentioned four conditions owing to eliminating template, as long as the element thus in matrix meets above-mentioned four conditions simultaneously, just can to determine that this matrix and one of them eliminate template identical, namely corresponding to P simultaneously 5pixel be " burr ", then this pixel gray-scale value is set to 0.
Matrix (1): current point P 5' eight neighborhood in 1 number be 3; P 8' be zero;
P 5' eight neighborhood element circulate in the direction of the clock only have one 0,1 discontinuous point; P 4', P 6' and P 8' be all zero, i.e. P 4× P 6× P 8=0.Meet four conditions, P simultaneously 5' be burr, therefore delete.
Matrix (2): P 5' eight neighborhood element to have circulated in the direction of the clock two 0,1 discontinuous point, do not satisfy condition c.P 5' some reservation.
Matrix (3) does not satisfy condition b, P 5' some reservation.
Matrix (4): simultaneously meet four conditions, P 5' delete.
P in matrix (5) 5' neighborhood has two discontinuous points, do not satisfy condition c, P 5' some reservation.
Matrix (6): P 8' neighborhood only has one 0,1 discontinuous point, do not satisfy condition d, P 5' some reservation.
Matrix (7): P 8' neighborhood has two 0,1 discontinuous point, meets four conditions, P simultaneously 5' delete.
Matrix (8): P 8' neighborhood do not have 0,1 discontinuous point, meets four conditions, P simultaneously 5' delete.
See Fig. 2, Fig. 3, scale grating grid detection system of the present invention comprises VTOL (vertical take off and landing) platform 1, be fixed on the high definition 1394 interface CCD camera 2 on VTOL (vertical take off and landing) platform 1, the equipment being connected to CCD camera 2 rear end has image pick-up card 3, computing machine 4, be connected to the magnification at high multiple camera lens 5 in CCD camera 2, be arranged on the coaxial light source 6 on magnification at high multiple camera lens 5; Image Edge Detector and grid line width calculation module is comprised in described computing machine 4.The directional light that coaxial light source 6 sends out impinges upon the grid line district of the scale grating 8 horizontal location platform 7 from the lens barrel of magnification at high multiple camera lens 5.Gather grating grid area image by CCD camera, extracted accurately by the edge line of Image Edge Detector by grid line, then calculated the pitch of grid line by grid line width calculation module.
The present invention adopts pitch to be 20um, black and white, than being the scale grating 8 of 11:9, is selected to be of a size of 2/3 ' ' the high definition CCD camera 2 of (pixel dimension is 6.45um*6.45um), collocation enlargement factor is the magnification at high multiple camera lens 5 of 8 times, when its object distance is 87mm, visual field reaches 1mm.
As shown in Figure 3, scale grating grid precision detection system functional module of the present invention comprises image filtering module, edge extracting module, Threshold segmentation module, second edge extraction module and an edge thinning module, grid line width calculation module; Concrete testing process is as follows: (1) carries out filtering to the image collected; (2) first time edge extracting is carried out to the image after filtering; (3) Threshold segmentation is carried out to the image after first time edge extracting; (4) again edge extracting is carried out to the image after Threshold segmentation; (5) image after edge extraction carries out edge thinning; (6) image after edge refinement calculates.
Each step is specific as follows:
Step (1): filtering is carried out to the image collected
The original image in the scale grating grid district that CCD camera 2 collects as shown in Figure 5.Image is in the process gathered and transmit, and often adulterate various noise, causes the Quality Down of image, this edge extracting for image causes very large difficulty, in order to better carry out edge extracting, first must carry out filtering, image filtering module adopts the good gaussian filtering of denoising effect.The discrete Gaussian function expression formula of two dimension zero-mean is:
g [ i , j ] = e - ( i 2 + j 2 ) 2 &sigma; 2
Collection image and Gaussian function convolution obtain filtered image.
Step (2): edge extracting is carried out to the image after filtering
One time edge extracting module adopts a kind of new double trapezoid arithmetic operators.This operator can extract the edge of image clear, accurately, and the contrast at edge is very high, is conducive to follow-up Threshold segmentation.The convolution mask of this operator is as follows:
G x = m 7 m 1 m 4 m 2 m 8 m 5 m 3 m 6 m 9 G y = m 1 m 2 m 3 m 7 m 8 m 9 m 4 m 5 m 6
Wherein: m 1~ m 9be all integer, G xthe arithmetic operators of horizontal direction, G yit is the arithmetic operators of vertical direction.M 1=m 3=-m 4=-m 6, m 2=-m 5, m 2>=2 × m 1, m 5>=2 × m 4, m 7=m 9< 0, m 8=-(m 7+ m 9=)=-2 × m 7=-2 × m 9, | m 7|≤| m 1|; If the minor increment in image between adjacent two edges is d, then when d<20 pixel, | m 1|=1 or 2,2≤| m 2|≤5; When d>=20 pixel, 2|m 1|≤5≤, 5≤| m 2|≤10.
In grating grid accuracy detection of the present invention, an edge extracting module of Image Edge Detector and second edge extraction module only can adopt the arithmetic operators G of horizontal direction xa width new images is obtained as convolution algorithm with filtered image.Extract the horizontal direction arithmetic operators G of raster image informal voucher line left hand edge xzwith the horizontal direction arithmetic operators G extracting raster image informal voucher line right hand edge xyconcrete selection is as follows:
G xy = - 1 2 - 2 8 2 - 8 2 - 2 - 1 G xz = - 1 - 2 2 - 8 2 8 - 2 - 2 - 1
Step (3): Threshold segmentation is carried out to the image after first time edge extracting
Although the image contrast after edge extracting is higher, between background and edge line, there is larger transitional region, want to be partitioned into edge line accurately, make edge line can not too slightly can not too thin to such an extent as to fracture, suitable threshold value must be selected.Threshold segmentation module can adopt the Research on threshold selection based on histogram envelope line, also can adopt maximum variance between clusters or other threshold segmentation methods.Basic thought based on the Research on threshold selection of histogram envelope line is that histogrammic for image statistics envelope is fitted to a smooth curve, finds the minimum point of smooth curve to be the optimal segmenting threshold of background and edge line.First Threshold segmentation module adopts the method for differential to obtain local maximum, then these local maximums is fitted to smooth curve again.When carrying out curve fitting, directly do not realize least square fitting process by VC++, such computation process is very complicated, and calculated amount is very large.But adopt matlab programming, realized by the com component of VC++ and matlab hybrid programming, substantially reduce calculated amount.The method is very simple, and it is accurate to ask for threshold value for background and the larger situation of target contrast.See Fig. 4, specific implementation process is as follows:
A, first draw the statistic histogram of the new images that edge extracting module obtains, in statistic histogram P (i) for gray level on image be the pixel number of i;
B, by smoothing for statistic histogram filtering, that is:
P ( i ) = ( P ( i - u ) + P ( i - u + 1 ) + . . . . . . P ( i - 2 ) + P ( i - 1 ) + P ( i ) + P ( i + 1 ) + P ( i + 2 ) + . . . . . . + P ( i + u ) ) / ( 2 u + 1 )
Wherein u is natural number, and its numerical value is determined according to actual needs, and the larger filter effect of u is better, but calculated amount also corresponding increase.General selection 1≤u≤(), selects u=2 in the present invention.
C, adopt first differential method obtain filtering after local maximum value set M (j) of statistic histogram, wherein j is the image intensity value that Local modulus maxima is corresponding.
D, local maximum value set M (j) is delivered to matlab by com component carries out curve fitting, obtain curve minimum point after matching, then transmit back VC++, namely draw optimal segmenting threshold T.
After threshold calculations completes, utilize binary conversion treatment f ( i , j ) = N h f ( i , j ) > T 0 f ( i , j ) < T Realize Threshold segmentation.Wherein N hbe generally image maximum gray scale.
Step (4): again edge extracting is carried out to the image after Threshold segmentation
The edge line obtaining image after Threshold segmentation is comparatively thick, and in order to refinement edge line, second edge extraction module have employed one very simple effective method, namely again carries out the edge extracting process of above-mentioned steps (2).
Step (5): the image after edge connects carries out edge thinning
After above-mentioned steps, although the edge of the image drawn is almost single pixel, attach " burr " simultaneously.In order to remove these " burrs ", then take edge thinning process.The kind of edge thinning algorithm is a lot, can be divided into: sequential thinning, parallel thinning and mixing refinement according to the order of refinement.The thinning method that the present invention adopts belongs to sequential thinning, and its principle is the multiple elimination template of structure, is compared by the image after edge conjunction with template, determines whether delete certain point.The method that the present invention adopts not only can refinement thorough, the single pixel line after refinement is at the center line of grating grid edge line, and Glabrous thorn, ensure that next step accuracy calculated.
The method adopts 4*3 to eliminate template, as follows, by image with when eliminating template matching, eliminates the current point in the P5 correspondence image in template.This elimination template need meet some requirements.This template the condition that meets respectively:
P 1 P 2 P 3 P 4 P 5 P 6 P 7 P 8 P 9 P 10 P 11 P 12
4*3 formwork structure
A, suppose second edge extraction after image in pixel value be 0 use 0 represent, pixel value is N huse 1 represent.In the eight neighborhood of P5, the number of 1 is between 2 to 6, i.e. N=P 1+ P 2+ P 3+ P 4+ P 6+ P 7+ P 8, 2≤N≤6;
B, P2 and P8 have at least one to be zero, i.e. P2 × P8=0.
The eight neighborhood element of c, P5 circulates in the direction of the clock or counterclockwise circulation only has one 0,1 discontinuous point.
One is had at least to be zero in d, P4, P6 and P8, i.e. P4 × P6 × P8=0; Or P4, P5, P6, P9, P12, P11, P10, P7 eight elements circulate in the direction of the clock or counterclockwise circulation there is no 0,1 discontinuous point or have be greater than 10,1 discontinuous point.
Search for from binary image top left corner pixel, if current pixel value is 0, then skip, if current pixel value is N h, then this point corresponded to P5 and eliminate template matching, if to eliminate template identical with one of them, then this point deletion, sets to 0 by this pixel value, otherwise reservation.Repeat said process, until neither one pixel value is changed, edge thinning terminates.
Step (6): the image after edge refinement calculates
Finally extracted the edge line of grating grid accurately by the image processing method of above-mentioned five steps, the image after superposing with original image as shown in Figure 6.The image size of the CCD camera collection that the present invention adopts is 1392 pixel * 1040 pixels, comprises several grating grids, every bar grid line is evenly divided into 20 parts in image, asks every a grid line width.Then 20 grid line width are removed 5 maximal values, remove 5 minimum value, 10 of centre values are averaging and obtain the width of each grid line.All grid line width of entire image are removed 20 maximal values, removes 20 minimum value, then average, draw the average grating grid width of this image.The average pitch of scale grating obtained in Fig. 5 by above-mentioned computation process is 19.35um.

Claims (8)

1. an Image Edge Detector, is characterized in that comprising:
Image filtering module: filtering image noise obtains filtered image;
An edge extracting module: utilize double trapezoid arithmetic operators to extract the edge of image, the convolution mask of this operator is as follows:
G x = m 7 m 1 m 4 m 2 m 8 m 5 m 3 m 6 m 9 G y = m 1 m 2 m 3 m 7 m 8 m 9 m 4 m 5 m 6
Wherein: m 1~ m 9be all integer, G xthe arithmetic operators of horizontal direction, G ythe arithmetic operators of vertical direction, m 1=m 3=-m 4=-m 6, m 2=-m 5, m 2>=2 × m 1, m 5>=2 × m 4, m 7=m 9< 0,
M 8=-(m 7+ m 9)=-2 × m 7=-2 × m 9, | m 7|≤| m 1|; If the minor increment in image between adjacent two edges is d, then when d<20 pixel, | m 1|=1 or 2,2≤| m 2|≤5; When d>=20 pixel, 2≤| m 1|≤5,5≤| m 2|≤10;
Filtered image and convolution mask are obtained a width new images as convolution algorithm;
Threshold segmentation module: the optimal segmenting threshold T of the new images selecting edge extracting module to obtain, then makes binary conversion treatment to new images, the pixel being greater than optimal segmenting threshold T is put maximum gradation value N h, the pixel gray scale being less than optimal segmenting threshold T is set to 0, thus obtains a width binary image;
Second edge extraction module: utilize the method identical with edge extracting module again to carry out edge extracting to the image after Threshold segmentation;
Edge thinning module: carry out refinement to the edge that second edge extraction module is extracted, removes burr.
2. Image Edge Detector according to claim 1, it is characterized in that described Threshold segmentation module calculates new images statistic histogram, statistic histogram envelope is fitted to a smooth curve, then by the minimum point of smooth curve that finds as a setting with the optimal segmenting threshold T of edge line.
3. Image Edge Detector according to claim 2, is characterized in that described Threshold segmentation module is by smoothing for new images statistic histogram filtering, adopt first differential method obtain filtering after the local maximum value set of statistic histogram; Utilize local maximum value set to carry out curve fitting, after matching, obtain curve minimum point, and using gray-scale value corresponding for this curve minimum point as optimal segmenting threshold T.
4. Image Edge Detector according to claim 3, is characterized in that described Threshold segmentation module utilizes matlab to programme and carries out curve fitting.
5. Image Edge Detector according to claim 1, is characterized in that described edge thinning module stores has multiple 4 × 3 to eliminate template, and 4 × 3 elimination templates are as follows:
P 1 P 2 P 3 P 4 P 5 P 6 P 7 P 8 P 9 P 10 P 11 P 12
Eliminate template and meet following four conditions simultaneously:
A, P 5eight neighborhood element in have 2 ~ 6 elements to be 1, all the other elements are 0, namely
N=P 1+P 2+P 3+P 4+P 6+P 7+P 8,2≤N≤6;
B, P 2and P 8one is had at least to be zero, i.e. P 2× P 8=0;
C, P 5eight neighborhood element circulate in the direction of the clock or only have one 0 by counterclockwise circulation, 1 discontinuous point;
D, P 4, P 6and P 8in have at least one to be zero, i.e. P 4× P 6× P 8=0; Or P 8eight neighborhood element circulate in the direction of the clock or there is no 0,1 discontinuous point by counterclockwise circulation or have be greater than 10,1 discontinuous point;
Search for from binary image top left corner pixel, if current pixel gray-scale value is 0, then skip; If current pixel gray-scale value is N h, then this pixel is made to correspond to the element P eliminating template 5, by other pixels around this pixel with eliminate correspondence position element in template and compare, if to eliminate template identical with one of them, current pixel gray scale is set to 0, otherwise current pixel gray-scale value is constant; Repeat said process, until neither one grey scale pixel value is changed in binary image, edge thinning terminates.
6. one kind comprises the scale grating grid precision detection system of Image Edge Detector as described in claim as arbitrary in Claims 1 to 5, characterized by further comprising VTOL (vertical take off and landing) platform (1), be fixed on the CCD camera (2) on VTOL (vertical take off and landing) platform (1), be connected to the enlarging lens (5) in CCD camera (2), be arranged on the coaxial light source (6) on enlarging lens (5), image pick-up card (3), grid line width calculation module; The directional light that coaxial light source (6) sends out impinges upon the grid line district of scale grating (8) from the lens barrel of enlarging lens (5); CCD camera (2) gathers grating grid area image and sends image pick-up card (3) to; The raster image data of collection is transferred to Image Edge Detector by image pick-up card (3), Image Edge Detector extracts the grid line of raster image, in the image that Image Edge Detector detects by grid line width calculation module, every bar grid line is evenly divided into M part, tries to achieve every a grid line width; Then M grid line width is removed N number of maximal value, remove N number of minimum value, the M-2N of a centre value is averaging the width obtaining each grid line; All grid line width of entire image are removed Q maximal value, removes Q minimum value, then average, draw the average grating grid width of this image; Wherein M>2N, grid line number >2Q.
7. scale grating grid precision detection system according to claim 6, is characterized in that an edge extracting module of described Image Edge Detector adopts the arithmetic operators G of horizontal direction xa width new images is obtained as convolution algorithm with filtered image.
8. scale grating grid precision detection system according to claim 7, is characterized in that the horizontal direction arithmetic operators G extracting raster image informal voucher line left hand edge xzwith the horizontal direction arithmetic operators G extracting raster image informal voucher line right hand edge xyas follows:
G xz = - 1 - 2 2 - 8 2 8 - 2 2 - 1 G xy = - 1 2 - 2 8 2 - 8 2 - 2 - 1
CN201210427491.9A 2012-10-31 2012-10-31 Image Edge Detector and scale grating grid precision detection system Expired - Fee Related CN102999886B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210427491.9A CN102999886B (en) 2012-10-31 2012-10-31 Image Edge Detector and scale grating grid precision detection system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210427491.9A CN102999886B (en) 2012-10-31 2012-10-31 Image Edge Detector and scale grating grid precision detection system

Publications (2)

Publication Number Publication Date
CN102999886A CN102999886A (en) 2013-03-27
CN102999886B true CN102999886B (en) 2016-01-13

Family

ID=47928423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210427491.9A Expired - Fee Related CN102999886B (en) 2012-10-31 2012-10-31 Image Edge Detector and scale grating grid precision detection system

Country Status (1)

Country Link
CN (1) CN102999886B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103389041B (en) * 2013-07-30 2016-05-18 中节能太阳能科技(镇江)有限公司 A kind of method of measuring grid line width
CN105574816B (en) * 2014-10-13 2021-03-30 Ge医疗系统环球技术有限公司 Method and device for eliminating grid shadow of X-ray image and X-ray machine upgrading kit
CN106032967B (en) * 2015-02-11 2018-09-18 贵州景浩科技有限公司 The automatic multiplying power method of adjustment of electronic sighting device
CN105139391B (en) * 2015-08-17 2018-01-30 长安大学 A kind of haze weather traffic image edge detection method
CN105844593B (en) * 2016-01-25 2019-01-18 哈尔滨理工大学 A kind of single width interference pretreated automatic processing method of round bar line
CN105913067A (en) * 2016-04-18 2016-08-31 徐庆 Image contour characteristic extraction method and device
CN106546185B (en) * 2016-10-18 2019-09-20 福州觉感视觉软件科技有限公司 A kind of profile quality determining method based on Machine Vision Detection
CN107742283B (en) * 2017-09-16 2021-08-06 河北工业大学 Method for detecting defect of uneven thickness of grid line on appearance of battery piece
CN108024026B (en) * 2017-12-14 2019-06-28 广东金赋科技股份有限公司 A kind of document fast scanning method
US10636120B2 (en) 2018-02-01 2020-04-28 Ricoh Company, Ltd. Image scaling with quality control
CN108674026B (en) * 2018-05-16 2021-03-26 苏州迈为科技股份有限公司 Solar cell printing quality detection method and system
CN111402283B (en) * 2020-02-25 2023-11-10 上海航天控制技术研究所 Mars image edge characteristic self-adaptive extraction method based on gray variance derivative
CN111951234B (en) * 2020-07-27 2021-07-30 上海微亿智造科技有限公司 Model detection method
CN112414316B (en) * 2020-10-28 2022-04-08 西北工业大学 Strain gauge sensitive grid size parameter measuring method
CN117575886B (en) * 2024-01-15 2024-04-05 之江实验室 Image edge detector, detection method, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101289156A (en) * 2008-05-30 2008-10-22 浙江工业大学 Intelligent container sling based on omniberaing vision sensor
CN102393964A (en) * 2011-08-02 2012-03-28 中国科学院长春光学精密机械与物理研究所 Strip gap detection method
EP2293247B1 (en) * 2009-07-29 2012-09-05 Harman Becker Automotive Systems GmbH Edge detection with adaptive threshold

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102006026843A1 (en) * 2006-06-09 2007-12-20 Carl Zeiss Nts Gmbh Method for processing a digital gray value image

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101289156A (en) * 2008-05-30 2008-10-22 浙江工业大学 Intelligent container sling based on omniberaing vision sensor
EP2293247B1 (en) * 2009-07-29 2012-09-05 Harman Becker Automotive Systems GmbH Edge detection with adaptive threshold
CN102393964A (en) * 2011-08-02 2012-03-28 中国科学院长春光学精密机械与物理研究所 Strip gap detection method

Also Published As

Publication number Publication date
CN102999886A (en) 2013-03-27

Similar Documents

Publication Publication Date Title
CN102999886B (en) Image Edge Detector and scale grating grid precision detection system
CN102043950B (en) Vehicle outline recognition method based on canny operator and marginal point statistic
CN102914545B (en) Gear defect detection method and system based on computer vision
CN103942797B (en) Scene image text detection method and system based on histogram and super-pixels
CN109472761B (en) Cell counting method and system based on fluorescence image
CN107492091A (en) Label look detection method and terminal device based on machine vision
CN106446952A (en) Method and apparatus for recognizing score image
CN111145209A (en) Medical image segmentation method, device, equipment and storage medium
CN107633491A (en) A kind of area image Enhancement Method and storage medium based on target detection
CN108537787B (en) Quality judgment method for face image
CN105574527A (en) Quick object detection method based on local feature learning
CN109544564A (en) A kind of medical image segmentation method
CN104217213A (en) Medical image multi-stage classification method based on symmetry theory
CN105825169A (en) Road-image-based pavement crack identification method
CN104463138A (en) Text positioning method and system based on visual structure attribute
CN110335280A (en) A kind of financial documents image segmentation and antidote based on mobile terminal
CN103914829B (en) Method for detecting edge of noisy image
CN110276759B (en) Mobile phone screen bad line defect diagnosis method based on machine vision
CN105678737A (en) Digital image corner point detection method based on Radon transform
CN111489389A (en) Light spot center detection method
CN113393430B (en) Thermal imaging image enhancement training method and device for fan blade defect detection
CN104835155A (en) Fractal-based early-stage breast cancer calcification point computer auxiliary detection method
CN109543498A (en) A kind of method for detecting lane lines based on multitask network
CN108242060A (en) A kind of method for detecting image edge based on Sobel operators
CN109410233A (en) A kind of accurate extracting method of high-definition picture road of edge feature constraint

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160113

Termination date: 20171031

CF01 Termination of patent right due to non-payment of annual fee