I have a created function file in hand which is to draw lines in image,[img]=drawline(point1,point2,color,img)
. It\'s used to connect any two points that are inside
Assuming you have this drawline
function that draws lines in images, this is how you loop over the edges of Voronoi diagram of a set of points:
%# set of points and voronoi diagram
X = rand(10,1)*200; Y = rand(10,1)*200;
[vx,vy] = voronoi(X,Y);
%# vertices connecting the edges
p1 = [vx(1,:);vy(1,:)]; % columns are "from" points
p2 = [vx(2,:);vy(2,:)]; % columns are "to" points
%# draw edges on top of image matrix
img = zeros(200,200,3);
clr = [255 0 0];
for i=1:size(vx,2)
img = drawline(p1(:,i), p2(:,i), clr, img);
end