基本信息
源码名称:EMGUCV 视觉跟踪
源码大小:98.02M
文件格式:.zip
开发语言:C#
更新时间:2019-06-29
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Drawing;

using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.UI;
using Emgu.CV.Structure;
using Emgu.CV.Util;

namespace test1
{
    class Program
    {
        static void Main(string[] args)
        {

            VideoCapture cap = new VideoCapture("test7.mp4");
            if (cap.IsOpened)
            {
                int i = 0;
                Mat frame = new Mat();
                while (true)
                {
                    cap.Read(frame);//读取一帧
                    if (!frame.IsEmpty)
                    {
                        i  ;
                        string imgPath = "./"   i.ToString()   ".bmp";
                        CvInvoke.Imwrite(imgPath, frame);

                        Image<Bgr, Byte> image = new Image<Bgr, byte>(imgPath);


                        #region use MCvObjectDetection.Rect
                        MCvObjectDetection[] regions;
                        using (HOGDescriptor des = new HOGDescriptor())
                        {
                            des.SetSVMDetector(HOGDescriptor.GetDefaultPeopleDetector());
                            regions = des.DetectMultiScale(image);
                        }
                        foreach (MCvObjectDetection pedestrain in regions)
                            image.Draw(pedestrain.Rect, new Bgr(Color.Lime), 2);
                        CvInvoke.Imshow("image", image);
                        #endregion


                        if (CvInvoke.WaitKey(10) == 27)//esc退出
                        {
                            break;
                        }
                    }
                    else
                    {
                        Console.WriteLine("帧为空");
                        break;
                    }
                }
            }
            else
            {
                Console.WriteLine("视频打开错误");
                return;
            }
            
        }
    }
}