Demo iadbeef

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.

Script

Reading

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

1. from ia870 import *
2. 
3. a = adreadgray('beef.tif')
4. adshow(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.

1. b=iaclose(a,iasedisk(2))
2. adshow(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.

1. c = a >= 10
2. d = iaareaclose(c,200)
3. adshow(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.

1. e = iagradm(d,iasecross(1),iasebox(13))
2. adshow(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.

1. f = iaero(d,iasecross(80))
2. g = iaunion(e,f)
3. h = iagradm(b)
4. adshow(iagshow(h,g))

Watershed

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

1. i = iacwatershed(h,g)
2. adshow(i)

Final result

Superposition of the dilated detected contour on the original image.

1. adshow(iagshow(a,iadil(i)))