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 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. 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.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 on the input image using DrawRegions_Palette filter.

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