我正在尝试从我最近获得的EasyCap 4 通道 USB DVR 设备
中捕获摄像机源
,我已经购买了超级 Mimi 单色/彩色摄像机并将其连接到 DVR 设备并设法使用驱动程序正确设置设备“ SMI Grabber”并安装了设备“SuperViewer”附带的软件,
并且我编写了一个简单的 Windows 窗体应用程序,其中包含一个PictureBox
用于预览摄像头馈送
(底部有一个编辑)
的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DirectX.Capture;
namespace DirectShowWithCrossbar
{
public partial class Form1 : Form
{
private CrossbarSource crossbar;
private Filters filters;
private Capture capture;
public Form1()
{
InitializeComponent();
filters = new Filters();
capture = new Capture(filters.VideoInputDevices[0], filters.AudioInputDevices[0]);
foreach (Filter device in filters.VideoInputDevices)
{
comboBox1.Items.Add(device);
}
if (comboBox1.Items.Count > 0)
comboBox1.SelectedIndex = 0;
foreach (Filter device in filters.AudioInputDevices)
{
comboBox2.Items.Add(device);
}
if (comboBox2.Items.Count > 0)
comboBox2.SelectedIndex = 0;
foreach (Source source in capture.VideoSources)
{
comboBox3.Items.Add(source);
}
if (comboBox3.Items.Count > 0)
comboBox3.SelectedIndex = 0;
ShowPropertPagesInMenuStrip();
crossbar = (CrossbarSource)capture.VideoSource;
crossbar.Enabled = true;
capture.PreviewWindow = pictureBox1;
}
private void ShowPropertPagesInMenuStrip()
{
foreach (PropertyPage pro in capture.PropertyPages)
{
menusToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem(pro.Name));
}
}
private void button1_Click(object sender, EventArgs e)
{
capture.Cue();
capture.Start();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
capture.Stop();
capture.Dispose();
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
capture.VideoSource = (Source)comboBox3.SelectedItem;
}
}
}
我在图片框中出现黑屏??
错误地关闭我的应用程序后,我运行了DVR 设备附带的SuperViewer应用程序,然后打开我的应用程序,然后我的图片框开始向我显示来自相机的提要,奇怪!原始软件的提要冻结!
DirectX.Capture 示例和来源尝试使用相同的结果http://www.codeproject.com/Articles/3566/DirectX-Capture-Class-Library
我也使用过OpenCV和Touchless,我得到了相同的结果 :(编辑:
我一直在搜索,发现我需要获取过滤器(IAMCrossbar)我认为这是问题所在
DirectShow USB 网络摄像头更改视频源并在DirectX.Capture Wrapper 中应用此链接中的更改后,我仍然得到相同的结果 :(
提前感谢 Yaser的任何帮助