示例#1
0
 public void Add(Object i)
 {
     List.Add(i);
 }
示例#2
0
 public void Remove(Object i)
 {
     List.Remove(i);
 }
示例#3
0
        public void ObjectIsolation()
        {
            numRows = image.Height;
            numCols = image.Width;
            data = image.LockBits(new Rectangle(0,0,numCols,numRows), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            stride=data.Stride;
            ptr=data.Scan0;
            nOffset=stride - image.Width*3;
            unsafe
            {
                byte* p;

                p = (byte*)(void*)ptr;
                //p+=stride;
                for (int y = 1; y < numRows - 1; y++)
                {
                    //p+=3;
                    for (int x = 1; x < numCols - 3; x++)
                    {
                        if ((p + x * 3 + stride * y)[0] == 0)
                        {
                            label++;
                            try
                            {
                                startY = 10000;
                                finalY = 0;
                                startX = int.MaxValue;
                                finalX = 0;
                                search(label, y, x);
                                Object singleObject = new Object();
                                singleObject.StartX = startX;
                                singleObject.StartY = startY;
                                singleObject.FinalX = finalX;
                                singleObject.FinalY = finalY;
                                singleObject.Label = label;
                                objects.Add(singleObject);
                            }
                            catch (System.StackOverflowException)
                            {
                                return;
                            }
                        }
                        //p+=3;
                    }
                    //p+=stride;
                }
                int t = 0;
                t++;
            }
            image.UnlockBits(data);
        }