Changeset 93


Ignore:
Timestamp:
07/06/14 20:56:42 (10 years ago)
Author:
bduin
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • prextra/hausdm.m

    r5 r93  
    11%HAUSDM Hausdorff distance between datasets of image blobs
    22%
    3 %       [DH,DM] = hausdm(A,B,fid)
     3%       [DH,DM] = hausdm(A,B)
    44%
    55% Computes a Hausdorff distance matrix between the sets of binary images
    66% A and B, or datasets containing them as features.
    7 % Progress is reported in fid (fid = 1: on the sreeen).
    87% If A and B are image sets and
    98% size(A) is [may,max,na]
     
    2423% P.O. Box 5046, 2600 GA Delft, The Netherlands
    2524
    26 function [dh,dm] = hausdm(A,B,fid)
    27 if nargin < 3, fid = 0; end
     25function [dh,dm] = hausdm(A,B)
    2826
    29 if isdataset(A) & isdataset(B)
    30         [dh,dm] = hausdm(data2im(A),data2im(B),fid);
     27if isdataset(A) && isdataset(B)
     28        [dh,dm] = hausdm(data2im(A),data2im(B));
    3129        dh = setdata(A,dh);
    3230        dm = setdata(A,dm);
     
    3432end
    3533
    36 [ma1,ma2,na] = size(A);
    37 [mb1,mb2,nb] = size(B);
     34[dummy,dummy,na] = size(A);
     35[dummy,dummy,nb] = size(B);
    3836dh = zeros(na,nb);
    3937dm = zeros(na,nb);
     
    4543        K = [min(K):max(K)];
    4644        a = double(a(K,J));
    47         if length(a(:)) > 0
     45        if ~isempty(a(:))
    4846                a = bord(a,0);
    4947        end
     
    6159                K = [min(K):max(K)];
    6260                b = double(b(K,J));
    63                 if length(b(:)) > 0
     61                if ~isempty(b(:))
    6462                        b = bord(b,0);
    6563                end
     
    7371                dh(i,j) = max(max(min(dab)),max(min(dab')));
    7472                dm(i,j) = max(mean(min(dab)),mean(min(dab')));
    75 %               if fid, disp([i,j,dh(i,j),dm(i,j)]); end
    76                 fprintf(fid,'%5d %5d %10.3f %8.3f \n',i,j,dh(i,j),dm(i,j));
    7773        end
    7874end
Note: See TracChangeset for help on using the changeset viewer.