Summary of the invention
The technical problem to be solved in the present invention is to provide the droplet size measuring method that a kind of measuring accuracy is high.In addition, also provide a kind of droplet size measuring system.
For solving the problems of the technologies described above, the invention provides a kind of measuring method of droplet size, the method comprises:
Image smoothing step, it is for reducing noise, to obtain smoothed image f
1(x, y);
Compute gradient amplitude and direction step;
Non-maximum value suppresses step, for the ridge band to magnitude image, carries out refinement, only retains the pixel of amplitude localized variation maximum in magnitude image;
Dual threshold is processed and edge Connection Step, for removing false edge and real edges being coupled together, obtains drop edge image;
Image thinning step, for obtaining the image that image border is single pixel scale, thereby obtains the peripheral profile of drop;
According to the peripheral profile of described drop, obtain the take pixel drop height H that is unit, the number of pixels of every a line, and cross-sectional diameter, obtain the volume of drop by following formula:
Wherein, A
irepresent cross-sectional area; Δ H refers to two height values between continuous drop xsect.
Preferably, the measuring method of droplet size according to claim 1, is characterized in that, described image smoothing step refers to carries out process of convolution by original image and Gaussian function.
Preferably, the measuring method of droplet size according to claim 1, is characterized in that, in described compute gradient amplitude and direction step, establishes the x direction of two-dimensional Gaussian function and the first order derivative of y direction as shown in formula (1):
By described formula (1) respectively with described smoothed image f
1(x, y) carries out convolution, obtains Grad in x direction and the Grad in y direction:
Amplitude and the direction that can obtain image gradient are respectively:
Wherein, (x, y) represents certain pixel; M (x, y) is defined as the amplitude of image gradient; θ (x, y) is defined as the direction of image gradient; E
x(x, y) represents the Grad in x direction; E
y(x, y) represents the Grad in y direction; K is constant.
Preferably, the measuring method of droplet size according to claim 1, is characterized in that, described non-maximum value suppresses step and comprises: the scope of determining the gradient direction θ (x, y) of pixel (x, y); The variation range of described gradient direction θ (x, y) is divided into 4 sectors; By described pixel (x, y) the described gradient amplitude M (x locating, y) with described gradient direction θ (x, y) gradient magnitude of two of sector, place neighbor pixels compares, if described pixel (x, y) the described gradient amplitude M (x locating, y) be less than or equal to this pixel (x, y) gradient magnitude of two of sector, gradient direction place consecutive point, described pixel (x, y) being labeled as non-marginal point, is 0 by described M (x, y) assignment; Otherwise described pixel (x, y) is labeled as candidate marginal, the value of described M (x, y) remains unchanged.
Preferably, the measuring method of droplet size according to claim 1, is characterized in that, described dual threshold process and edge Connection Step in, by the accumulation histogram of magnitude image, obtain a high threshold T
h, then obtain a low threshold value T
l=0.4T
h; Each pixel (x, y) suppressing in the image after step process through described non-maximum value is detected, if (x, y) gradient magnitude is greater than high threshold T
h, think that this pixel one is decided to be marginal point; If the gradient magnitude of pixel (x, y) is less than low threshold value T
l, think that this pixel is marginal point scarcely; Pixel for gradient magnitude between two threshold values, sees in eight adjacent pixels points of this pixel whether be greater than the pixel of high threshold, if had, this pixel is edge so, otherwise is not just edge; Finally, the real edges after dual threshold processing is coupled together.
Preferably, the measuring method of droplet size according to claim 1, is characterized in that, described image thinning step refers to the thinning method based on concordance list, whether it looks into described concordance list according to the situation of wanting eight neighborhoods of refinement pixel, decide this pixel should delete.
In addition, the present invention also provides a kind of droplet size measuring system, and it comprises CCD camera, computing machine with camera lens; Described computing machine is carried out said method.
Compared with prior art, the present invention has the following advantages:
The present invention combines the feature that image is processed, adopt image smoothing step, compute gradient amplitude and direction step, non-maximum value to suppress step, dual threshold processing and edge Connection Step and image thinning step, can rely on image processing means to obtain the accurate numerical value of droplet size.
Embodiment
Below in conjunction with concrete drawings and Examples, the present invention is described in detail.
The droplet size measuring method of the embodiment of the present invention detects drop image border based on Canny criterion, then according to the drop edge (being also drop profile) obtaining, finally obtains the volume of drop.Wherein, Canny criterion is three criterions that a best edge detection operator of Canny proposition should meet, also: want accurately and single edges response criteria good testing result, the location of edge.Canny edge detection operator is the multistage edge detection algorithm that John F.Canny developed in 1986.
Fig. 1 has shown that the present invention processes input picture and the final schematic diagram that obtains image border.Comprising image smoothing step, compute gradient amplitude and direction step, non-maximum value, suppress step, dual threshold processing and edge Connection Step and image thinning step.For each step, be described in detail below.
image smoothing step
The object of picture smooth treatment is that the original image of input is processed to reduce noise, to be subject to during computed image gradient noise minimum.Smooth function is used Gaussian function, and its form is as follows:
Wherein, the mean square deviation that σ is Gaussian function, σ gets 1 in embodiments of the present invention.
If original image is f (x, y), smoothed image f
1(x, y) represents, is the convolution of original image and Gaussian function, that is:
f
1(x,y)=f(x,y)*g(x,y)
Due to symmetry and the decomposability of Gaussian function, g (x, y) can be decomposed into two one dimension Gaussian functions of x direction and y direction.The convolution of original image and two-dimensional Gaussian function can be simplified with following methods, and original image first carries out convolution with the one dimension Gaussian function of x direction, and then carries out convolution with the one dimension Gaussian function of y direction.
the amplitude of computed image gradient and the step of direction
Because two-dimensional Gaussian function has symmetry and decomposability, so can obtain by calculating the convolution of the directional derivative of Gaussian function in either direction and image amplitude and the direction of image gradient.
Adopt ranks wave filter the first order derivative of Gaussian function to be decomposed into the ranks wave filter of two one dimensions, can improve arithmetic speed like this.The x direction of two-dimensional Gaussian function and the first order derivative of y direction are as shown in formula (1):
By formula (1) respectively with f
1(x, y) carries out convolution, obtains Grad in x direction and the Grad in y direction:
Amplitude and the direction that can obtain image gradient are respectively:
Wherein, M (x, y) is defined as the amplitude of image gradient, namely the amplitude of the gradient of original image f (x, y); θ (x, y) is defined as the direction of image gradient, namely the direction of the gradient of original image f (x, y), the i.e. deflection of pixel; E
x(x, y) represents the Grad in x direction; E
y(x, y) represents the Grad in y direction; K is constant.
non-maximum value suppresses step
M (x, y) value shows that more greatly corresponding image gradient value is larger, but this is not enough to determine pixel (x, y) whether be marginal point, in order determining more accurately, must to carry out refinement to the ridge band in magnitude image by marginal point, only to retain the pixel of amplitude localized variation maximum.Wherein, magnitude image (that is: gradient amplitude image) is exactly M (x, y) image.Ridge band refers to the region, image border of similar ridge-shaped.Refinement is to realize by the amplitude of image gradient being carried out to non-maximum value inhibition processing.Non-maximum value suppresses to obtain refinement edge by suppressing the gradient magnitude of all non-ridge peak values on gradient direction.Non-maximum value Restrainable algorithms is as follows:
For each pixel (x, y), first determine the scope of this deflection θ (x, y).The variation range one of deflection is divided into 4 sectors, as shown in Figure 2.
These four sector numbers are 0,1,2,3.By described pixel (x, y) the gradient amplitude M (x, y) locating compares with the gradient magnitude of two neighbor pixels of sector, its gradient direction θ (x, y) place, if described pixel (x, y) the gradient amplitude M (x, y) locating is less than or equal to the gradient magnitude of two consecutive point of this sector, pixel (x, y) gradient direction place, described pixel (x, y) be labeled as non-marginal point, M (x, y) assignment is 0; Otherwise described pixel (x, y) is labeled as candidate marginal, the value of M (x, y) remains unchanged.Result after non-maximum value suppresses processing is designated as N (x, y).Real edge is just included in that in N (x, y), those are worth in non-vanishing pixel, has also comprised a large amount of false edges in these points simultaneously.
dual threshold is processed and edge Connection Step
The object that dual threshold is processed is to remove false edge.In order to judge false edge and real edges, N (x, y) is carried out to thresholding processing, i.e. a given threshold value, is real marginal point higher than the pixel of threshold value, lower than the pixel of threshold value, is false edge.But owing to using a fixing threshold value, threshold value is too high or too low all affects final result of determination.For addressing this problem, the dual threshold method that embodiments of the invention adopt Canny to propose, that is: the accumulation histogram by magnitude image obtains a high threshold T
h, then obtain a low threshold value T
l=0.4T
h.Wherein, accumulation histogram representative image constituent is in the accumulated probability distribution situation of gray level, and each probable value representative is less than or equal to the probability of this gray-scale value; Accumulation histogram is prior art, is also a kind of very basic method in graphical analysis.First dual threshold facture detects each pixel (x, y) in N (x, y), if (x, y) gradient magnitude is greater than high threshold T
h, think that this pixel one is decided to be marginal point; If the gradient magnitude of pixel (x, y) is less than low threshold value T
l, think that this pixel is marginal point scarcely; Pixel for gradient magnitude between two threshold values, sees in eight adjacent pixels points of this pixel whether be greater than the pixel of high threshold, if had, this pixel is edge so, otherwise is not just edge.Finally, the real edges after dual threshold processing is coupled together.
image thinning step
Through above-mentioned treatment step, the image obtaining is that (what pixel value was 1 is the part that needs refinement to bianry image, and what pixel value was 0 is background area.), can obtain a reasonable edge detection results, but export edge, be not single pixel scale, but have certain width.The object of image thinning is to obtain the image that image border is single pixel scale.In order to obtain the edge detection results of single pixel scale, continue the edge of output to carry out image thinning operation, can obtain the edge of extraordinary single pixel scale.A simple image thinning operation as shown in Figure 3.
Fig. 4 has shown the schematic diagram that is obtained the step of liquid profile by drop image.Embodiment provided by the invention adopts the thinning algorithm based on concordance list to process through Canny operator and processes the drop edge image (being profile matching) obtaining.So-called refinement is exactly through peeling off from level to level, is keeping under the prerequisite of image original form, adopts thinning algorithm from original image, to remove some points, until obtain the skeleton of image.Thinning algorithm meets convergence requirement, thereby can guarantee the connectedness of fine rule after refinement, and keeps the basic configuration of former figure, and can also reduce the distortion of stroke intersection; Result after refinement is exactly the center line that has retained original image; Rapidity and the iterations of refinement are few.
Whether the thinning algorithm based on concordance list, according to certain basis for estimation, is made a concordance list, then according to the situation of wanting eight neighborhoods of refinement pixel, looks into concordance list, decide this pixel should delete.Described basis for estimation is described as: (1) internal point can not be deleted; (2) isolated point can not be deleted; (3) straight line end points can not be deleted; (4) if certain some P is frontier point, remove after P, if connected component does not increase, P can delete.Due to 8 neighborhoods of a pixel have in 256 may situation, the size of concordance list is generally 256, in table, element value is set to 1, is illustrated under this kind of neighborhood value condition, pixel should be deleted; Otherwise, should retain.Algorithm based on concordance list need to not judge computing when algorithm is carried out, and only need to table look-up, therefore fast than other algorithms.
Obtain, after the peripheral profile of drop, can solving the volume that obtains drop, as shown in Figure 5, by the volume of each integral unit in cumulative figure, can obtain volume and the surface area of drop.
The drop profile being obtained by profile matching, the height that the poor Δ H(of drop height that to be easy to obtain to take pixel be unit is also profile, and cross-sectional diameter D above most and descend pixel ordinate value to subtract each other most of profile) and the number of pixels of every a line (profile be expert at the rightest and the most left pixel abscissa value subtract each other),
i, i=1,2 ..., N.Thereby can draw cross-sectional area A
i:
According to the method for numerical integration, cross-sectional area A can superpose
iobtain the volume of drop:
Wherein, Δ H refers to two height values between continuous drop xsect.In actual computation, can directly use 1 replacement, represent to calculate an integrated value at interval of a pixels tall.
What Fig. 5 showed is droplet size measuring system.With the CCD camera of camera lens, catch the image of drop, the numerical information of this image is passed to computing machine.Computing machine utilizes said method to process image, draws accurate droplet size.
checking
Adopt the steel ball of diameter 5mm to replace drop to carry out emulation experiment, outcome measurement error is 0.13%.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described.Although the present invention is had been described in detail with reference to embodiment, those of ordinary skill in the art is to be understood that, technical scheme of the present invention is modified or is equal to replacement, do not depart from the spirit and scope of technical solution of the present invention, it all should be encompassed in the middle of claim scope of the present invention.