【问题标题】:Why is my Web Camera is not streaming a video in c#?为什么我的网络摄像头没有在 c# 中流式传输视频?
【发布时间】:2019-11-11 03:07:30
【问题描述】:
public partial class Form1 : Form
    {


        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            VideoCapture capture = new VideoCapture();
            var img = capture.QueryFrame();

            imageBox1.Image = img;

        }


    }
}

这是我的代码,我似乎无法让它工作。一切似乎都很好,我无法调试。我的ImageBox 不是流式传输仅显示图像的视频。

【问题讨论】:

标签: c# image-processing video-streaming emgucv


【解决方案1】:

我找到了答案。谢谢!。大家:)

公共部分类 Form1 : Form {

    bool _streaming;
    VideoCapture _capture;

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        _streaming = false;
        _capture = new VideoCapture();


    }
    private void Button2_Click(object sender, EventArgs e)
    {
        if (_streaming == false)
        {
            //Start streaming
            Application.Idle += streaming;
            button2.Text = "Stop Streaming";

        }
        else
        {
            Application.Idle -= streaming;
            button2.Text = "Start Streaming";

        }
        _streaming = !_streaming;
    }

    private void streaming(object sender, EventArgs e)
    {

        var img = _capture.QueryFrame();
        imageBox2.Image = img;


    }

    private void Button1_Click(object sender, EventArgs e)
    {
        imageBox1.Image = imageBox2.Image;
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-22
    相关资源
    最近更新 更多