本文整理匯總了C#中OpenCvSharp.IplImage.ToWriteableBitmap方法的典型用法代碼示例。如果您正苦於以下問題:C# IplImage.ToWriteableBitmap方法的具體用法?C# IplImage.ToWriteableBitmap怎麽用?C# IplImage.ToWriteableBitmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OpenCvSharp.IplImage
的用法示例。
在下文中一共展示了IplImage.ToWriteableBitmap方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ConvertToWriteableBitmap
public ConvertToWriteableBitmap()
{
WriteableBitmap wb = null;
// OpenCVによる畫像処理 (Threshold)
using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
{
src.Smooth(src, SmoothType.Gaussian, 5);
src.Threshold(dst, 0, 255, ThresholdType.Otsu);
// IplImage -> WriteableBitmap
wb = dst.ToWriteableBitmap(PixelFormats.BlackWhite);
//wb = WriteableBitmapConverter.ToWriteableBitmap(dst, PixelFormats.BlackWhite);
}
// WPFのWindowに表示してみる
Image image = new Image { Source = wb };
Window window = new Window
{
Title = "from IplImage to WriteableBitmap",
Width = wb.PixelWidth,
Height = wb.PixelHeight,
Content = image
};
Application app = new Application();
app.Run(window);
}
示例2: ConvertToWriteableBitmap
public ConvertToWriteableBitmap()
{
WriteableBitmap wb = null;
// OpenCV processing
using (var src = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
using (var dst = new IplImage(src.Size, BitDepth.U8, 1))
{
src.Smooth(src, SmoothType.Gaussian, 5);
src.Threshold(dst, 0, 255, ThresholdType.Otsu);
// IplImage -> WriteableBitmap
wb = dst.ToWriteableBitmap(PixelFormats.BlackWhite);
//wb = WriteableBitmapConverter.ToWriteableBitmap(dst, PixelFormats.BlackWhite);
}
// Shows WriteableBitmap to WPF window
var image = new Image { Source = wb };
var window = new Window
{
Title = "from IplImage to WriteableBitmap",
Width = wb.PixelWidth,
Height = wb.PixelHeight,
Content = image
};
var app = new Application();
app.Run(window);
}