|[mmdcornea] [Up] [mmdfila]||Demonstrations|
In this example, an enlarged image of a fabric (with backlight illumination) is processed. The purpose is getting a quantitative index of the fabric quality. For that, fabric spaces are detected and measured.
The image to be processed is read.
>>> a = mmreadgray('fabric.tif');
A sequence of dilations (by a disk and two line segments) is applied to enhance the white stripes
>>> b = mmdil(a,mmsedisk(4));
>>> c = mmdil(b,mmseline(25,90));
>>> d = mmdil(c,mmseline(25,-90));
The markers are the regional minima with contrast 25.
>>> e = mmhmin(d,25);
>>> f = mmregmin(e);
Watershed of the original image from the dark stripes markers just created. Show the result overlayed on the original image.
>>> g = mmcwatershed(a,f);
The watershed of the gradient of the original image, taking the marker just created, gives the extend of the white regions.
>>> j = mmcwatershed(i,h,mmsebox());
Compute the area of each region and plot them. Also display the original image for illustration. From the plot, we can notice that the two rightmost weave spacing are significantly larger than the others.
|[mmdcornea] [Up] [mmdfila]|
|Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.|