I have to develop an application for windows that will enable controlling the mouse through web cam by recognizing hand gestures. I will be using vc++ 2008 for development. But I am confused whether to go with .NET framework or core win32 APIs. Performance is very important for my application. As per the book "Beginning Visual C++ 2008" by Ivor Horton, there is a small performance penalty associated in using .NET framework. I wanted to know on what al开发者_运维知识库l factors the penalty depends upon and will it be feasible to use .NET framework for my application.
If you are acquainted with Win32 API, then go Win32 API. It is the natural choice in your case since most of your source code will be video capturing, image processing, algorithms, and interfaces to mouse in Windows. When you are interested in performance, be closer to the hardware avoiding thick layers like .NET.
I believe that .NET is for complex business applications not for real-time applications or device drivers.
Unless you are a very experienced C++, programmer, C# is a much more productive language (speaking as someone with over 15 years C++ experience and 2 years C#).
The .Net libraries offer a wealth of high-quality functionality that's easier to use than the standard C++ library.
So, I'd go with using .Net.
I also recommend using C++/CLI to directly call complex native libraries if you have to integrate them, rather than P/Invoke. That's good for odd calls but doesn't let you easily access data structures or mingle native and managed code.
.NET is nice for GUIs and for general programming in non-performance-intensive areas. If you need to do anything more than a trivial GUI, I would suggest writing at least that part in a .NET language.
In what you've described of you program, recognizing hand gestures is going to be the only computationally intensive part. The actual process of controlling the mouse is trivial. So as long as the gesture recognition part performs well enough for your needs, it probably won't matter what the rest of the program is written in.
First step, you should research what libraries are out there that do gesture recognition or similar image processing. (I would hope that you're not intending to write that part from scratch anyway.) If you find any .NET based libraries that claim to have performance good enough for your needs, then you could give them a try. Otherwise, you would probably end up with a library based on C or C++ or similar. Either way though, it's possible to integrate such a thing with a .NET-based program.
I think you should limit .NET usage for GUI building.Rest of the works try to do in Win32. Remained question about object recognition , there is nice library called OPENCV (open source Computer Vision Library). this lib contains all possible methods which you would require in project. Also there is Intel's hardware specific library, IPP, which boost Opencv's performance.
A quick way to put it: the performance difference between the native API and .Net can be compensated for by buying a more expensive processor. You would pay somewhere between $1 and $100 more, with $10 being a reasonable estimate - per CPU of course. So, if you expect more than a million users, do choose the native API. If you expect to use it on 2-3 demo PCs, it really doesn't matter at all.
精彩评论