You are here: Start » Tutorial Exercises » Extracting Capsule Shape
Extracting Capsule Shape
Aim:
Develop a program to extract the region of a capsule from input images.
Input
A collection of images featuring a single capsule with various shape deformations.
Images are stored in extract_capsule directory.
Output
An input image with the capsule region highlighted.
Hints
This application demonstrates the fundamentals of Blob Analysis.
All capsules have continuous borders that can be easily found using the 2D Edge Detection technique.
Labeling connections is explained in this article.
Solution (FIS)
-
Add the EnumerateImages filter to the ACQUIRE section to load images from the directory.
-
Use the DetectEdges_AsRegion filter (PROCESS section) to identify the capsule boundaries. ClClose any discontinuities in the borders by setting 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 illustrates the detected edges after region dilation.
-
Fill the interior of the capsule using the FillRegionHoles filter.
-
Highlight the identified region on the input image using the DrawRegions_SingleColor filter.