本文整理汇总了C#中OpenCvSharp.IplImage.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# IplImage.CopyFrom方法的具体用法?C# IplImage.CopyFrom怎么用?C# IplImage.CopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCvSharp.IplImage
的用法示例。
在下文中一共展示了IplImage.CopyFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawToHdc
public DrawToHdc()
{
CvRect roi = new CvRect(320, 260, 100, 100); // region of roosevelt's face
using (IplImage src = new IplImage(Const.ImageYalta, LoadMode.Color))
using (IplImage dst = new IplImage(roi.Size, BitDepth.U8, 3))
{
src.ROI = roi;
using (Bitmap bitmap = new Bitmap(roi.Width, roi.Height, PixelFormat.Format32bppArgb))
using (Graphics g = Graphics.FromImage(bitmap))
{
//BitmapConverter.DrawToGraphics(src, g, new CvRect(new CvPoint(0, 0), roi.Size));
IntPtr hdc = g.GetHdc();
BitmapConverter.DrawToHdc(src, hdc, new CvRect(new CvPoint(0,0), roi.Size));
g.ReleaseHdc(hdc);
g.DrawString("Roosevelt", new Font(FontFamily.GenericSerif, 12), Brushes.Red, 20, 0);
g.DrawEllipse(new Pen(Color.Red, 4), new Rectangle(20, 20, roi.Width/2, roi.Height/2));
dst.CopyFrom(bitmap);
}
src.ResetROI();
using (new CvWindow("src", src))
using (new CvWindow("dst", dst))
{
Cv.WaitKey();
}
}
}
示例2: TestBitmap
/// <summary>
/// Bitmap -> IplImage
/// </summary>
private void TestBitmap()
{
using (Bitmap bitmap = new Bitmap(FilePath.Image.Fruits))
{
IplImage ipl = new IplImage(bitmap.Width, bitmap.Height, BitDepth.U8, 3);
//ipl = bitmap.ToIplImage();
ipl.CopyFrom(bitmap);
using (new CvWindow("from Bitmap to IplImage", ipl))
{
Cv.WaitKey();
}
}
}