本文整理汇总了C#中Emgu.CV.Capture.Grab方法的典型用法代码示例。如果您正苦于以下问题:C# Capture.Grab方法的具体用法?C# Capture.Grab怎么用?C# Capture.Grab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Emgu.CV.Capture
的用法示例。
在下文中一共展示了Capture.Grab方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: run
private void run()
{
Image<Bgr, Byte> image = new Image<Bgr, byte>("lena.jpg"); //Read the files as an 8-bit Bgr image
Capture vid = new Capture("kw.avi");
vid.FlipVertical = true;
int x = 0;
TimeSpan time = TimeSpan.Zero;
MCvFont font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0);
using (VideoWriter vw = new VideoWriter("out3.avi", 15, 640, 480, true))
{
while (vid.Grab())
{
//if (++x % 1 != 0) continue;
image = vid.RetrieveBgrFrame();
long detectionTime;
List<Rectangle> faces = new List<Rectangle>();
List<Rectangle> eyes = new List<Rectangle>();
DetectFace.Detect(image, "haarcascade_frontalface_default.xml", "supersmile.xml", faces, eyes, out detectionTime);
foreach (Rectangle face in faces)
image.Draw(face, new Bgr(Color.Red), 2);
foreach (Rectangle eye in eyes)
image.Draw(eye, new Bgr(Color.Blue), 2);
if (eyes.Count > 0) time = time.Add(new TimeSpan(0, 0, 0, 0, 66));
//display the image
image.Draw(String.Format("{0}:{1}", time.Seconds, time.Milliseconds), ref font, new Point(50, 50), new Bgr(0, 0, 255));
setimage(image);
vw.WriteFrame<Bgr, Byte>(image);
}
}
}
示例2: Main
private static void Main(string[] args)
{
var capture = new Capture(0);
Native.Create(@"D:\GitHub\videotools\Debug\model\main_clm_general.txt");
var id = 0;
while (capture.Grab()) {
var mat = capture.QueryFrame();
Native.SessionPoint[] points;
var result = Native.Process(mat, out points);
Console.WriteLine(@"{0:D5}:{1}", id, Native.ToString(result));
++id;
}
Native.Destroy();
}