# mmdlith
Detect defects in a microelectronic circuit.

## Description

The input image is a gray-scale image of a microelectronic circuit. The relevant objects in this image are vertical metal stripes. These stripes have some irregularities that should be detected. Our procedure takes the residues of a gray-scale closing and filter (by size) the threshold of the residues.

## Demo Script

### Reading

The input image is read. The image is also displayed as a surface model.

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

    >>> mmshow(a);

    >>> mmshow(mmsurf(a));

a | mmsurf(a) |

### Closing

Closing of the image by a vertical line of length 25 pixels. Then subtract it from the original. The sequence closing-subtraction is called closing top-hat. (This could be executed in a single command: c= mmcloseth(a, mmseline(25,90));).

    >>> b = mmclose(a,mmseline(25,90));

    >>> mmshow(b);

    >>> mmshow(mmsurf(b));

b | mmsurf(b) |

### Subtraction

Subtraction of the closing from the original is called closing top-hat. It shows the discrepancies of the image where the structuring element cannot fit the surface. In this case, it highlights vertical depression with length longer than 25 pixels.

    >>> c = mmsubm(b,a);

    >>> mmshow(c);

    >>> mmshow(mmsurf(c));

c | mmsurf(c) |

### Thresholding and Area Open

Threshold on the residues image. Elimination of the small objects by area open.

    >>> d = mmcmp(c,'>=',50);

    >>> e = mmareaopen(d,5);

    >>> mmshow(d);

    >>> mmshow(e);

d | e |

### Final display

Overlay the detected defects over the original image, and over the surface display.

    >>> mmshow(a,e);

    >>> mmshow(mmsurf(a),e);

a,e | mmsurf(a),e |

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