Thread: connect 2 centroid into line
-
July 13th, 2011, 12:26 PM #1Junior Member
- Join Date
- Jun 2011
- Posts
- 5
connect 2 centroid into line
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)
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Linksys Router to Internet to VPN Then Connect to Remote using Remote Desktop Connect
By easikwilson in forum Networking and InternetReplies: 10Last Post: November 30th, 2011, 01:33 PM -
Connect to modem but cannot connect to internet
By skiclou in forum Networking and InternetReplies: 6Last Post: September 7th, 2010, 01:49 PM -
Can Connect to Network, Can't Connect to Internet
By ReallyNeedHelp in forum Networking and InternetReplies: 3Last Post: August 12th, 2008, 10:02 PM -
Using a second wireless router to connect to connect up an XBox
By james789 in forum Networking and InternetReplies: 1Last Post: April 27th, 2008, 03:34 PM



LinkBack URL
About LinkBacks



Reply With Quote

Not in Flint, as I understand.
Is It Just Me? v233893843