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 (FIS)
-
Add EnumerateImages filter to get images from the directory.
-
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).
-
Fill capsule interior using FillRegionHoles filter.
-
Draw the found region on the input image using DrawRegions_Palette filter.