Exemple #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);
                }
            }
        }
        public static Boolean TryGrowAllCoordinates(float threshold, int N)
        {
            var coordinates = Dither.coordinates(N);

            foreach (Tuple <int, int> coord in coordinates)
            {
                if (TryGrowOneSegment(coord, threshold, N))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
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);
        }
Exemple #4
0
        public bool TryGrowAllCoordinates()
        {
            var coordinates = Dither.coordinates(N);
            var changed     = false;

            foreach (Coordinate coord in coordinates)
            {
                if (TryGrowOneSegment(coord))
                {
                    changed = true;
                }
            }

            return(changed);
        }