Skip to main content

An image segmentation algorithm based on the watershed approach

Project description

Version 1.1 fixes a bug in the dilate() and erode() methods of the module that caused these methods to misbehave for non-square images. Version 1.1 also includes improvements in the explanatory comments included in the scripts in the Examples directory.

This module is a Python implementation of the Watershed algorithm for image segmentation. The goal of this module is not to compete with the popular OpenCV implementation of the watershed algorithm. On the other hand, the goal here is to provide an alternative framework that is more amenable to experimentation with the logic of watershed segmentation.

Typical usage syntax:

    from Watershed import *
    shed = Watershed(
               data_image = "orchid0001.jpg",
               binary_or_gray_or_color = "color",
               size_for_calculations = 128,
               sigma = 1,
               gradient_threshold_as_fraction = 0.1,
               level_decimation_factor = 16,
    shed.mark_image_regions_for_gradient_mods()                     #(A)
    shed.modify_gradients_with_marker_minima()                      #(B)

The statements in lines (A) and (B) are needed only for marker-assisted
segmentation with the module.  For a fully automated implemented of the
BLM algorithm, you would need to delete those two statements.

Project details

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page