pyclustering  0.10.1
pyclustring is a Python, C++ data mining library.
pyclustering.nnet.syncsegm.syncsegm Class Reference

Class represents segmentation algorithm syncsegm. More...

Public Member Functions

def __init__ (self, color_radius, object_radius, noise_size=0, ccore=True)
 Contructor of the oscillatory network SYNC for cluster analysis. More...
def process (self, image_source, collect_dynamic=False, order_color=0.9995, order_object=0.999)
 Performs image segmentation. More...

Detailed Description

Class represents segmentation algorithm syncsegm.

syncsegm is a bio-inspired algorithm that is based on double-layer oscillatory network that uses modified Kuramoto model. Algorithm extracts colors and colored objects. It uses only CCORE (C++ implementation of pyclustering) parts to implement the algorithm.

CCORE option is True by default to use sync network in the pyclustering core - C/C++ shared library for processing that significantly increases performance.


# create oscillatory for image segmentaion - extract colors (radius 128) and objects (radius 4),
# and ignore noise (segments with size that is less than 10 pixels)
algorithm = syncsegm(128, 4, 10);
# extract segments (colors and objects)
analyser = algorithm(path_to_file);
# obtain segmentation results (only colors - from the first layer)
color_segments = analyser.allocate_colors(0.01, 10);
draw_image_mask_segments(path_to_file, color_segments);
# obtain segmentation results (objects - from the second layer)
object_segments = analyser.allocate_objects(0.01, 10);
draw_image_mask_segments(path_to_file, object_segments);

Definition at line 141 of file

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.nnet.syncsegm.syncsegm.__init__ (   self,
  noise_size = 0,
  ccore = True 

Contructor of the oscillatory network SYNC for cluster analysis.

[in]color_radius(double): Radius of color connectivity (color similarity) for the first layer.
[in]object_radius(double): Radius of object connectivity (object similarity) for the second layer, if 'None' then object segmentation is not performed (only color segmentation).
[in]noise_size(double): Size of segment that should be considered as a noise and ignored by the second layer.
[in]ccore(bool): If 'True' then C/C++ implementation is used to increase performance.

Definition at line 169 of file

Member Function Documentation

◆ process()

def pyclustering.nnet.syncsegm.syncsegm.process (   self,
  collect_dynamic = False,
  order_color = 0.9995,
  order_object = 0.999 

Performs image segmentation.

[in]image_source(string): Path to image file that should be processed.
[in]collect_dynamic(bool): If 'True' then whole dynamic of each layer of the network is collected.
[in]order_color(double): Local synchronization order for the first layer - coloring segmentation.
[in]order_object(double): Local synchronization order for the second layer - object segmentation.
(syncsegm_analyser) Analyser of segmentation results by the network.

Definition at line 192 of file

The documentation for this class was generated from the following file:
def draw_image_mask_segments(source, clusters, hide_axes=True)
Shows image segments using black masks.