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);
                }
            }
        }
    }
  • 相关阅读:
    中国石油大学天梯赛真题模拟第二场
    AtCoder Grand Contest 016 B
    POJ1011 Sticks
    UPC7817: Supermarket
    UPC5652: Ants on a Circle
    石大iCal课表使用指南
    UPC10582: Cowpatibility
    UPC11079: 小P的决斗 POJ3244 Difference between Triplets
    UPC6976:矩阵模板(二维哈希)
    知识点2-3:视图的职责
  • 原文地址:https://www.cnblogs.com/codeDog123/p/6591743.html
Copyright © 2011-2022 走看看