I am doing some detection work using OpenCV, and I need to use the distance transform. Except the distance transform function in opencv gives me an image that is exactly the sam
I just figured this one out. The OpenCV distanceTransform
Calculates the distance to the closest zero pixel for each pixel of the source image.
and so it expects your edges image to be negative.
All you need to do is to negate your edges image:
edges = 255 - edges;