anchor.diff:          print("Threshold value needs to be between 0 and 1")
           return
   
  -    print("Reading image: " + filename + " ...")
       image = io.imread(filename)
  -    print("Converting to grayscale...")
       gray_image = color.rgb2gray(image)
  -
  -    print("Thresholding image using threshold value: " + str(threshold) + " ...")
       binary = gray_image < threshold
  -
  -    print("Labeling all shapes..." )
       segmented, num_segments = label(binary)
   
  -    print("Listing shapes found...")
  -
  -    directory = os.path.splitext(filename)[0] # functions split path in two: file path and extension
  -    if os.path.exists(directory): # if directory with the name the same as file exists
  -        shutil.rmtree(directory) # delete it
  -
  -    makedirs(directory) # create new one
  -
       for i in range(1,num_segments+1):
  -        total_pixels_in_shape = sum(segmented == i) # get number of all pixels in shape
  -
  -        if total_pixels_in_shape > minimum_pixel_size: # if there is enough of them
  -            convex_hull = convex_hull_image(segmented == i) # calculate convex hull
  -            area = sum(convex_hull) # and get number of pixels inside it
  +        total_pixels_in_shape = sum(segmented == i)
  +
  +        if total_pixels_in_shape > minimum_pixel_size:
  +            convex_hull = convex_hull_image(segmented == i)
  +            area = sum(convex_hull)
               print("Shape number: " + str(i) +  " shape area (in pixels): " + str(area))
  -
  -            # pixels in convex hull are now either 0 or 1
  -            convex_hull = convex_hull * 255 # rescale each value so that they are  0 or 255 range (black or white in grayscale)
  -            shape_filename = directory + os.path.sep + str(i) + "_area_" + str(area) + ".jpg"
  -            io.imsave(shape_filename, convex_hull) # save under given filename
   
   
   if __name__ == "__main__":
  
positive.code: area = sum(convex_hull)
  ----
  
  Coin on the first image is a polish grosz, which has a diamater of 15,5 mm. Which gives area of 188,692 square milimeters. 
  Using minimum size in pixels = 20 and threshold value = 0.8 we get area of coin equal to 11771 pixels. 
  Using those two values we can compute conversion factor between pixels and square milimetres, 
  for this case one pixel is roughly equal to 0,016 square milimetres.
  
  By using objects with well-known dimensions we can compute conversion factor for other shapes on the image. 
   
  
  == Final code
  
negative.code: from skimage import io,  color
  from scipy.ndimage.measurements import label, sum
  from skimage.morphology import convex_hull_image
  
  
  def main():
  