# mmdbeef
Detect the lean meat region in a beef steak image.

## Description

Beucher's paradigm is applied for delineating sharply the lean meat region in the beef steak image. An internal and an external marker are necessary for the filtering step of the paradigm. In this step, small regions that does not have meat are eliminated.

## Demo Script

### Reading

The gray-scale image of the beef steak is read.

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

    >>> mmshow(a);

a |

### Filtering

The input image is simplified by the application of a a small closing. The dark area (inner lean part) is closed from the fat white area.

    >>> b=mmclose(a,mmsedisk(2));

    >>> mmshow(b);

b |

### External marker 1/2

The external marker is built from the detection of the complete beef region and the extraction of its internal edge. As the beef is dark, it is detected by a low value threshold. After this threshold, small residual regions are eliminated by the binary areaclose operator.

    >>> c = mmthreshad(a,uint8(10));

    >>> d = mmareaclose(c,200);

    >>> mmshow(d);

d |

### External marker 2/2

The internal edge generated is 13 points thick. It is created by the residues of an erosion by a large structuring element.

    >>> e = mmgradm(d,mmsecross(1),mmsebox(13));

    >>> mmshow(e);

e |

### Internal marker

The internal marker is a severe erosion of the steak. Both markers are combined by union and displayed as overlay on the gradient image

    >>> f= mmero(d,mmsecross(80));

    >>> g = mmunion(e,f);

    >>> h = mmgradm(b);

    >>> mmshow(h,g);

h,g |

### Watershed

Constrained watershed of the gradient of the smoothed image, restricted to the internal and external markers

    >>> i=mmcwatershed(h,g);

    >>> mmshow(i);

i |

### Final result

Superposition of the dilated detected contour on the original image.

    >>> mmshow(a,mmdil(i));

a,mmdil(i) |

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