Matching shapes with Hausdorff and Shape Context distance
I want to compute a distance between two shapes using the Hausdorff distance or shape context distance measure available in OpenCV 3.0. The shapes are simple white shapes on a black background.
In order to find the distance between two shapes, I find contours of each shape and then pass the contours two the following functions: ShapeDistanceExtractor::computeDistance(contours1, countours2)
and HausdorffDistanceExtractor::computeDistance(contours1, countours2)
.
Could anyone please explain to me, why during the comparison the ShapeDistanceExtractor always returns 0.0, whereas the second method gives me different results depending on the position of a character on the image?
I would like to highlight that I am using the Python version of OpenCV 3.0. I have just checked that in the C++ version everything seems to be working fine. Has anyone stumbled upon such a problem?
hmm, at least i can side your findings:
pretty weird, that the c++ version even has a different value for hausdorff distance:
Hmm, now it looks like a definite bug. I thought I passed some wrong arguments to the
computeDistance
function but I see I did it the same way as you.btw, i checked the generated wrapper function, it takes exactly the same default args as it's c++ counterpart. call me puzzled.