LBarret
LBarret

Reputation: 1123

QueryFrame very slow on Windows

I have build a simple webcam recorder on linux which works quite well. I get ~25fps video and good audio.

I am porting the recorder on windows (win7) and while it works, it is unusable. The QueryFrame function takes something more than 350ms, i.e 2.5fps.

The code is in python but the problem really seems to be the lib call.

I tested on the same machine with the same webcam (a logitech E2500). On windows, I installed openCV v2.2. I cannot check right now but the version might be a bit higher on Ubuntu.

Any idea what could be the problem ?

edit : I've just installed openCV2.4 and I have the same slow speed.

Upvotes: 1

Views: 573

Answers (2)

Zozz
Zozz

Reputation: 2025

I had same issue and I found out that this is caused by prolonged exposure. It may be the case that Windows drivers increased exposure to increase brightness of picture. Try to point your camera to light source or manually set decreased exposure

Upvotes: 1

karlphillip
karlphillip

Reputation: 93468

If the problem is really on QueryFrame I suspect the following might be happening: the Windows' driver for your camera retrieves the frames in a format that is not natively supported by OpenCV, so OpenCV is forced to convert the frames to a format that it understands. This operation consumes CPU and you would notice a performance loss if the size of the frames are big.

For testing purposes, you can:

1) Set a smaller size for the frames and see if it improves the performance:

cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 320);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 240);

2) Use another camera and see if the problem goes away.

Once you've determined that this is really what's going on, try to find an update for the driver and hope that it solves the issue, or stop using Windows. =)

Upvotes: 1

Related Questions