示例#1
0
        void Run()
        {
            MagickWandEnvironment.Genesis();

            var qr = (double)MagickWandEnvironment.QuantumRange;

            WriteLine(new string[] { "Quantum Range", $"{qr}" });
            Console.WriteLine();
            WriteLine(new string[] { "Image Name", "Mean", "StdDev", "Mean (pct)", "StdDev (pct)", "Kurtosis", "Skew" });

            foreach (var file in Directory.GetFiles(_opts.PhotoRoot))
            {
                double mean, stddev, kurtosis, skewness;

                using (var wand = new MagickWand(file))
                {
                    wand.AutoLevelImage();
                    wand.GetImageChannelMean(ChannelType.AllChannels, out mean, out stddev);
                    wand.GetImageChannelKurtosis(ChannelType.AllChannels, out kurtosis, out skewness);

                    WriteLine(new string[] { $"{Path.GetFileName(file)}", $"{mean}", $"{stddev}", $"{mean / qr}", $"{stddev / qr}", $"{kurtosis}", $"{skewness}" });
                }
            }

            MagickWandEnvironment.Terminus();
        }
示例#2
0
 void PrintStats(string file, MagickWand wand)
 {
     double mean, stddev, kurtosis, skewness;
     
     wand.GetImageChannelMean(ChannelType.AllChannels, out mean, out stddev);
     wand.GetImageChannelKurtosis(ChannelType.AllChannels, out kurtosis, out skewness);
     
     Console.WriteLine($"{Path.GetFileName(file)}\t{mean}\t{stddev}\t{kurtosis}\t{skewness}");
 }