Application of the Hough Transform to Dispersion Control of Overlapping Particles and Their Agglomerates

The dispersion control of micro-and nanoparticles by their images is of great importance for ensuring the specified properties of the particles themselves and materials based on them. The aim of this article was to consider the possibilities of using the Hough transform for dispersion control of overlapping particles and their agglomerates. Analysis of the application of the Hough transform for overlapping particles and their ag - glomerates showed the following. The particularities of the conventional implementation lead to the preferred registration of large particles, the shift of the centers of overlapping particles, and the distortion of the size values. To use the Hough transform correctly, fine-tuning of all its parameters is required. To automate this process, the dependences of the number and size of particles recorded in the image on the parameters of the Hough transform was investigated. The studies were carried out on test images with a known number and size of particles. The results showed that when the threshold parameters of the Hough transform change, the number of detected particles stabilizes near their optimal values. When the size range of particles detected by the Hough transform changes, the histogram of the particle size distribution changes. In this case, the optimal width of the range is determined by the most stable extremes of the histogram. The maximum center-to-center distance is set at least half of the optimal range. The configuration algorithm is described and implemented. It implies repeatedly running the Hough transform with different combinations of parameters. The algorithm includes stages of coarse and fine-tuning, which allows to getting closer to the optimal parameters. The ef - ficiency of the algorithm has been confirmed on test and real images. Tests have shown that the errors in de - termining the size and number of particles of the multi-pass Hough transform are on the same level or exceed these indicators for analog methods.


Introduction
The micro-and nanoparticles dispersion control is important to ensure the specified properties of particles and materials based on them.Traditionally, various types of microscopy associated with obtaining high-resolution images are used to dispersion control.Conventional methods [1] of processing such images imply segmentation, identification of objects and measurement of their sizes.Threshold filtering (binarization [2,3]) and contour analysis [4]) are the most common segmentation tools.However, the use of these tools reduces the accuracy of determining the size of overlapping particles and particles with varying degrees of brightness.There are more complex segmentation methods, for example, parametric [5], variational [6], neural network [7].These methods have significant limitations in application (complexity of implementation, high demands on computing resources) and are not always available in open libraries such as OpenCV.
The disadvantage of conventional image processing procedures is the necessity of manual parameter settings.At the same time, for automation of dispersion control, it is advisable to use methods with automatic parameters setting [8].In addition, as shown in [9], conventional methods for segmentation of overlapping and touching particles do not always determine their real contours.In this case, structural methods that can take into account the hidden part of the particle contour are more effective.Such methods include surface curvature detectors [10] and geometric shape detectors based on the Hough transform.Unlike curvature detectors, the Hough transform has found much wider application in commercial [11] and free software [12].The aim of this article was to consider the possibilities of using the Hough transform for particle dispersion control.

Problem definition
The scheme for calculating the distribution of il-luThe simplest case [13] of particle dispersion monitoring implies manual parameters adjustment and manual results filtering, more complex -the use of additional add-ons, such as neural networks [14], filters [15].However, this approach reduces the availability of the resulting software.The main task of this work is to develop an algorithm for automatically adjusting the parameters of the Hough transform without modifying the conventional implementation of the transform.This implementation generally includes the following procedure.1.To find the boundaries of objects in the image, contours are allocated using the Canny method.
2. The brightness gradient for the boundary points is calculated.
3. Rays perpendicular to the tangent to the boundary points and directed along the brightness gradient are plotted.
4. Candidate centers of circles are localized.These include the image pixels through which the largest number of rays have passed.
5. The dimensions of the circles are determined.Non-zero points are located around the candidate centers at a distance taking values from the minimum to the maximum allowable radius.The final radius of the circle is defined by the largest number of boundary points removed from the candidate center by the value of this radius.
The conventional implementation of the Hough transform in conditions of superposition of particles with a large size range, as well as in the presence of noise, may have the following disadvantages.
1. Incorrect localization of particle centers caused by in local gradient calculating errors (especially on small, low-contrast particles).
2. Inaccurate determination of the particle size in agglomerates caused by the fact that only one circle is assigned to each candidate center.
3. There is a preferred registration of large circles (pseudo-circles, fragments of circles), since for them the threshold of correspondence (coincidence) to the candidate center turns out to be greater than for small circles.
These disadvantages are partially eliminated by manually adjusting the parameters of the Hough transform.However, to do this, it is necessary to change up to five parameters at the same time, and this increases the processing time and the risks of human influence on the results.At the same time, there are examples of particle size control algorithms that do not require manual adjustment.These include neural networks, for example, ParticlesNN [16], and the ELSD method (ellipse and line segment detector, a detector of line segments and ovals) [8].The results of segmentation of images of overlapping particles (Figure 1a) using these methods are presented in Figure 1b,c and in Tables 1, 2. Four types of test images were used for evaluation: type 1 -a set of densely packed particles of the same size; type 2particles of three standard sizes with a low density of placement; type 3 -particles of three standard sizes with high density of placement; type 4 -particles of two standard sizes with a high density of placement.The 256×256 test images were formed from a background relief F[x,y], simulating the non-ideality of the scanner, and a particle image Q[x,y] with radius R 0 and coordinates (x 0 , y 0 , z 0 ): As Figure 1 shows, even the most modern means of dispersion control require some refinement:  The conventional implementation of the Hough transform, presented in the OpenCV library, involves setting five parameters: the center-to-center distance, the minimum R min and maximum R max radii of particles, the Canny threshold p 1 and the Hougt accumulator threshold p 2 .The value of p 1 determines the sensitivity of the Canny detector (the higher the value of p 1 , the lower the sensitivity).The value of p 2 determines the sensitivity of the Hough transform (the lower the value of p 2 , the more circles are registered).Studies have shown that the graphs of the dependence of the number N of registered circles on the values of p 1 , p 2 have stabilization zones outlined with a dashed line in Figure 2, which was obtained during image processing type 3 Figure 1a.These zones correspond to the optimal values of p 1 , p 2 .

