Hello,
I developed the following code in matlab.The code can find all the object that are white in the video, and define their centroid.My problem is that i want to draw lines between them and i dont know how.I would like some help.
Thanks in advance.

%5/07/2011
%Program Night

%Set the input source and its specifications-------------------------------
vid = videoinput('winvideo', '1', 'YUY2_640x480');
set(vid,'ReturnedColorSpace','rgb');
set(vid,'TriggerRepeat',Inf);
src = getselectedsource(vid);
%src.FocusMode = 'manual';
i=getsnapshot(vid);
pause(0.5)
%Crop the region of interest-----------------------------------------------

[i rect]=imcrop(getsnapshot(vid));
set(vid,'ROIPosition',rect);
%Create morphological structuring elemen-----------------------------------
se=strel('disk',2);
%Start the real time vid---------------------------------------------------
start(vid);
%Start the proccess
for i=1:600
tic
%Take the current snapshot and convert it into single frame----------------
im= getsnapshot(vid);
imrgb=im;
im=im(:,:,1);
im_bw=im2bw(im,0.98);
im_bw=bwareaopen(im_bw,80);
%Find the centroid of each region of interest-----------------------------
%Intensity-weighted centroids | Steve on Image Processing
L = bwlabel(im_bw);
s = regionprops(L, 'Centroid');
imshow(imrgb)
hold on
for k = 1:numel(s)

plot(s(k).Centroid(1), s(k).Centroid(2), 'r*')
end
hold off
%--------------------------------------------------------------------------

flushdata(vid)
end
stop(vid)