This content has been marked as final. Show 2 replies
Jan Carlo wrote:
> Hello to you.
> I am currently trying to remove noise in image sequences containing
> motion capture data. As a part of this project I am clustering pixels
> into groups and want to remove pixel groups with less than 4 members
> as these groups are regarded as noise.
> The problem is that when I have a nested list with e.g 3 sub
> lists/clusters (as indicated below) and I use a repeat loop to remove
> the sub lists with less than 4 pixel coordinates, but my code does
> not seem me to do this correctly (There are three sub lists where 2
> of these should be removed, but only 1 of these 2 are deleted while I
> am unable to remove the last one).
> Does anyone have any suggestions on how I can modify the current code
> so that it does the job correctly?
The problem is that you're deleting things from the list you're looking at
and things get moved towards the start, thus skipping an iteration you
wanted to examine. If you start at the end, you won't get that problem.
clusters = [ [point(477, 453), point(477, 459), point(477, 460),
point(478, 454), point(478, 456)], , [point(462, 405),point(462,
nMin = 4
repeat with i = nClusters down to 1
if clusters [ i ].count < nMin then
Thank you for your help:)