anchor.diff:      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:
  +Once script has a valid input we can begin the image processing.
  +First script needs to load the image and turn it into grayscale. This is done using link:http://scikit-image.org/docs/dev/api/skimage.io.html#imread[imread] and link:http://scikit-image.org/docs/dev/api/skimage.color.html#rgb2gray[rgb2gray] functions.
   
   [source,python]
   ----
  
positive.code: 
  == Python code step by step
  
  Our application will have input parameter provided from console. We will require:
  
  - path to the image file
  - integer indicating minimum size in pixels for a shape
  - float value between 0 and 1 as a threshold
  
  In the following block of code we check if user provided all the required parameters and whether they have valid values:
  
  [source,python]
  ----
  
negative.code: image:shapes_thresholded.jpg[Shapes thresholded,300]
  
  
  [source,python]
  ----
  segmented, num_segments = label(binary)
  ----
  
  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. 
  