anchor.diff:  image:shapes_thresholded.jpg[Shapes thresholded,300]
   
   
  -
   [source,python]
   ----
   segmented, num_segments = label(binary)
   ----
   
  -*label* is a function from *scipy.ndimage.measurements* package. 
  +link:http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.measurements.label.html[label] is a function from *scipy.ndimage.measurements* package. 
   
   It assignes unique integer values to continuous patches of non-zero pixels. 
   Number of segments found is stored in *num_segments* variable. 
  
positive.code:     main()
  ----
  
  Once we have a valid input we can begin the fun stuff.
  First we need to load the image and turn it into grayscale:
  
  [source,python]
  ----
  
negative.code: ----
  
  Variable *gray_image* stores now grayscale image, each pixel has value in range from 0 to 1.
  Next the script performs tresholding of the image using provided treshold value:
  
  [source,python]
  ----
  