I am looking for a way to capture images from my webcam using directshow, preferably I want to use HD resolutions if possible, and avoid CPU spikes at 60-100%.
can someone shoot me in the right direction on how to do this?
I tried using DSPack, but this component makes my CPU spike 90-100%
if 开发者_StackOverflow社区however someone here know how to use DSPack with less CPU consumption I would also be happy about that :)
I've used dspack for a long time on cheap machines that are built into cars. They have slow ~700mhz VIA processors (single core), and 256MB of RAM.
The application captures 12 images per second from a camera on the roof of the car, and every time a new GPS position (once per second) comes in, it adds coordinates to the image, and stores it as a .jpg on a harddisk.
When the application captures images, and shows the images on a form without creating .jpg images, the application takes about 5% processor time (!).
If you get 90% CPU time with DsPack, it's probably because of extra processing that's being done with the images.
I've tried all sorts of libraries in my research to create this program, and dspack was a clear winner on many fronts. I wouldn't give up on it too soon.
I have a real-time video application that uses Mitov's VideoLibrary. It's a collection of objects that are well-designed, threaded, and takes advantage of all the CPU cores available.
When I go to his library with some new need, I'm usually pleasantly surprised to see he anticipated it. Support has been very good also.
It's not cheap: $450, but for my needs, has been worth every penny. It's free for non-commercial use: http://www.mitov.com/html/videolab.html.
His CaptureBitMap demo captures successive frames to a bitmap. You simply drop several components on a form, and write six lines of code! The library has lots of hooks to go further than this simple example. (In Win 7, Delphi 2010, the demos are installed here: C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\LabPacks\Demos\Delphi2010\VideoLab\CaptureBitmap. But, I know he supports as far back as Delphi 7.)
One thing that differentiates his library is that it makes use of the Intel IPP libraries: http://software.intel.com/en-us/articles/intel-ipp. When running on Intel chipsets, if you choose to ship the Intel DLLs, you get the best performance that Intel's engineers could squeeze out of their chips. If Mitov's library with IPP can't process your video fast enough, I'd be surprised if any video library can.
Mitov has some standing in the Delphi community: he was a speaker on multi-threading at CodeRage: http://www.embarcadero.com/coderage5/sessions (Thursday session.)
The above may sound like I'm a shill for his company. I don't have any relationship other than as a very pleased licensee. I'm just very happy (and relieved) that I found his tools and decided to use them.
精彩评论