Hausdorff距离—曲线/点集间距离度量
2015-08-28 11:08
302 查看
附改进版代码,未改进版只要稍作改动即是。
function [ mhd ] = ModHausdorffDist( A, B ) % 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. % Compute the sizes of the input point sets Asize = size(A); Bsize = size(B); % Check if the points have the same dimensions if Asize(2) ~= Bsize(2) error('The dimensions of points in the two sets are not equal'); end % Calculating the forward HD fhd = 0; % Initialize forward distance to 0 for 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(a,B)) tempdist = norm(A(a,:)-B(b,:)); if tempdist < mindist mindist = tempdist; end end fhd = fhd + mindist; % Sum the forward distances end fhd = fhd/Asize(1); % Divide by the total no to get average % Calculating the reverse HD rhd = 0; % Initialize reverse distance to 0 for 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 = norm(A(a,:)-B(b,:)); if tempdist < mindist mindist = tempdist; end end rhd = rhd + mindist; % Sum the reverse distances end rhd = rhd/Bsize(1); % Divide by the total no. to get average mhd = max(fhd,rhd); % Find the minimum of fhd/rhd as % the mod hausdorff dist end
相关文章推荐
- 关于sp的(日记)
- 消息队列入门(一)关于消息队列
- ASP.NET - 获得客户端的 IP 地址
- 用报表系工具搭建证书查询系统示例
- spring mvc json乱码问题
- 整理分享ImageView属性大全
- Android基于各官方API实现分享功能(不使用第三方集成工具)
- 70 NSOperation基本使用
- 总结下常用的linux命令
- [转]安卓显示原理介绍
- myeclipse开发jar包not find总结(更新中)
- FreeRTOS队列接收
- 纯CSS标签tab
- 我的openwrt学习笔记(二十五):MTK7688 elian一键配置时间测量
- apk安装 手机没sd卡安装失败解决方案
- android——获取ImageView上面显示的图片bitmap对象
- 图像分割之(三)从Graph Cut到Grab Cut
- centos中修改fd限制
- C#比较两个日期的大小
- C++11 多线程2——Mutex的错误使用