You are here: Start » Tutorial Exercises » Extracting Capsule Shape (extract_capsule)

Extracting Capsule Shape (extract_capsule)

Aim

Devise a program which extracts the region of a capsule from the input images.

Input

A set of images of a single capsule with various shapes deformations.

Images are stored in extract_capsule directory.

Output

An input image with a capsule region drawn on it.

Hints

This application demonstrates basic elements of Blob Analysis.

All capsules have continuous borders. Borders can be easily found using 2D Edge Detection technique.

Solution (AVS)

  1. Add EnumerateImages filter to get images from the directory.

  2. Find the capsule boundaries using DetectEdges_AsRegion filter. Close all discontinuous parts of borders by increasing inStdDevX to 3.5. Filter selecting edges only to capsule borders by setting inEdgeThreshold to 6.0 and inEdgeHysteresis to 3.0.

    The image below shows found edges (after region dilation).

  3. Fill capsule interior using FillRegionHoles filter.

  4. Draw the found region on the input image using DrawRegions_Palette filter.

Main macrofilter finds the capsule region using 2D Edge Detection technique.