Path: news.mathworks.com!not-for-mail
From: "Tom Lane" <tlane@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Clustering a curve of 3d points
Date: Wed, 17 Jun 2009 10:32:53 -0400
Organization: The MathWorks, Inc
Lines: 33
Message-ID: <h1auql$f0a$1@fred.mathworks.com>
References: <h190uu$i3l$1@fred.mathworks.com>
Reply-To: "Tom Lane" <tlane@mathworks.com>
NNTP-Posting-Host: lanet.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1245249173 15370 172.31.57.151 (17 Jun 2009 14:32:53 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 17 Jun 2009 14:32:53 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:548308


> I'm trying to group a set of points distributed in 3d space. The points 
> come from a set of points that contain both true and false positives, and 
> I'm trying to weed out the false positives.
> The true positives should essentially describe a long curve through my 
> space.

Sven, there may well be a better way, but I do have one idea. Cluster 
analysis seeks to group points into clusters based on the distance between 
them. Single-linkage clustering seeks to avoid gaps at the expense of 
perhaps having a long cluster. So it might be able to find curves like the 
one you describe.

Try this on your data.

% Try single-linkage clustering in attempt to keep nearby points together
figure(1)
Y = pdist(found_pts(:,1:3));
Z = linkage(Y,'single');
dendrogram(Z,101,'colorthreshold',30);
t = cluster(Z,'cutoff',30,'criterion','distance')

% Plot points color-coded by cluster assignment
figure(2), hold on
cols = jet(max(t));
for i=1:max(t)
    idxs = t==i;
    plot3(found_pts(idxs,1), found_pts(idxs,2), 
found_pts(idxs,3),'.','Color',cols(i,:))
end

-- Tom