With the modified version of the code, not improved version as long as the change is.
function [MHD] = Modhausdorffdist (A, B)% A, point set 1%-B, point set 2% No. of samples of each point set May is different but the dimension of% the points must is the same.% Compute the sizes of the Input point setsasize = size (A); bsize = size (B);% Check If the points has the same dimensionsif asize (2) ~= bsize (2) error (' The dimensions of points I n the sets is not equal '); end% calculating the forward HDFHD = 0; % Initialize forward distance to 0for a = 1:asize (1)% travel the set a to find Avg of D (A, b) mindist = INF; % Initialize minimum distance to Inf for b = 1:bsize (1)% travel Set B to find the Min (d (b)) TEM Pdist = Norm (A (a,:) B (B,:)); If tempdist < mindist mindist = tempdist; End End FHD = FHD + mindist; % Sum The forward DISTANCESENDFHD = fhd/asize (1); % Divide by the total no to get average% calculating the reverse HDRHD = 0; % Initialize reverse distance to 0for B = 1:bsize (1)% travel the set B to find Avg of D (b,a) mindist = INF; % Initialize minimum distance to Inf for a = 1:asize (1)% travel set A to find the Min (d (b,a)) Tempdist = n ORM (A (a,:)-B (B,:)); If tempdist < mindist mindist = tempdist; End end RHD = RHD + mindist; % Sum the reverse DISTANCESENDRHD = rhd/bsize (1); % Divide by the total No. To get AVERAGEMHD = max (FHD,RHD); % Find the minimum of FHD/RHD as% the MoD Hausdorff distend
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Hausdorff distance-distance measurement between curve/point set