c# /WPF开源相机库

本文关键字:相机 开源 WPF | 更新日期: 2023-09-27 18:12:59

我没有与。net项目工作了一段时间,现在我需要使用一个库来显示来自网络摄像头的实时视图,并拍照或制作视频。谁能给我推荐一个好的开源库吗?经过快速搜索,我发现了AForge库,但我不知道这是否是我要找的。

c# /WPF开源相机库

我以前用过WebCam_Capture;

WebCAM.cs:

using System;
using System.IO;
using System.Linq;
using System.Text;
using WebCam_Capture;
using System.Collections.Generic;
namespace controlPC{
 class WebCam{
private WebCamCapture webcam;
private System.Windows.Forms.PictureBox _FrameImage;
private int FrameNumber = 50;
 public void InitializeWebCam(ref System.Windows.Forms.PictureBox ImageControl){
 webcam = new WebCamCapture();
  webcam.FrameNumber = ((ulong)(0ul));
 webcam.TimeToCapture_milliseconds = FrameNumber;
 webcam.ImageCaptured += new WebCamCapture.WebCamEventHandler(webcam_ImageCaptured);
_FrameImage = ImageControl;}
 void webcam_ImageCaptured(object source, WebcamEventArgs e){
 _FrameImage.Image = e.WebCamImage;}
  public void Start(){
 webcam.TimeToCapture_milliseconds = FrameNumber;
 webcam.Start(0);}
 public void Stop(){
 webcam.Stop();}
 public void Continue(){
 webcam.TimeToCapture_milliseconds = FrameNumber;
 webcam.Start(this.webcam.FrameNumber);}

MainForm.cs

using WebCam_Capture;
    void MainFormLoad(object sender, EventArgs e)
{
 webcam = new WebCam();
webcam.InitializeWebCam(ref pictureBox1);
}