c# - 如何检测工业相机?
问题描述
我一直在尝试用 C# 开发一个软件来连接到 USB 相机。这是一款来自东芝的工业相机,型号为 BU238B。我曾尝试使用 AForge 和 EmguCV 等机器视觉库来连接它。但是,当我运行代码时,它只在列表中显示非工业相机(例如我自己的网络摄像头),同时无法检测到工业相机。我检查了我的设备管理器(我的 PC 和工业相机之间的连接没有问题)并为相机下载了正确的驱动程序。拜托,有人会帮我解决这个问题吗?
private FilterInfoCollection CaptureDevice; // camera list
private VideoCaptureDevice Final_Frame; // camera frame
private void Form1_Load(object sender, EventArgs e)
{
disconnectbtn.Enabled = false;
sendbtn.Enabled = false;
Connectbtn.Enabled = true;
CaptureDevice = new FilterInfoCollection(FilterCategory.VideoInputDevice); // here store all the device connected into "CaptureDevice"
foreach (FilterInfo Device in CaptureDevice)//add all connected device into the camera list box
{
cmbcamera.Items.Add(Device.Name);
}
cmbcamera.SelectedIndex = 0; //make default selection as the first device found
Final_Frame = new VideoCaptureDevice();
}
private void strbtn_Click(object sender, EventArgs e)
{
Final_Frame = new VideoCaptureDevice(CaptureDevice[cmbcamera.SelectedIndex].MonikerString);// selected device will connect once start button been press
Final_Frame.NewFrame += new NewFrameEventHandler(Final_Frame_NewFrame);// camera connected keep on track with latest event, if no this code the camera will not update to latest event
Final_Frame.Start(); // start camera
}
解决方案
推荐阅读
- oracle - 从实体表插入关系表
- javascript - 给定数组的前缀和数组。JavaScript,
- inheritance - 子类可以覆盖一个具体方法并将其声明为抽象吗?
- tensorflow - Keras,顺序神经网络模型
- python - ModuleNotFoundError:没有名为“xlxswriter”的模块
- python - 如何在电路python中进行非阻塞USB串行输入?
- javascript - 如何通过 METHOD 转换 DATA 中的值(未定义为数字)
- android - 为什么命令行 dalvikvm 使用标准的 Java 安全库(keystore)而不是使用 Android 版本
- python - 想要将 1.234.567 等数字转换为 1234.567
- swift - 如何根据 SwiftUI 中的 @State 更改导航视图的导航视图样式?