File Exchange

Modified Hausdorff Distance

version 1.1 (1.91 KB) by

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

Updated

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.
http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=576361

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

Format for calling function:

MHD = ModHausdorffDist(A,B);

where
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.

Rodrigo Perea

Rodrigo Perea (view profile)

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

Rodrigo Perea

Rodrigo Perea (view profile)

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
%REPLACE THIS--->
if tempdist < mindist
mindist=tempdist
end
<--WITH THIS:
mindist=tempdist

KaMu

Salim Arslan

Salim Arslan (view profile)

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

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

longan (view profile)

let me see,thank you anyway~

Yang

Yang (view profile)

OK，I know ，thank you!

Sasikanth

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.

 10 Jan 2011 1.1 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)