本文整理匯總了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;
}