Skip to main content

An image segmentation algorithm based on the watershed approach

Project description

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,

debug = 0,

)

shed.extract_data_pixels()

shed.display_data_image()

shed.mark_image_regions_for_gradient_mods() #(A)

shed.compute_gradient_image()

shed.modify_gradients_with_marker_minima() #(B)

shed.compute_Z_level_sets_for_gradient_image()

shed.propagate_influence_zones_from_bottom_to_top_of_Z_levels()

shed.display_watershed()

shed.display_watershed_in_color()

shed.extract_watershed_contours()

shed.display_watershed_contours_in_color()

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 and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page