Els*_*sie 5 algorithm math matlab voronoi ellipse
是否有任何算法来实现限制省略号的Voronoi图?该图看起来像这里的图片是椭圆的voronoi图

任何人都可以分享一些与之相关的链接,教程,代码等吗?
提前致谢.
这是一种算法,它使用距离变换和分水岭算法绘制椭圆的Voronoi图.
%# first, define some ellipses (for simplicity, I use 0/90 orientation)
ellipses = [10,20,5,10;30,10,10,7;40,40,8,3];
%# put the ellipses into an image (few pixels, therefore pixelated)
img = false(50);
[xx,yy]=ndgrid(1:50,1:50);
for e = 1:size(ellipses,1),img = img | (xx-ellipses(e,1)).^2/ellipses(e,3)^2 + (yy-ellipses(e,2)).^2/ellipses(e,4)^2 <= 1;end
Run Code Online (Sandbox Code Playgroud)

%# perform the distance transform
dt = bwdist(img);
Run Code Online (Sandbox Code Playgroud)

%# apply the watershed algorithm.
%# ws==0 are the lines for the Voronoi diagram
ws = watershed(dt);
%# create a RGB image and display
%# note: for yellow lines, replace the last
%# "ws==0" by "zeros(size(ws))", so that you
%# only put ws into the red and green channel (=yellow)
rgb = cat(3,ws==0,ws==0,ws==0));
%# add the ellipses into the red channel
rgb(:,:,1) = rgb(:,:,1) | img;
imshow(rgb)
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
3233 次 |
| 最近记录: |