Binary Morphology, Edge Detection and Grouping methods in C#