Thresholding .pgm images, min-cut algorithm with edmonds karp