我在 Linux Mint 中(不知道版本)并且正在使用 Logitech Orbit AF 网络摄像头。我尝试以下代码,但我得到的只是“错误:捕获为空!” 请帮忙!!!!!
#include<cv.h>
#include<highgui.hpp>
#include<iostream>
using namespace std;
int main() {
    //Data Structure to store cam.
    CvCapture* cap=cvCaptureFromCAM(0);
    //Image variable to store frame
    IplImage* frame;
    //Window to show livefeed
    cvNamedWindow("LiveFeed",CV_WINDOW_AUTOSIZE);
    if(!cap)
    {
        cout << "ERROR: Capture is null!\n";
    }
    while(1)
    {
        //Load the next frame
        frame=cvQueryFrame(cap);
        //If frame is not loaded break from the loop
        if(!frame)
            break;
        //Show the present frame
        cvShowImage("LiveFeed",frame);
        //Escape Sequence
        char c=cvWaitKey(33);
        //If the key pressed by user is Esc(ASCII is 27) then break out of the loop
        if(c==27)
           break;
    }
    //CleanUp
    cvReleaseCapture(&cap);
    cvDestroyAllWindows(); 
}