首页 > 解决方案 > 如何检测工业相机?

问题描述

我一直在尝试用 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
        }

标签: c#cameracomputer-visionemgucvaforge

解决方案


推荐阅读