来自Mac上Kinect v1 Sensor的VideoCapture cap(0)

时间:2017-09-11 10:11:01

标签: macos kinect

我想通过使用Xcode中的OpenCV线VideoCapture cap(0)从Kinect v1传感器捕获视频帧。但是,我只能从Mac的网络摄像头中捕获帧。如果我改为VideoCapture cap(1),我得到了#34;绑定设备"错误。有人可以帮忙解决这个问题吗?

我正在使用:

1)MacOS Sierra版本10.12 2)Xcode版本8.3.3(8E3004b) 3)Opencv 3.2.0,使用cmake-3.9.2_0.darwin_16.x86_64安装

这是执行ffmpeg -hide_banner -f avfoundation -list_devices true -i ""时的输出:

[AVFoundation input device @ 0x7fcc1851b740] AVFoundation video devices:
[AVFoundation input device @ 0x7fcc1851b740] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7fcc1851b740] [1] Capture screen 0
[AVFoundation input device @ 0x7fcc1851b740] AVFoundation audio devices:
[AVFoundation input device @ 0x7fcc1851b740] [0] Built-in Microphone
: Input/output error

以下是我的代码:

VideoCapture cap(0); //capture the video from webcam

if ( !cap.isOpened() )  // if not success, exit program
{
    cout << "Cannot open the web cam" << endl;
    return -1;
}

while (true) {

    Mat img;
    cap.read(img);
    namedWindow( "Video Streams", CV_WINDOW_AUTOSIZE );
    imshow("Video Streams", img);

    if (waitKey(30) == 27)
    {
        break;
    }
}

return 0;

}

0 个答案:

没有答案