using OpenCvSharp;
using OpenCvSharp.Extensions;
static VideoCapture capture=new VideoCapture(@"E:\视频素材\西门子SGT-750燃气轮机.mp4");
static bool isopen = false;
private void pictureBox5_Paint(object sender, PaintEventArgs e)
{
if (isopen)
{
Mat image = new Mat();
capture.Read(image);
if (image.Empty())
{
isopen = !isopen;
}
else
{
int sleepTime = (int)Math.Round(1000 / capture.Fps);
pictureBox5.BackgroundImage = image.ToBitmap();
Cv2.WaitKey(sleepTime);
image.Release();//释放,别等到gc来回收,太占内存
}
}
}
private void button5_Click_1(object sender, EventArgs e)
{
isope
使用opencvsharp在c# winform的pictureBox上播放视频
最新推荐文章于 2024-05-24 14:48:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)