Пример #1
0
        // Try to grow the segments corresponding to every pixel on the image in turn
        // (considering pixel coordinates in special dither order)
        public void GrowAllCoordinates()
        {
            var seqOfGrowth = Dither.Coordinates(N);

            if (seqOfGrowth.Count != 0)
            {
                foreach (Coordinate coord in seqOfGrowth)
                {
                    GrowOneSegment(coord);
                }
            }
        }
Пример #2
0
        // Attempt to grow all segments in the segmentation.
        // Returns true if at least one segment was grown, ie. the segmentation should continue
        private bool TryGrowAllSegments()
        {
            // returns an array of coordinate pairs in dither order
            IEnumerable <Tuple <int, int> > coordsInDitherOrder = Dither.Coordinates(N);

            bool hasGrown = false;

            foreach (var coord in coordsInDitherOrder)
            {
                Segment segment = segmentation[coord.Item1, coord.Item2];
                hasGrown = TryGrowSegment(segment) || hasGrown;
            }
            return(hasGrown);
        }