• 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);
                }
            }
        }
    }
  • 相关阅读:
    给博客园编辑器完善个插件及简单产品化工作
    在Visual Studio中新增生成项目
    用了三星Dex,我已经快一个月回家没开过电脑了
    BizTalk证书相关操作
    定长文本格式编辑神器
    B2B相关编码说明
    OFTP简介
    Apigee 简介与简单试用
    重置BizTalk RosettaNet
    BizTalk Map 累积连接字符串
  • 原文地址:https://www.cnblogs.com/codeDog123/p/6591743.html
Copyright © 2020-2023  润新知