久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何初始化 AForge 網絡攝像頭

How initialize AForge webcam(如何初始化 AForge 網絡攝像頭)
本文介紹了如何初始化 AForge 網絡攝像頭的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我嘗試使用 Aforge 編寫一小段代碼來捕獲幀我參考了 Aforge.dll 和 AForge.Video.DirectShow.dll代碼如下,但我做錯了什么.警告我得到名稱 videoDevices 在當前上下文中不存在.我認為這與我嘗試創(chuàng)建該變量的位置有關,但我不確定在哪里放置按鈕的代碼以使其初始化.錯誤在 Visual Studio 中也顯示為對象videoDevices"下的紅線

I try to write a small peace of code to capture a frame using Aforge I made a reference to Aforge.dll and AForge.Video.DirectShow.dll The code is below, but i am doing something wrong. The Warning i get "the name videoDevices does not exist in the current context. I think it has to do about where i try to create that variable but i'm not exactly sure as where to place that code of the button to get it initialized. The error is displayed in visual studio also as a redline under the object "videoDevices"

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AForge;
using AForge.Video.DirectShow;

namespace AforgeCam
 {
   public partial class Form1 : Form
 {
    public Form1()
    {
        InitializeComponent();

    }

    private void button1_Click(object sender, EventArgs e)
    {

        videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

        if (videoDevices.Count == 0)
            throw new ApplicationException();

        foreach (FilterInfo device in videoDevices)
        {
    VideoCaptureDevice videoSource = new    VideoCaptureDevice(device.MonikerString);
            videoSource.DesiredFrameSize = new Size(320, 240);
            videoSource.DesiredFrameRate = 15;
            videoSourcePlayer1.VideoSource = videoSource;
            videoSourcePlayer1.Start();
        }

    }
    }
}

推薦答案

根據(jù)要求,解決方案如下,代碼有效,我將針對我對此提出的另一個問題提出一個新問題.該代碼需要一個下拉框、2個按鈕和一個圖片框

As requested the solution is below , the code works, i will raise a new question for another question i have about it. the code requires a dropdown box, 2 buttons and a picturebox

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AforgeCam;
using AForge.Video;
using AForge.Video.DirectShow;

namespace AforgeCam
{
public partial class Form1 : Form
{
private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideo;

public Form1() // init
{
    InitializeComponent();
    {
        VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
        foreach (FilterInfo VideoCaptureDevice in VideoCaptureDevices)
        {
            comboBox1.Items.Add(VideoCaptureDevice.Name);
        }
        comboBox1.SelectedIndex = 0;
    }
}

private void button1_Click(object sender, EventArgs e)
{
    FinalVideo = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
    FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
    FinalVideo.Start();
}

void FinalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
    Bitmap video = (Bitmap)eventArgs.Frame.Clone();
    pictureBox1.Image = video;

}

private void button2_Click(object sender, EventArgs e)
{
    FinalVideo.Stop();
}
}

這篇關于如何初始化 AForge 網絡攝像頭的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發(fā)技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應用程序密碼從 oauth2/token 獲取訪問令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: xx视频在线| 精品免费国产一区二区三区四区介绍 | 在线视频91 | 午夜小视频在线观看 | 成人精品福利 | 97精品超碰一区二区三区 | 在线日韩| 午夜一区二区三区在线观看 | 婷婷桃色网 | 美女一级a毛片免费观看97 | 人人做人人澡人人爽欧美 | 久久久久久黄 | 久久久久久久久久久爱 | 国产精品18久久久久久白浆动漫 | 国产亚洲成av人在线观看导航 | 亚洲成人精品 | 国产91精品久久久久久久网曝门 | 亚洲国产一区二区三区在线观看 | 国产精品久久久久一区二区三区 | 天天天天操 | 欧美黑人一级爽快片淫片高清 | 亚洲高清在线观看 | 久久com | 国产精品色婷婷久久58 | 中文字幕国产日韩 | 在线观看中文字幕一区二区 | 日韩资源| 天堂网色 | 精品成人佐山爱一区二区 | 亚洲精品乱码久久久久久黑人 | 午夜婷婷激情 | 欧美一级二级在线观看 | 欧美一区不卡 | 日韩激情在线 | 日本亚洲欧美 | 精区3d动漫一品二品精区 | 琪琪午夜伦伦电影福利片 | 91精品久久久久久久久久入口 | 亚洲精品天堂 | 黄色毛片免费视频 | 户外露出一区二区三区 |