本文整理汇总了C#中MagickWand.GetImageChannelMean方法的典型用法代码示例。如果您正苦于以下问题:C# MagickWand.GetImageChannelMean方法的具体用法?C# MagickWand.GetImageChannelMean怎么用?C# MagickWand.GetImageChannelMean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagickWand
的用法示例。
在下文中一共展示了MagickWand.GetImageChannelMean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintStats
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}");
}
示例2: ComposedTest
public void ComposedTest()
{
var contrastRatioThreshold = 0.5;
var tooContrastyThreshold = 1.9;
MagickWandEnvironment.Genesis();
PrintStatsHeader();
foreach(var file in _files)
{
using(var wand = new MagickWand(file))
{
double mean, stddev;
wand.GetImageChannelMean(ChannelType.AllChannels, out mean, out stddev);
PrintStats(file, wand);
wand.AutoLevelImage();
var contrastRatio = stddev / mean;
var contrastyRatio = stddev / 10000;
if(contrastRatio < contrastRatioThreshold)
{
var saturationAmount = Convert.ToInt32((contrastRatioThreshold - contrastRatio) * 100) * 4;
// limit the saturation adjustment to 20%
if(saturationAmount > 20)
{
saturationAmount = 20;
}
saturationAmount += 100;
Console.WriteLine("modulating by: " + saturationAmount);
// 100 = don't adjust brightness
// 300 = don't rotate hue
wand.ModulateImage(100, saturationAmount, 300);
}
else if(contrastyRatio > tooContrastyThreshold)
{
Console.WriteLine("attempting to reduce contrast");
wand.SigmoidalContrastImage(true, 2, 0); // smooth brightness/contrast
}
wand.UnsharpMaskImage(0, 0.7, 0.7, 0.008); // sharpen
WriteImage("composed", file, new string[] { }, wand);
}
}
MagickWandEnvironment.Terminus();
}