I have an application in C# tha开发者_如何学编程t interfaces to a USB camera. It's been working just fine except for the fact that I have not been able to achieve better than about 16 frames-per-second. I'm using VFW, and a 'C' callback (the callback is part of a DLL) per WM_CAP_GRAB_FRAME_NOSTOP
message, and I've found that even if I do essentially NOTHING in the callback, I am unable to get a decent frame rate (16FPS is about the max).
I thought that using this interface would give me better performance than other alternatives (DirectShow for example) simply because of its simplicity and low-level connection to the driver; but now I'm beginning to wonder if that's true.
Anyone have any insight on this?Let me hazard a guess...
Are you using System.Timers.Timer
by any chance? Or, is the C portion of the program using Windows Timer? If you do, its limited resolution might be the cause of the problem.
I never did find out why VFW appears to limit my frame rate; however, I found VideoInput for C# and I now use that instead. Gives me much more control over the camera and much higher framerates.
精彩评论