public void NotFail()
        {
            var decoder = new PanasonicRW2Decoder();

            var file = new FileStream(@"..\..\..\PanasonicRW2.Tests\P1350577.RW2", FileMode.Open, FileAccess.Read);
            var exif = decoder.DecodeExif(file);
            var raw = decoder.DecodeMap(file, exif);

            var debayer = new AverageBGGRDemosaic();

            var stopwatch = Stopwatch.StartNew();
            const int maxIter = 3;
            var res = debayer.CreateResultMap(raw);
            for (var iter = 0; iter < maxIter; iter++)
                debayer.ProcessMap(raw, res);
            stopwatch.Stop();

            Console.WriteLine("AverageBGGRDebayer: " + stopwatch.ElapsedMilliseconds / 3 + "ms");
        }
        public void FullProcessWithAutoAdjustTest()
        {
            var       stopwatch = Stopwatch.StartNew();
            const int maxIter   = 5;

            for (var iter = 0; iter < maxIter; iter++)
            {
                var stream = new FileStream(@"..\..\..\PanasonicRW2.Tests\P1350577.RW2", FileMode.Open,
                                            FileAccess.Read);
                var debayer = new AverageBGGRDemosaic();

                var white = new WhiteBalanceFilter();
                //white.AutoAdjust(color16Image);
                var gamma = new GammaFilter();


                var light = new LightFilter();
                //light.AutoAdjust(color16Image);

                var compressor = new VectorBGRACompressorFilter();
                var filters    = new IFilter[]
                {
                    debayer,
                    //white,
                    gamma,
                    light,
                    compressor
                };

                var decoder = new PanasonicRW2Decoder();
                var exif    = decoder.DecodeExif(stream);

                var processor = new ImageProcessor(decoder.DecodeMap(stream, exif), filters);

                processor.Invoke();
            }
            stopwatch.Stop();
            Console.WriteLine("FullProcessWithAutoAdjust: " + stopwatch.ElapsedMilliseconds / maxIter + "ms");

            //Before Curve - Release 3756ms
            //After Curve - Release 1900ms
            //2015 Vector3 - Release 1305ms
        }
        public void NotFail()
        {
            var decoder = new PanasonicRW2Decoder();

            var file = new FileStream(@"..\..\..\PanasonicRW2.Tests\P1350577.RW2", FileMode.Open, FileAccess.Read);
            var exif = decoder.DecodeExif(file);
            var raw  = decoder.DecodeMap(file, exif);

            var debayer = new AverageBGGRDemosaic();

            var       stopwatch = Stopwatch.StartNew();
            const int maxIter   = 3;
            var       res       = debayer.CreateResultMap(raw);

            for (var iter = 0; iter < maxIter; iter++)
            {
                debayer.ProcessMap(raw, res);
            }
            stopwatch.Stop();

            Console.WriteLine("AverageBGGRDebayer: " + stopwatch.ElapsedMilliseconds / 3 + "ms");
        }
        public void FullProcessP1460461Test()
        {
            var       stopwatch = Stopwatch.StartNew();
            const int maxIter   = 1;

            for (var iter = 0; iter < maxIter; iter++)
            {
                var stream = new FileStream(@"..\..\..\PanasonicRW2.Tests\P1460461.RW2", FileMode.Open,
                                            FileAccess.Read);
                var decoder = new PanasonicRW2Decoder();
                var exif    = decoder.DecodeExif(stream);
                var raw     = decoder.DecodeMap(stream, exif);
                var debayer = new AverageBGGRDemosaic();

                var white = new WhiteBalanceFilter();
                //white.AutoAdjust(color16Image);
                var gamma = new GammaFilter();


                var light = new LightFilter();
                //light.AutoAdjust(color16Image);

                var compressor = new VectorBGRACompressorFilter();
                var pipeline   = new FiltersPipeline(new IFilter[]
                {
                    debayer,
                    white,
                    gamma,
                    light,
                    compressor
                });
                pipeline.ProcessFilters(raw);
            }
            stopwatch.Stop();
            Console.WriteLine("FullProcess: " + stopwatch.ElapsedMilliseconds / maxIter + "ms");

            //Before Curve - Release 3756ms
            //After Curve - Release 1900ms
        }
Exemple #5
0
        List <IFilter> PrepareFilters()
        {
            var debayer = new AverageBGGRDemosaic();

            var white = new WhiteBalanceFilter();

            white.WhiteColor = exif.WhiteColor.ToVector3();

            var gamma = new GammaFilter();
            var light = new LightFilter();

            var satur       = new SaturationFilter(3f);
            var colorMatrix = new ColorMatrixFilter
            {
                Matrix = new[, ]
                {
                    { 1.87f, -0.81f, -0.06f },
                    { -0.16f, 1.55f, -0.39f },
                    { 0.05f, -0.47f, 1.42f }
                }.ToMatrix4x4()
            };
            var compressor = new VectorBGRACompressorFilter();

            var filters = new List <IFilter>
            {
                debayer,
                white,
                gamma,
                //new RGB2YUVFilter(),
                light,
                satur,
                //new YUV2RGBFilter(),
                //colorMatrix,
                compressor
            };

            return(filters);
        }
        public void FullProcessTest()
        {
            var stopwatch = Stopwatch.StartNew();
            const int maxIter = 5;
            for (var iter = 0; iter < maxIter; iter++)
            {
                var stream = new FileStream(@"..\..\..\PanasonicRW2.Tests\P1350577.RW2", FileMode.Open,
                    FileAccess.Read);
                var decoder = new PanasonicRW2Decoder();
                var exif = decoder.DecodeExif(stream);
                var raw = decoder.DecodeMap(stream, exif);
                var debayer = new AverageBGGRDemosaic();
                var white = new WhiteBalanceFilter();
                //white.AutoAdjust(color16Image);
                var gamma = new GammaFilter();

                var light = new LightFilter();
                //light.AutoAdjust(color16Image);

                var compressor = new VectorBGRACompressorFilter();
                var pipeline = new FiltersPipeline(new IFilter[]
                {
                    debayer,
                    white,
                    gamma,
                    light,
                    compressor
                });
                pipeline.ProcessFilters(raw);
            }
            stopwatch.Stop();
            Console.WriteLine("FullProcess: " + stopwatch.ElapsedMilliseconds / maxIter + "ms");

            //Before Curve - Release 3756ms
            //After Curve - Release 1900ms
            //2015 - 409ms
        }
        List<IFilter> PrepareFilters()
        {
            var debayer = new AverageBGGRDemosaic();

            var white = new WhiteBalanceFilter();
            white.WhiteColor = exif.WhiteColor.ToVector3();

            var gamma = new GammaFilter();
            var light = new LightFilter();

            var satur = new SaturationFilter(3f);
            var colorMatrix = new ColorMatrixFilter
            {
                Matrix = new[,]
                    {
                        {1.87f, -0.81f, -0.06f},
                        {-0.16f, 1.55f, -0.39f},
                        {0.05f, -0.47f, 1.42f}
                    }.ToMatrix4x4()
            };
            var compressor = new VectorBGRACompressorFilter();

            var filters = new List<IFilter>
            {
                    debayer,
                    white,
                    gamma,
                    //new RGB2YUVFilter(),
                    light,
                    satur,
                    //new YUV2RGBFilter(),
                    //colorMatrix,
                    compressor
            };
            return filters;
        }