algorithm - Matlab:椭圆voronoi图的算法

标签 algorithm math matlab ellipse voronoi

是否有任何算法可以实现以椭圆为界的 Voronoi 图?该图看起来像这里的图片 voronoi diagram of ellipses

http://www.loria.fr/~tzoumas/vorell/vorell01.png

谁能分享一些相关的链接、教程、代码等?

提前致谢。

最佳答案

这是一个使用 distance transform 的算法连同 watershed绘制椭圆 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

enter image description here

%# perform the distance transform
dt = bwdist(img);

enter image description here

%# 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)

enter image description here

关于algorithm - Matlab:椭圆voronoi图的算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7872968/

相关文章:

matlab - 以向量参数为函数,并以向量成员的任意子集作为参数定义新的匿名函数

algorithm - 在 Delaunay 三角剖分中重新定位点

c++ - 使用 "find"访问 vector 中的值

algorithm - 使用什么算法来计算 build 建筑物的最快顺序?

c - 这个 C 习语是什么意思?

无需绘图即可找到多项式的最大值/最小值的算法

php - 如何压缩一组唯一的自然数并比较两个这样的集合?

math - 如何在 Sage 中进行回归分析?

image - Matlab:在不同坐标上的单轴上绘制多个图像

Matlab - 检查函数句柄是否是特定函数或函数类型