user3285283
user3285283

Reputation: 123

Opencv cant access camera connected through video capture device

I have a analog camera connected to EasyCap video capture device. When I run a basic code which opens webcam video using OPENCV, I can access my in-built webcam but not the other analog camera.

How would you connect any other camera (FPV, IR, etc) to the PC such that OPENCV can access it.

Thanks.

Upvotes: 3

Views: 5169

Answers (3)

user3380927
user3380927

Reputation: 232

i struggled with the same problem and hope it helps!

the original thread + ANSWER

also relevant XKCD

one more observation: from your description it looks like you already have a webcam running on the laptop (in-built webcam maybe?) you might want to disable it in system manager so as to guarantee that your analog camera cam_index is zero for certain. Otherwise if you leave the webcam enabled as a device, then your analog cam will most likely be incremented to cam_index=1 which amusingly enough seems to be confirmed by it crashing on cam_index=1. Arguable not a great method to find your camera's index but there you have it!

Upvotes: 1

Anoop K. Prabhu
Anoop K. Prabhu

Reputation: 5655

Use the deviceID of the analog camera instead of the in-built one.

Upvotes: 0

herohuyongtao
herohuyongtao

Reputation: 50717

You can set which camera to connect to open by changing the following deviceID to the desired device you want:

CvCapture* capture = cvCaptureFromCAM(deviceID);  

or new API:

VideoCapture cap(deviceID);

Check out documenation for more info.

Upvotes: 0

Related Questions