zoukankan      html  css  js  c++  java
  • C#使用emgucv打开视频并获得各项参数

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Emgu.CV.Structure;
    using Emgu.CV.CvEnum;
    using Emgu.CV;
    using System.Drawing;
    namespace 截取视频
    {
        class Program
        {
            public static string filePath = "";
            public static string destPath = "";
            public static bool ifPlay = true;
            public class videoParameter{
                public int videoWidth;
                public int videoHeight;
                public int videoCount;
                public int videoFps;
                public int videoInterval;
                public videoParameter(Capture cap)
                {
                    videoWidth = (int)cap.GetCaptureProperty(CapProp.FrameWidth);//长
                    videoHeight = (int)cap.GetCaptureProperty(CapProp.FrameHeight);//宽
                    videoCount = (int)cap.GetCaptureProperty(CapProp.FrameCount);//总帧数
                    videoFps = (int)cap.GetCaptureProperty(CapProp.Fps);//帧率,每秒多少张
                    videoInterval = (int)(1000 / videoFps);//播放间隔
                  //  videoDepth=cap.GetCaptureProperty(CapProp.De)
                }
            }static void Main(string[] args)
            {
                filePath = "D:/test/capture/cap/2.mp4";        
                Capture reader = new Capture(filePath);
                videoParameter vPara = new videoParameter(reader);
                while (ifPlay)
                {
                    Mat frame = reader.QueryFrame();
                    CvInvoke.NamedWindow("show", NamedWindowType.Normal);                
                    CvInvoke.Imshow("show",frame);
                    CvInvoke.WaitKey(vPara.videoInterval);
                }
            }
        }
    }
  • 相关阅读:
    使用SuperWebSocket 构建实时 Web 应用
    slam for Windows 库安装及应用libfreenect2
    《SLAM十四讲》g2o_custombundle在windows轻松调通
    windows下命令行查看库依赖
    zend studio控制台中文乱码
    http协议转
    mysql 字段 增删改
    PHP内部函数
    分层设计
    SecureCRT上传和下载
  • 原文地址:https://www.cnblogs.com/codeDog123/p/6591743.html
Copyright © 2011-2022 走看看