Пример #1
0
        public void AssignToBlobs(List <Point> points)
        {
            bool anyBlobFound = false;

            foreach (Point point in points)
            {
                MyBlob blob = NearestBlob(point);
                if (blob != null)
                {
                    if (distance(blob.LastPoint(), point) < 1000 && blob.found == false)
                    {
                        blob.addPoint(point);
                        //blob.Smooth();
                    }
                    else if (blob.found == false)
                    {
                        blobs.Add(new MyBlob(point, String.Format("{0}", index)));
                        index++;
                    }
                }
                else if (anyBlobFound == false)
                {
                    blobs.Add(new MyBlob(point, String.Format("{0}", index)));
                    index++;
                    anyBlobFound = true;
                }
            }
        }
Пример #2
0
        MyBlob NearestBlob(Point point)
        {
            double min = 10000;
            MyBlob tmp = null;

            foreach (MyBlob blob in blobs)
            {
                double dstTmp = distance(blob.LastPoint(), point);
                if (dstTmp < min)
                {
                    min = dstTmp;
                    tmp = blob;
                }
            }
            return(tmp);
        }