views:

39

answers:

1

I am using C# to develop, I want to use a camera to capture a image in my application.
As far as I know, there are two choices: WebCam with

[DllImport("avicap32.dll", EntryPoint="capCreateCaptureWindowA")]  

And use this function to capture image into clipboard, and then our application can get the image.

Choice 2: Use directX to capture image, and I found some sample project on codeproject.
My question is : What solution should I choose ?
What should I consider before make a choice ?
Please point me the right direction, Thanks !

A: 

I think with DirectX, we can get more control with the hardware. CPU usage is generally represented as a simple percentage of CPU time spent on non-idle tasks. But this is a bit of a simplification. In any modern operating system, the CPU is actually spending time in two very distinct modes:

Kernel Mode In Kernel mode, the executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are catastrophic; they will halt the entire PC.

User Mode In User mode, the executing code has no ability to directly access hardware or reference memory. Code running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable. Most of the code running on your computer will execute in user mode.

MemoryLeak