Ask Your Question
0

open cv 4.0 c ++ internal camera not detected

asked 2018-06-29 20:23:50 -0600

Hi, after using this code my internal camera is not detected.My camera work when i'm using cheese.

I'm using

-Linux 4.15.0-23-generic x86_64

-Open cv 4.0

#include <opencv2/opencv.hpp>

using namespace cv;

using namespace std;

int main( int argc, const char** argv )

{
    Mat image;

VideoCapture cap;
if(!cap.isOpened()){
    cerr << "No camera detected on this system" << endl;
    return -1;
}

    while(true){
        cap >> image;
        if(image.empty()){
            cerr << "Frame invalid and skipped!" << endl;
            continue;
        }
        imshow("test", image);
        waitKey(5);
   }

   return 0;
}
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-06-30 00:16:56 -0600

berak gravatar image

you have to specify a camera index, like:

VideoCapture cap(0);

or :

bool ok = cap.open(0);

have a look at the docs

edit flag offensive delete link more

Comments

I have also done it and i have the same result.

featTheB gravatar imagefeatTheB ( 2018-06-30 07:58:29 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-29 20:17:30 -0600

Seen: 196 times

Last updated: Jun 30 '18