本文整理汇总了C#中System.Image.Split方法的典型用法代码示例。如果您正苦于以下问题:C# Image.Split方法的具体用法?C# Image.Split怎么用?C# Image.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Image
的用法示例。
在下文中一共展示了Image.Split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateHistogram
public void CreateHistogram(Image<Bgr, Byte> img)
{
Image<Gray, Byte>[] channels = img.Split();
Image<Gray, Byte> blueChannel = channels[0];
Image<Gray, Byte> greenChannel = channels[1];
Image<Gray, Byte> redChannel = channels[2];
//Red colour channel
DenseHistogram dhRed = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
dhRed.Calculate<Byte>(new Image<Gray, Byte>[1] { redChannel }, false, null);
redChart.ClearHistogram();
redChart.AddHistogram("Red Channel", System.Drawing.Color.Red, dhRed);
redChart.Refresh();
//Green colour Channel
DenseHistogram dhGreen = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
dhGreen.Calculate<Byte>(new Image<Gray, Byte>[1] { greenChannel }, false, null);
greenChart.ClearHistogram();
greenChart.AddHistogram("Green Channel", System.Drawing.Color.Green, dhGreen);
greenChart.Refresh();
//Blue colour Channel
DenseHistogram dhBlue = new DenseHistogram(BIN_SIZE, new RangeF(0.0f, BIN_DEPTH));
dhBlue.Calculate<Byte>(new Image<Gray, Byte>[1] { blueChannel }, false, null);
blueChart.ClearHistogram();
blueChart.Show();
blueChart.AddHistogram("Blue Channel", System.Drawing.Color.Blue, dhBlue);
blueChart.Refresh();
}
示例2: addAlphaToBgrImage
public static Image<Bgra, Byte> addAlphaToBgrImage(Image<Bgr, Byte> bgrImage, Image<Gray, Byte> alphaImage)
{
Image<Gray, Byte>[] channels = bgrImage.Split();
Image<Bgra, Byte> imageWithAlpha = new Image<Bgra,byte>(bgrImage.Width, bgrImage.Height);
CvInvoke.cvMerge(channels[0], channels[1], channels[2], alphaImage, imageWithAlpha);
for (int i = 0; i < 3; ++i) channels[i].Dispose();
return imageWithAlpha;
}