# mmdpotatoes
Grade potato quality by shape and skin spots.

## Description

The input image is a gray-scale image of several washed potatoes. The shape of the potatoes is analysed using skeleton feature and the skin spots are detected. These two features can be used to evaluate their visual quality.

## Demo Script

### Reading

The input image is read.

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

    >>> mmshow(a);

a |

### Thresholding

Convert to binary objects by thresholding

    >>> b = mmthreshad(a,90);

    Warning: Converting input image from int32 to uint8.

    >>> mmshow(b);

b |

### Skeleton of the potato shapes

The binary image is thinned and the result overlayed on the original image

    >>> c = mmthin(b);

    >>> mmshow(a,c);

a,c |

### Closing tophat

To detect the skin spots, a closing tophat can enhance the dark areas of the image

    >>> d = mmcloseth(a,mmsedisk(5));

    >>> mmshow(d);

d |

### Thresholding and masking

The tophat is thresholded and the result is masked with the binary image of the potatoes as we are interested only on the spots inside them

    >>> e = mmthreshad(d,20);

    Warning: Converting input image from int32 to uint8.

    >>> f = mmintersec(e,b);

    >>> mmshow(f);

f |

### Final display

Show both results: skeleton and skin spots overlayed on the original image

    >>> mmshow(a);

    >>> mmshow(a,f,c);

a | a,f,c |

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