为什么 videocapture.read() 在 opencvsharp4 中不起作用?

问题描述

我在 c# 中使用了 opencvsharp4。

首先,我使用 VideoCapture.FromCamera(0) 使用笔记本电脑上的网络摄像头;

capture = VideoCapture.FromCamera(0);
if (capture.IsOpened())
{
    if (capture.Read(frame))
    {
        using (Bitmap bmp = BitmapConverter.ToBitmap(frame))
        {
            image = bmp;
            pictureBox1.source = BitmapToImageSource(image);
        }
    }
}

这很好用。

但改成VideoCapture.FromCamera(1)后,当usb摄像头连接并运行时,capture.Read(frame)的返回值变为false。

这是为什么?这是相机问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)