コード例 #1
0
 // get segment by indext. have to run after extraction
 public CSegment GetSegmentByIndex(int nIndex)
 {
     if (listFull.Count >= nIndex)
     {
         CSegment seg = listFull.ElementAt(nIndex);
         return(seg);
     }
     return(new CSegment());
 }
コード例 #2
0
        // Remove Rest Rectangle which occurs on the border.
        public void Remove_BoundingRect()
        {
            List <CSegment> listBuff = new List <CSegment>();

            for (int i = 0; i < listFull.Count(); i++)
            {
                CSegment seg = listFull.ElementAt(i);

                Rectangle rc = seg.RC;

                if (CRect.IsBoarderPosition(rc, mapW - 1, mapH - 1) == false)
                {
                    listBuff.Add(seg);
                }
            }
            listFull = listBuff.ToList();
        }
コード例 #3
0
        // Extract all the segements
        public void ExtractSegments(byte[] rawImage, int imageW, int imageH)
        {
            int nCurrPos = 0;
            int nCurrVal = 0;

            for (int y = 0; y < mapH; y++)
            {
                for (int x = 0; x < mapW; x++)
                {
                    if (map[y * imageW + x] == -1)
                    {
                        nCurrPos = y * imageW + x;
                        nCurrVal = rawImage[y * imageW + x];

                        List <Point> segment = ExtractSingleSegment(rawImage, imageW, imageH, x, y, nCurrVal);
                        CSegment     seg     = new CSegment(segment, this.INDEXER);
                        listFull.Add(seg);
                    }
                }
            }
        }
コード例 #4
0
        // get the color by index.
        public Color GetColorByIndex(int nIndex)
        {
            CSegment seg = listFull.ElementAt(nIndex);

            return(seg.c);
        }
コード例 #5
0
        // get segment points by index. have to run after extraction
        public List <Point> GetAllPointsByIndex(int nIndex)
        {
            CSegment seg = listFull.ElementAt(nIndex);

            return(seg.list.ToList());
        }