White Patch filter for color normalization.
Inheritance: BaseInPlaceFilter
Beispiel #1
0
        public void ProcessImageTest()
        {
            double[,] diag = Matrix.Magic(5);

            Bitmap input;
            new MatrixToImage()
                {
                    Format = PixelFormat.Format24bppRgb
                }.Convert(diag, out input);

            var whitePatch = new WhitePatch();

            // Apply the filter
            Bitmap output = whitePatch.Apply(input);

            double[,] actual; 
            
            new ImageToMatrix().Convert(output, out actual);

            string str = actual.ToString(CSharpMatrixFormatProvider.InvariantCulture);

            double[,] expected = 
            {
                { 1, 0.968627450980392, 1, 1, 1 },
                { 0.972549019607843, 1, 1, 1, 1 },
                { 1, 1, 1, 0.984313725490196, 0.976470588235294 },
                { 1, 1, 0.988235294117647, 0.980392156862745, 1 },
                { 1, 0.992156862745098, 0.964705882352941, 1, 1 } 
            };

            Assert.IsTrue(expected.IsEqual(actual, 1e-6));
        }
Beispiel #2
0
        public void ApplyTest1()
        {
            Bitmap image = Properties.Resources.lena_color;

            // Create the White Patch filter
            var whitePatch = new WhitePatch();

            // Apply the filter
            Bitmap result = whitePatch.Apply(image);

            // ImageBox.Show(result);
            Assert.IsNotNull(result);
        }
 /// <summary>
 /// Applies White Patch filter for color normalization (Accord.NET function)
 /// </summary>
 /// <param name="img">image.</param>
 /// <param name="inPlace">Apply in place or not. If it is set to true return value can be omitted.</param>
 /// <returns>Processed image.</returns>
 public static Bgra<byte>[,] WhitePatch(this Bgra<byte>[,] img, bool inPlace = true)
 {
     WhitePatch wp = new WhitePatch();
     return img.ApplyFilter(wp, inPlace);
 }
Beispiel #4
0
 private void SetFilter()
 {
     ImageType = ImageTypes.Rgb24bpp;
     Af.WhitePatch newFilter = new Af.WhitePatch();
     imageFilter = newFilter;
 }