Determining the size range and center-to-center distance
The range of the detected particles sizes (minimum R min and maximum R max sizes) significantly affects the results of the dispersion control.Too large a range of sizes in the presence of agglomerates and overlapping particles leads to the registration of pseudo-circles near the maximum values of the range.In this case, you can use the analysis of the histogram of the particle size distribution in pixels of the image (px).In particular, when changing the range in the histogram, those peaks (marked with arrows in Figure 3) that correspond to real particles will be stable.After specifying the size range of the recorded circles, the minimum center-to-center distance is set at a level that is at least half of the width of the range.

Parameters setting algorithm
Based on the studies described above, the algorithm for setting the parameters of the Hough transform (multi-pass Hough transform) can be formulated as follows.
Step 1.The p 1 value is adjusted.The image is processed with different p 1 values in the range from 1 to 300 in increments (50), with a minimum value of p 2 = 1.The stabilization zone is determined auto-matically based on the minimum change in the number of particles N with a change in p 1 (minimum of the first derivative).If there are several stabilization zones, p 1 is determined according to the minimum extremum of the number of particles (circles).
Step 2. Coarse adjustment of p 2 is carried out.The image is processed with different p 2 values in the range from 1 to 100 in increments (10).The range of the p 2 value is set in accordance with the stabilization zone (zone of minimal change) of the particles number.
Step 3. A histogram of the particle size distribution is formed.The range of particle sizes and the center-to-center distance is determined.
Step 4. Fine-tuning of p 2 is performed within the previously set range.The value of p 2 is increased with a small step (1) to stabilize the number of particles (clusters).
The results of comparing the multi-pass Hough transform with analogous methods are presented in tables 1, 2 (the results are obtained on test images presented in Figure 1a).The value of ε N in Table 1 was defined as the relative deviation of the number of detected particles N from the true value of N 0 : The value of ε R in Table 2 was defined as the relative deviation of the average measurement value R from the true value of the radius R 0 : Tables 1, 2 show that the accuracy indicators ε N , ε R of the multi-pass Hough transform on the test images are on the same level or exceed these indicators for analog methods.
For real images (Figures 4, 5), the stabilization zones available on the dependence graphs N (p 1 ), N (p 2 ) may be relatively narrow and not obvious.
Therefore, it is advisable to accompany the adjustment of these parameters by monitoring the absolute and relative values of the particles number.In particular, in Figure 4a, the relative stabilization zone is located in the range p 2 = 38-40 and is characterized by a minimal change in the particles number.At the same time, an estimation of the target range of the absolute value of the particles number can be obtained using the minimum R min and maximum R max values from the histogram, as well as the image sizes S×S in pixels: Figure 5a shows three stabilization zones, from which the first zone was automatically selected, focusing on the minimum deviation from the permissible number of particles N min = 164.The corresponding result is shown in Figure 5b.

Conclusion
The performed studies allowed to obtain the following results.When changing the threshold parameters of the Hough transform, zones of detected particles number stabilization are observed, which determine the optimal values of the transformation  parameters.At the same time, the histograms of the particle size distribution show distinct peaks corresponding to the marginal sizes of the detected particles and determining the range and minimum center-to-center distance of the Hough transform.
Based on the results obtained, an algorithm has been developed for automatically adjusting the parameters of the Hough transform.

Figure 1 -
Figure 1 -Particles detection in the source images (a) using a neural network (b), the ELSD method (c) and the multipass Hough transform (d)

Figure 2 -
Figure 2 -Examples of graphs of the dependence of the number of detected particles (image type 4 in Figure 1a): a -from the Canny threshold; b -from the Hough threshold

Figure 4 -Figure 5 -
Figure 4 -Relative stabilization of the number of silver nanoparticles (a) and results of particles detection in the image (b).Image from the NT-MDT Spectrum Instruments website: https://www.ntmdt-si.com/resources/scan-gallery