File Exchange

image thumbnail

Modified Hausdorff Distance

version 1.1 (1.91 KB) by

This function computes the Modified Hausdorff Distance (MHD) as per Dubuisson et al.



View License

This function computes the Modified Hausdorff Distance (MHD) which is
proven to function better than the directed HD as per Dubuisson et al.
in the following work:

M. P. Dubuisson and A. K. Jain. A Modified Hausdorff distance for object
matching. In ICPR94, pages A:566-568, Jerusalem, Israel, 1994.

The function computed the forward and reverse distances and outputs the
minimum of both.

Format for calling function:

MHD = ModHausdorffDist(A,B);

MHD = Modified Hausdorff Distance.
A -> Point set 1
B -> Point set 2

No. of samples of each point set may be different but the dimension of
the points must be the same.

Comments and Ratings (8)

Rodrigo Perea

Sorry, disregard my previous comment (I don't know how to delete it).

Rodrigo Perea

I believe the code disagrees with the modHausdorff distance explanation in the paper cited.
The problem is that the code is summing all min distances (and not all distances within points)

Remove this (twice for A and B) and it should be simliar to the paper explanation
if tempdist < mindist


KaMu (view profile)

Salim Arslan

Thanks, it was really helpful. You can, however, replace the for loops with the following lines:

D = pdist2(A,B);

% Calculating the forward HD
mins = min(D, [], 2);
fhd = sum(mins) / Asize(1);

% Calculating the reverse HD
mins = min(D, [], 1);
rhd = sum(mins) / Bsize(1);

This will work much much faster but may need more memory to run for very large point sets.


shaho (view profile)

Hi, I have a question regrading about this function. Can you tell me how I can normalize the output for this output?


longan (view profile)

let me see,thank you anyway~


Yang (view profile)

OK,I know ,thank you!


Sasikanth (view profile)

An elementary correction has been made to the code in the last line where a 'min' instead of a 'max' has been submitted. Please note the correction.



Elementary Correction => 'min' of the last line in the code changed to 'max' as per the paper mentioned in the description.

MATLAB Release
MATLAB 7.10 (R2010a)

Inspired by: Hausdorff Distance, Hausdorff Distance

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video