コード例 #1
0
        // draw the (top left corner of the) original image but with the segment boundaries overlayed in blue
        public void overlaySegmentation(string filename, int N, SegmentationService segmentation)
        {
            var newImage = new TiffImage(1 << N, 1 << N);

            var BLUE = unchecked ((int)0xFFFF0000); // ABGR

            for (var y = 0; y < newImage.height; y++)
            {
                for (var x = 0; x < newImage.width; x++)
                {
                    //var a = segmentation(x, y);
                    //var b = segmentation(x - 1, y);
                    //var c = segmentation(x, y - 1);
                    if (x == newImage.width - 1 || x == 0 || !segmentation.Segmentation(x, y).Equals(segmentation.Segmentation(x - 1, y)) ||
                        y == newImage.height - 1 || y == 0 || !segmentation.Segmentation(x, y).Equals(segmentation.Segmentation(x, y - 1)))
                    {
                        newImage.setColour(x, y, BLUE);
                    }
                    else
                    {
                        newImage.setColour(x, y, getColour(x, y));
                    }
                }
            }

            newImage.saveImage(filename);
        }