C# 视频播放
最编程
2024-01-22 18:45:19
...
主要是最基本的功能实现,后续会更新进一步的加工处理内容
emgucv采用的是V4.1.0.3420 VS版本2015
一开始 _capture.Start()后报错
错误 CS0012 类型“ExceptionHandler”在未引用的程序集中定义。必须添加对程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”的引用。
添加引用这个玩意就好了
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;
using Emgu.CV;
using Emgu.Util;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Emgu.Util.TypeEnum;
namespace WindowsFormsApplication38
{
public partial class Form1 : Form
{
// Capture是Emgu.CV提供的摄像头控制类,里面的ImageGrabbed事件表示的是获取到图片后触发。可以用来实现模拟摄像头视频获取(其实是在picturebox中显示图片,由于很快,就跟视频一样)
// Capture另一个非常关键的方法是QueryFrame()这个方法是用来获取当前的摄像头捕捉到的图面。
VideoCapture _capture;
Mat frame = new Mat();
public Form1()
{
InitializeComponent();
_capture = new VideoCapture(@"C:UsersAdministratorDesktopvideovtest.avi");
// _capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 300);
//设置捕捉到帧的高度为320。
// _capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth,
//300);
//设置捕捉到帧的宽度为240。
// _capture.FlipHorizontal = true;
//捕捉到帧数据进行水平翻转。
_capture.ImageGrabbed += _capture_ImageGrabbed;
_capture.Start();
}
void _capture_ImageGrabbed(object sender, EventArgs e)
{
_capture.Retrieve(frame, 0);
//var frame1 = _capture.Retrieve(frame,0);
captureImageBox.Image = frame;
}
}
}
下一篇: 强大工具React:打造惊艳的用户界面
推荐阅读
-
C# Winfrom 实现天际线绘制直线功能的示例代码
-
路人王篮球曹芳深夜和美女视频直播,仔细看看女主原来是她--这就是本内容的全部内容,喜欢的可以加关注哦!
-
包含源代码的简短视频,用于获取购物车中所有产品的列表并加载显示
-
ECharts 数据可视化项目 - 大屏幕数据可视化展示 - 免费在线视频教程 - php中文网
-
安卓通用视频播放器 09-MediaCodec 解码 AVPacket
-
如何从 bilibili(B 站)下载音频和视频
-
索拉作为世界模拟器的视频生成模型
-
Qt 实现的简单视频播放器,功能包括选择视频、播放、暂停、前进、后退、拖动进度条、显示视频长度等
-
uniapp 打包微信应用程序,以播放支持 hls(m3u8) 格式的视频流
-
深入了解视频编码 H264 结构(内置优势)