[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.

Illustrated Source Code

Reading

The input image is read.

Image a = mmReadgray("cookies.tif");
mmShow(a);

a

Thresholding

Convert to binary objects by thresholding

Image b = mmThreshad(a, 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.

Image 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

Image d = mmAreaopen(c, 400);
mmShow(d);

d

Final display

Display the detected broken biscuit

mmShow(a, d);

a, d

[mmdConcrete] [Up] [mmdCornea]