# mmdasp
Detect the missing aspirin tablets in a card of aspirin tablets.

## Description

The input image is the gray-scale image of an aspirin card (figure 1.3.a), with one tablet missing. The objective is detecting this missing tablet by exploring the particular gray-scale characteristics of this region of the image. Note that the tablets are circular large white areas of the image. This procedure explores the gray-scale area open operator. This is a very good illustration of image segmentation without the use of thresholding.

## Demo Script

### Reading

The aspirin tablet binary image is read.

    >>> a = mmreadgray('astablet.tif')

    >>> mmshow(a)

a |

### Gray-scale image as topographical surface

The image can be model as a topographical surface where white regions corresponds to high altitude and dark regions to lower altitute. The regional maxima of the image is normally very noisy as can be seen below.

    >>> b = mmsurf(a)

    >>> mmshow(b)

    >>> c = mmregmax(a,mmsebox())

    >>> mmshow(b,c)

b | b,c |

### Open by disk and regional maximum

Opening the original image by a disk a little smaller than the tablets removes all the noisy regional maxima. The only regional maxima in the opened image are the aspirin tablets as they are the only regionally brighter regions of shape larger than the disk of radius 20 pixels.

    >>> d = mmopen(a, mmsedisk(20))

    >>> e = mmsurf(d)

    >>> mmshow(e)

    >>> f = mmregmax(d,mmsebox())

    >>> mmshow(e,f)

e | e,f |

### Final result

Here it is shown the input and output result. Note that the binary image of the aspirin tablets was obtained using just one parameter: the radius of the circular structuring element. The problem was solved as treating the image formed by circular bright regions.

    >>> mmshow(a)

    >>> mmshow(f)

a | f |

[`mmdarea`] [Up] [`mmdlabeltext`] |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.