public static async void EqualizeHistogram(this Brush brush)
        {
            Bh.Initialize(brush);
            var histogram = new Histogram((ImageBrush)brush);

            var maxPixels = Bh.Width * Bh.Height;

            var dystR = HistogramHelper.GetDystrybuanta(histogram.HistogramR, maxPixels);
            var dystG = HistogramHelper.GetDystrybuanta(histogram.HistogramG, maxPixels);
            var dystB = HistogramHelper.GetDystrybuanta(histogram.HistogramB, maxPixels);

            var lutR = HistogramHelper.GetLutEqualization(dystR);
            var lutG = HistogramHelper.GetLutEqualization(dystG);
            var lutB = HistogramHelper.GetLutEqualization(dystB);

            for (var i = 0; i < Bh.Length; i += 4)
            {
                var rValue = Bh.Pixels[i + 2];
                var gValue = Bh.Pixels[i + 1];
                var bValue = Bh.Pixels[i];

                Bh.Pixels[i + 2] = (byte)lutR[rValue];
                Bh.Pixels[i + 1] = (byte)lutG[gValue];
                Bh.Pixels[i]     = (byte)lutB[bValue];
            }

            await Bh.UpdateBrush();
        }
        public static bool IsGrayscaled(this Brush brush)
        {
            Bh.Initialize(brush);

            for (var i = 0; i < Bh.Length; i += 4)
            {
                var r = Bh.Pixels[i + 2];
                var g = Bh.Pixels[i + 1];
                var b = Bh.Pixels[i];

                if (r != g || r != b || g != b)
                {
                    return(false);
                }
            }
            return(true);
        }
        public static async void AddPixelByValue(this Brush brush, float value)
        {
            bh.Initialize(brush);

            for (int i = 0; i < bh.Length; i += 4)
            {
                var r = Truncate(bh.Pixels[i + 2] + value);
                var g = Truncate(bh.Pixels[i + 1] + value);
                var b = Truncate(bh.Pixels[i] + value);

                bh.Pixels[i + 2] = r;
                bh.Pixels[i + 1] = g;
                bh.Pixels[i]     = b;
            }

            await bh.UpdateBrush();
        }
        public static async void MeanFilter(this Brush brush)
        {
            Bh.Initialize(brush);
            InitArrays();
            _width = Bh.Width * 4;
            var height = Bh.Height;

            for (int x = 1; x < height - 1; x++)
            {
                for (int j = 4; j < _width - 5; j += 4)
                {
                    int i = j + _width * x;
                    GoThroughMask(Mask.Mean, i, _width, 9);
                }
            }

            await Bh.UpdateBrush(_temp);
        }