for region management, convert grayscale image to binary image
using otsu algorithm and extract edge from binary image.
some test code in WireMatching.cc