Ask Your Question
0

ToupCam VideoCapture Not Working

asked 2016-08-31 08:02:56 -0600

tyler.royer gravatar image

I am trying to get a microscope camera to work with opencv, my webcam works when using VideoCapture(0) and -1.

However the microscope camera I am using, OMAX A35140U (ToupCam), will not work when using any other numbers. It does show up as a connected camera when viewing devices (USB 2.0 Camera). I am using python and windows 7 pro.

Any help would be great. Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-09-01 04:55:24 -0600

pklab gravatar image

updated 2016-09-01 05:02:40 -0600

Why do you want to use any other numbers ? if it works only with '0' means that '0' is the ID that the system has assigned to your camera in that moment.

Another story is to check if different API backend works better or gives you more controls (more available properties) via VideoCapture.get(). e.g. you could try

cap = cv2.VideoCapture(0+cv2.CAP_DSHOW)
if cap.isOpened() == False:
    print('ERROR: Unable to open the camera')
else:
    # this pop ups the driver settings form only with DSHOW
    cap.set(cv2.CAP_PROP_SETTINGS,-1)

other backends on Windows are CAP_MSMF and CAP_VFW . VFW is default on Windows, others have to be enabled in your OpenCV binary via CMake.

edit flag offensive delete link more

Comments

Sorry if it was confusing. I was saying that the built in webcam on my laptop works. However the USB 2.0 Camera I would like to use does not work.

The USB 2.0 Camera is a ToupTek camera and is currently using their driver

Hangzhou ToupTek Photonics Co., Ltd; http://www.touptek.com/

It is a UCMOS camera if that makes any sense. I am not completely sure how to use the CMake build, I am only using the precompiled version.

tyler.royer gravatar imagetyler.royer ( 2016-09-01 06:31:11 -0600 )edit

As you can see from their website the driver supporting DShow interface therefore it should work with cap cv2.VideoCapture(camIndex+cv2.CAP_DSHOW).

The DirectShow Video Capture library is enabled by default in OpenCV 3.1.0 precompiled version (chek for HAVE_DSHOW in <opencv_dir>/include/opencv2/cvconfig.h). If it's disabled, you have to rebuild opencv from sources

pklab gravatar imagepklab ( 2016-09-01 12:24:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-08-31 08:02:56 -0600

Seen: 1,380 times

Last updated: Sep 01 '16