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

The set of images of a single capsule with various shape deformations.

Images are stored in extract_capsule directory.

Output

An input image with a capsule region drawn on it.

Hints

This application demonstrates the basics of Blob Analysis.

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

Labeling connections is explained in this article.

Solution (AVS)

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

  2. Find the capsule boundaries using the DetectEdges_AsRegion filter (PROCESS section). Close all discontinuous parts of borders by increasing inStdDevX to 3.0. Filter the selected edges to get only capsule borders by setting inEdgeThreshold to 6.0 and inEdgeHysteresis to 3.0.

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

  3. Fill capsule interior using FillRegionHoles filter.

  4. Draw the found region in the input image using DrawRegions_SingleColor filter.

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