Figure 7.19 - Image simplification
Watershed-based segmentation can be used for image simplification if the image pixels values are replaced by the mean gray-scale values of their corresponding catchment basins. An example of image simplification of a real-life image is shown in Fig. 7.19. For this example, the partition used in the image simplification is chosen from one scale of the dynamic-based hierarchical watershed. The morphological gradient of the input image is first filtered by area close with 10 pixels.
The dynamics of each regional minima of this filtered gradient are computed. It is possible to find the relationship between the contrast parameter of the h-minima filter and the number of output regions of the watershed applied to the result of this filter. The simplified image shown in Fig. 7.19 has been obtained by replacing the label of the catchment basin of the watershed by the average value of the original image pixels associated with that label.
1 import ia870 as MT 2 3 f = adreadgray('MVBook/jangada.png')[99:-50,:] 4 f = f[::2,::2] 5 g = MT.iaareaclose(MT.iagradm(f),10); 6 7 cb = MT.iawatershed(MT.iahmin(g,8),MT.iasecross(),option = 'REGIONS'); 8 g = MT.iagrain(cb,f,measurement = 'MEAN'); 9 10 adshow(f, '(a)') 11 adshow(g, '(b)')