Figure 7.26 - Silver-halide T-grain crystals analysis
This figure illustrates the analysis of Silver-halide T-grain crystals, where:
Image reading - The silver-halide-T-grain-crystals-in-emulsion gray-scale micrograph image is read (a). The crystals are surrounded by dark contour lines that are to be used for the watershed-based segmentation. The preprocessing stage is to enhance only these lines.
Illumination correction - The illumination gradient is estimated by an alternating sequential filtering with a large structuring element and a large stage (b). The input image is divided by this gradient estimation normalized by its minimum value (c). This division is used to guarantee that the dark contours have the same depths, so that in the dark regions of the image, the depths of the dark contours are increased by this procedure.
Contour enhancing - A classical close top-hat detects the dark contours. The size of the structuring element must be larger than the thickness of the dark contours (d). Note that the white areas of the image do not affect the detection of the dark contours.
Watershed segmentation - The purpose of the watershed transform is to detect the dividing lines of dark regions. In this case, it is not necessary to compute the gradient as the contour lines are already enhanced. We apply the classical minima simplification by cascading an area close and an -minima (e). The choice of parameters for the filters used in this simplification is very crucial and it has been found by trial and error. Application of the watershed on the simplified contour image gives the watershed lines (f).
Edge off - A procedure similar to removing grains connected to the image frame described in Fig. 3.15 is used (g). After that, the intersection of the watershed lines and the grains not connected to the image frame gives the final contour of grains not touching the image frame (h).
Display - For display purposes, the contours are overlaid on the original image (i).
1 import ia870 as MT 2 import ia636 as ia 3 import numpy as np 4 5 a = adreadgray('MVBook/crystals.png') 6 b = MT.iaasf(a,'oc',MT.iasedisk(2,'2D','octagon'),10) # background estimation 7 c = uint8(MT.iastats(b,'MIN')* a.astype('float') / b.astype('float')) 8 d = MT.iacloseth( c,MT.iasedisk(4,'2D','octagon')) 9 e = MT.iahmin(MT.iaareaclose(d,7),8) 10 f = MT.iawatershed(e) 11 g = MT.iainfrec(MT.iaframe(f),np.invert(f)) 12 h = MT.iaintersec(f,np.invert(MT.iaclose(g))) 13 14 adshow(a,'(a)') 15 adshow(b,'(b)') 16 adshow(c,'(c)') 17 adshow(d,'(d)') 18 adshow(e,'(e)') 19 adshow(MT.iapad(MT.ianeg(f)),'(f)') 20 adshow(MT.iapad(MT.ianeg(g)),'(g)') 21 adshow(MT.iapad(MT.ianeg(h)),'(h)') 22 z = h.astype('uint8') 23 z[z>0] = 255 24 adshow(MT.iaaddm(a,z),'(i)')