コード例 #1
0
        // Contructor
        public SegmentationService(TiffImage image, int N, float threshold)
        {
            segmentation   = new Dictionary <Segment, Segment>();
            this.N         = N;
            this.threshold = threshold;

            var imageSize = (int)Math.Pow(2, N);

            pixelMap = new Segment[imageSize, imageSize];

            // init pixel map
            for (var x = 0; x < imageSize; x++)
            {
                for (var y = 0; y < imageSize; y++)
                {
                    var coordinate = new Coordinate {
                        X = x, Y = y
                    };
                    pixelMap[x, y] = new Pixel(coordinate, image.getColourBands(x, y));
                }
            }

            // run the whole algorithm
            GrowUntilNoChange();
        }