Opening and Closing by Area
Include <mln/morpho/area_filter.hpp>
-
Image{I}
image_concrete_t<I> area_opening(I f, Neighborhood nbh, int area, Compare cmp) -
Image{I}
image_concrete_t<I> area_closing(I f, Neighborhood nbh, int area) On binary images, the area connected opening that preserves connected components (blobs) of a minimum size. On grayscale images, it extracts connected image objects of higher intensity values than the surrounding objects. (The area closing is its complementary operator).
- Parameters:
f – Input image 𝑓
nbh – Elementary structuring element.
area – The minimal size of the blobs in order to be preserved
- Returns:
An image whose type is deduced from the input image
- Exception:
N/A
Notes
Complexity
Example: dense objects detection
// Make blobs connected
auto disc = mln::se::disc(2);
auto dil = mln::morpho::dilation(input, disc);
// Filtering
auto mask = mln::morpho::area_opening(dil, mln::c8, 2000);
// Mask
auto out = mask && input;
Given an original image. A dilation with a small disc allows to connect objects and we remove small connected components with an area opening. Finally, we just have to mask the input with the mask to get the objects in dense regions.