Skip to content

Instantly share code, notes, and snippets.

@longtth
Created May 7, 2018 03:49
Show Gist options
  • Save longtth/4ee9528724a9ec8a22c8a59b63c8fea1 to your computer and use it in GitHub Desktop.
Save longtth/4ee9528724a9ec8a22c8a59b63c8fea1 to your computer and use it in GitHub Desktop.
Đọc file video
using DAL;
using Emgu.CV;
using Emgu.CV.CvEnum;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OutputView
{
public partial class Form1 : Form
{
private VideoCapture capture;
private double fps;
private int frameNo;
public Form1()
{
InitializeComponent();
LoadVideo();
}
private void LoadVideo()
{
capture = new VideoCapture(txt_PathVideo.Text);
var totalFrame = capture.GetCaptureProperty(CapProp.FrameCount);
fps = capture.GetCaptureProperty(CapProp.Fps);
frameNo = 0;
capture.SetCaptureProperty(CapProp.PosFrames, frameNo);
var m = new Mat();
_capture.Read(m);
pictureBox1.Size = m.Bitmap.Size;
pictureBox1.Image = m.Bitmap;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment