3

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.

user3285283
  • 113
  • 3
  • 6

3 Answers3

1

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!

Community
  • 1
  • 1
user3380927
  • 232
  • 2
  • 8
0

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.

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
  • When I put 0 has the deviceID it opens the webcam. When I do 1 or any other number, the code crashes and system restarts. The video capture device shows up as video controller rather than imaging device. The analog camera is not directly connected the PC. I am still not getting the right answer – user3285283 Feb 13 '14 at 01:45
  • @user3285283 What do you mean by *not directly connected the PC*? – herohuyongtao Feb 13 '14 at 02:12
  • The camera has a Female RCA connector to send video. I connect this to a video capture device using a male-to-male RCA connector. A EasyCap video capture device is connected to the PC. The PC hardware identifies this video capture device as a sound, game and video controller hardware but not the camera directly. – user3285283 Feb 13 '14 at 14:15
  • @user3285283 If your PC cannot identify it as a camera, then OpenCV will probably do the same way (bad news :(). – herohuyongtao Feb 13 '14 at 14:17
  • Is there a way in which a analog camera/IR camera can be connected. I guess people have used ccd camera/IR camera/analog camera on drones to transmit video to ground station and performed some sorts of image processing. – user3285283 Feb 13 '14 at 15:37
  • @user3285283 I am not sure. Maybe you can ask another SO question here to find it out. :) – herohuyongtao Feb 13 '14 at 15:38
0

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

Anoop K. Prabhu
  • 5,417
  • 2
  • 26
  • 43