[mmdconcrete] [Up] [mmdcornea] Demonstrations

mmdcookies
Detect broken rounded biscuits.

Description

The input image is a gray-scale image of two rounded-shaped biscuits. One of them is broken. The purpose is to detect the broken biscuit.

Demo Script

Reading

The input image is read.

>>> a = mmreadgray('cookies.tif');

                  
>>> mmshow(a);

                
a

Thresholding

Convert to binary objects by thresholding

>>> b = mmthreshad(a, uint8(100));

                  
>>> mmshow(b);

                
b

Open tophat with large octagon disk

The tophat of the binary image by an octagon disk with a radius fits the good biscuit but does not fit in the broken biscuit can detect the broken one.

>>> c = mmopenth(b,mmsedisk(55,'2D','OCTAGON'));

                  
>>> mmshow(c);

                
c

Remove the residues

Clean the residues from the octagon disk and the rounded shaped biscuits by eliminating small connected regions

>>> d = mmareaopen(c,400);

                  
>>> mmshow(d);

                
d

Final display

Display the detected broken biscuit

>>> mmshow(a,d);

                
a,d

[mmdconcrete] [Up] [mmdcornea] Python