コード例 #1
0
        public void BoxBlur_Test()
        {
            var sourceBitmap = Samples.sample03;

            Run("samples/sample03.png");

            var source = sourceBitmap.ToBytes();

            var channels = 4;

            var width  = sourceBitmap.Width;
            var height = sourceBitmap.Height;
            var n      = width * height;

            var linePrefixSums = new int[n * channels];

            UnoptimizedAlgorithms.LinePrefixSum(width, height, source, channels, linePrefixSums);

            var box     = new byte[n * channels];
            var boxSize = 5;

            UnoptimizedAlgorithms.BoxBlur(width, height, linePrefixSums, channels, box, boxSize);

            source.RunAsText(width, height, channels, "source.txt");

            box.RunAs(width, height, channels, $"box{boxSize}.png");
            box.RunAsText(width, height, channels, $"box{boxSize}.txt");
        }