• No results found

Image analysis methods

An open source image analysis software ImageJ v.1.49 (Rasband, 1996/2016) was used.

The software is based on plugins and macros and has an extensive amount of already existing image analysis methods for different kinds of applications. It is also possible to write specific scripts and plugins in Java for the certain tasks.

3.3.1 Selection of methods

This PhD work started to study the model wastewater particles’ characteristics and encountered several problems, one of which being flocs overlapping on the images.

Overlapping of particles in the image results in a non-accurate recognition of objects and their

amounts, which leads to incorrect detection of the flocs’ geometrical characteristics. Therefore, alternative methods of flocs images characterisation were explored. Different texture image analysis techniques to correlate images of flocs with coagulant dosages were evaluated.

The texture analysis methods were not previously used for studying the images of coagulated particles in the approach of this PhD work, particularly for improving coagulant dosage control. Hence, this PhD research work is innovative in the perspective of texture image analysis methods applied to images of flocs in the coagulation-flocculation process.

We have tested simple statistical methods of image characterization like Histograms, to see if pure information from the image can be used. Since the GLCM method has documented its broad applicability of texture images characterisation in different fields of studies, we decided that the method might also be successfully applied to wastewater flocs images. GLCM was tried as the fairly old and proven technique. AMT was tested as a new and promising method of the images’ complexity characterisation. However, GLCM feature vectors as a result of image analysis are more intuitive to understand and interpret in comparison to AMT, which is a measure of spectrum complexity based on scale.

Our approach is to prove that images of flocs captured by the nonintrusive photographic method are descriptive in terms of coagulant dosage prediction. Thus, the technique could potentially be used for online coagulation dosage control. Advanced dosage control will then be possible by means of determining the lowest coagulant dosage, which leads to required solid-liquid and phosphorous separation.

3.3.2 Object recognition image analysis method

Particles recognition image analysis methods are often used for measuring particles size and dimensions. The sequence of actions for the particles characterisation presented in PaperIis illustrated in fig. 6.

All images were collected during the slow mixing period of coagulation. They were gathered in a stack in ImageJ. Then 3690 × 3690 pixels area was manually selected and cropped. A stack of images was converted to 8-bit grey scale. Plugin “Subtract Background”

was applied to images in order to equalise background pixel values for easier thresholding. If needed, brightness and contrast were adjusted. Onwards, thresholding was used to obtain binary images, with a threshold value estimated manually or by Otsu method (Otsu 1979).

Flocs within this transformation had greyscale value 0 – true black, while the background was set to value 255 – true white. Finally, plugin “Analyse particles” was applied to the binary images of flocs. Many geometrical and statistical parameters might be subtracted from the images of aggregates by this plugin. For this research, significant parameters of flocs were:

number of particles in the image, mean area, and perimeter of flocs. Knowing that 1230 pixels in the image equal 1 cm, we were able to recalculate flocs’ features from pixel values to quantitative values in centimetres.

Figure 6. Floc features detection procedure by image analysis. Numbers on the left image indicate 400 s after the start of slow mixing period, dose 0.29 mmol Al/l of PAX-XL61 coagulant

Mean fractal dimension of flocs was calculated in PaperI by the equation:

ܦ= 2 × log൫ܲ௣௜௫൯/ log(ܣ௣௜௫), (3) where Apix – mean area of particles, in pixels; Ppix – perimeter, a count of pixel edges; 2 is a constant number (Yu et al. 2009).

3.3.3 Image analysis by Grey level co-occurrence matrix (GLCM)

GLCM is one of the statistical methods for measuring texture in the image. Haralick et al. (1973) invented this method, which bases on spatial-dependence grey level co-occurrence matrix of pixels with estimation of image features using second-order statistics.

The size of GLCM is determined by the number of grey levels G in the image.

Typically, a 256 × 256 GLCM matrix is constructed for the 8-bit image (G=256). Figure 7a shows an example of 4 × 4 pixels image with grey level variations from 1 to 3. The GLCM (fig. 7b) was constructed from the image 7a and resulted in a matrix size 3 × 3, because the image has only three grey levels. Each value in the matrix is the number ܭ(݅,݆|ߠ,݀) of co-occurring grey level pixel-pairs (neighbours), where the first pixel has intensity i and the second has intensity j. Prior to constructing GLCM, two parameters should be decided – ߠ is the direction of pixel pairs, d is the distance between the pixels. In practice distance d is dependent on the resolution of texture (scale), while direction ߠ might have a significant influence on GLCM for textures with definite pattern structure. Figure 7c illustrates four unique directions 0°, 45°, 90° and 135° for the two-dimensional image. Blue arrow shows pixel-pair with direction 0° and distance 2. The example GLCM (fig. 7b) was constructed using ߠ= 0° and d = 1.

a) b) c)

Figure 7. The grey level co-occurrence matrix: a) pixel representation of an image; b) GLCM of an image; c) GLCM construction parameters ș (direction in degrees) and d (distance between the pixels)

The textural features (feature vectors) are calculated from GLCM (Haralick et al. 1973;

Zheng et al. 2006). ImageJ has a plugin “GLCM Texture” v.0.4, created by Julio E. Cabrera and further updated to “GLCM Texture Too” v. 0.008 by Toby C. Cornish. The output from the program can be given in 11 GLCM feature vectors, calculated for each image: Angular Second Moment (ASM), Contrast, Correlation, Inverse Difference Moment (IDM), Entropy, Energy, Inertia, Homogeneity, Prominence, Variance and Shade. The detailed description, explanation and equations for the above GLCM texture features can be found in the literature (Conners et al. 1984; Haralick et al. 1973; Zheng et al. 2006).

In Paper I all 11 textural features of the images were calculated and processed by multivariate analysis. The grey level co-occurrence matrixes were constructed for 4 directions ߠ (0°, 45°, 90° and 135°) and 5 distances d between the pixels (1, 2, 3, 5, 10), and the resulting values of feature vectors were analysed and compared.

It was found that direction ߠ and distance d do not have a significant effect on the textural features of flocs images, so in further research ߠ= 0° and d = 1. Some of the 11 textural features are highly correlated. Therefore, only feature vectors Contrast, Entropy, Homogeneity and Variance are used in PaperII, III and IV.

Contrast C is the amount of local grey level variations from one pixel to its neighbour:

ܥ=σ௜,௝(݅ െ ݆)݇(݅,݆) , (4) where k(i, j) is the relative frequency or, in other words, a normalised number K(i, j). k(i, j) is found by dividing K(i, j) with the sum of the co-occurrence matrix.

Entropy E is the measure of disorder in the image – statistical randomness:

ܧ=െ σ ݇௜,௝ (݅,݆) log൫݇(݅,݆)൯. (5) Homogeneity H is the measure of closeness of the values in GLCM to the diagonal. For the inhomogeneous image, H will be relatively lower than for homogeneous image, changing in the range from 0 to 1.

ܪ=σ

ଵା(௜ି௝)

௜,௝ ݇(݅,݆). (6) Variance V is the measure of deviations from the mean value of k(i, j) in the image (sum of squares):

ܸ=σ௜,௝(݅ െ ߤ)݇(݅,݆) , (7) where P is the mean value of k(i, j) in GLCM.