2D Distance Transform of Arbitrary Points

버전 1.0.0.0 (2.16 KB) 작성자: Tristan Ursell
Distance transform from arbitrary points at a user set resolution and range.
다운로드 수: 467
업데이트 날짜: 2012/3/16

라이선스 보기

Tristan Ursell
Distance Transform for Arbitrary Point Cloud
March 2012

[Xvec,Yvec,Dist]=clouddist(Xin,Yin,xlim,ylim,res);

The function creates a Euclidean distance transform from an arbitrary set of points, which is the in-plane distance to to closest point. This does not require the Image Processing Toolbox, and in fact, can be used as a more versatile version of 'bwdist' transform.

(Xin, Yin) are a list of input points from which to calculate the distance transform.

'xlim' and 'ylim' are each two component vectors that specify the extent of the distance transform calculation.

'res' sets the spatial resolution of the distance transform. For instance is the image goes from -1,1 in both X and Y, you might set res = 0.01, giving you 201 points along each dimension. Generally, good practice is the have 'res' set to be much less than the closest distance between any two points.

The output vectors 'Xvec' and 'Yvec' specify the exact points at which the distance transform 'Dist' has been calculated.

see also: bwdist

Example: general points in 2D

Xin=rand(1,50);
Yin=rand(1,50);
xlim=[-1/2,3/2];
ylim=[-1/2,3/2];
res=0.01;

[Xvec,Yvec,Dist]=clouddist(Xin,Yin,xlim,ylim,res);

figure;
hold on
imagesc(Xvec,Yvec,Dist)
plot(Xin,Yin,'wx')
title('Point Cloud Distance Transform')
xlabel('X')
ylabel('Y')
axis equal tight
box on

Example: mimicing the bwdist transform

Xin=ceil(249*rand(1,50));
Yin=ceil(199*rand(1,50));
xlim=[1,250];
ylim=[1,200];
res=1;

[Xvec,Yvec,Dist]=clouddist(Xin,Yin,xlim,ylim,res);

figure;
hold on
imagesc(Xvec,Yvec,Dist)
plot(Xin,Yin,'wx')
title('Point Cloud Distance Transform')
xlabel('X')
ylabel('Y')
axis equal tight
box on

인용 양식

Tristan Ursell (2024). 2D Distance Transform of Arbitrary Points (https://www.mathworks.com/matlabcentral/fileexchange/35668-2d-distance-transform-of-arbitrary-points), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Point Cloud Processing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0