首页 > 编程知识 正文

C#图像处理-OpenCVSharp教程(五) OpenCVSharp摄像头、视频读取与保存写入

时间:2023-05-03 14:55:18 阅读:204644 作者:4001

本文作者Color Space,文章未经作者允许禁止转载!

本文将介绍OpenCVSharp摄像头、视频读取与保存写入!

代码与说明:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using OpenCvSharp;namespace Lesson_04{ class Program { static void Main(string[] args) { VideoCapture cap = new VideoCapture("bike.avi"); //VideoCapture cap = new VideoCapture(0); VideoWriter writer = new VideoWriter("out.avi", FourCC.MP42, 20, new Size(320, 240)); //VideoWriter writer = new VideoWriter("out.avi", FourCC.MP42, 20, new Size(640, 480), false); if (!cap.IsOpened()) { Console.WriteLine("Open video failed!"); return; } Mat frame = new Mat(); Mat gray = new Mat();

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。