Compute distance of rectangle closest to rectangle

Also took values for Erode/Dilate and HSV from C version
Now works with test images