This project is read-only.

WPF Version?

Oct 12, 2008 at 10:21 PM
I was thinking about porting this over to WPF using my "WPF MediaKit" (http://codeplex.com/WPFMediaKit).  I won't have any free time for a few weeks, but it shouldn't be too hard as I already have a "VideoCaptureElement" that would just need a SampleGrabber.  If anyone is interested, email me at jeremiah.morrill [at] gmail [dot] com.

-Jer
Oct 25, 2008 at 12:17 AM
WPF sample can be found here. Painting Canvas with ImageBrush is a quick solution that requires no external libraries. However, it is probably more CPU consuming than jmorrill's controls. I am interested in WPF MediaKit integration but don't have the time to go in depth with source code...


Oct 26, 2008 at 12:37 AM
Hi papnkukn,

It looks like you've started some cool work with Touchless.
Your demo works, but suffers from some fairly glaring memory leaks.
I encourage other community members to work with papnkukn, let's see some good WPF progress!

- Mike
Oct 28, 2008 at 8:02 AM

Hi all,

 

I’m writing to let you know that I’ve managed to convert Touchless to run in WPF using Jeremiah's MediaKit.

 

Here you can download the modified sources for both Touchless SDK and WPF MediaKit:
http://cid-4c7ec0c2176a0b0d.skydrive.live.com/self.aspx/Public/Touchless|_20081028.zip

 

 Here is a brief list of changes that I made:

 

WPF MediaKit

1.       Modified VideoCapturePlayer to include SampleGrabber in filter graph. It uses the same properties as the video stream so the output bitmap will most likely be 24bpp RGB.

2.       VideoCaptureElement exposes Click method that captures a single frame and some additional properties.

 

Touchless SDK

1.       I have removed all dependencies on the WebCamLib, including the Camera class and all related code from TouchlessMgr.

2.       The camera updates are now handled in the demo application via the CameraTracker class which manages its own thread.

3.       TouchlessMgr.UpdateMarker now writes to separate bitmap to create marker highlights. This bitmap is later overlayed on top of the video via an InteropBitmap.

4.       Since the input bitmap now can have 24 bpp the code that accessed BitmapData via pointers was moved to BitmapHelper class that can handle both 24 and 32 bpp. This also removed the need to convert the input bitmap with GetThumbnailImage which in turn improved performance.

5.       I have changed all marker position properties to double type so it can size more smoothly in WPF.

6.       The video now can run in 640x480 resolution. Some changes were made in order to avoid repeating memory allocation of large arrays.

 

The overall performance is pretty good – I get 30fps on 640x480 video with about 23% CPU. I think some overhead is caused by WPF redrawing the overlay bitmap. But another cool idea would be to rewrite the algorithm using Parallel Extensions.

 

Hope you enjoy my sample, and please let me know if you have any suggestions or ideas what can be improved.

 

-Szymon

Oct 31, 2008 at 7:26 PM
Edited Oct 31, 2008 at 8:35 PM
Hi,

I've recently fixed memory leak issue in WPF sample. Problem was with Bitmap.GetHbitmap() method, IntPtr is now deleted after use.

I've also created two samples - a chess-like game and circuit drawing application, both using Touchless SDK. Both samples can be found at http://www.papnkukn.net/touchless

kobush, your version works well. I get 45-50% CPU without markers and additonal 10% with single marker and no memory leaks at 640x480. Could you please write your machine configuration (to compare test results)?
My sample works with max 25% CPU and no memory leaks at 320x240 @ 25 FPS. Tested on Core Duo @ 2.20 GHz, 2 GB RAM, WinXP SP2.
Oct 31, 2008 at 9:14 PM
Hi papnkukn,
I see you made great progress with your version. It's cool that you even managed to add your own applications and I'm going to take a closer look at it tomorrow.

Thanks for checking out my sample too. The results I presented above were obtained on Core Quad @ 2.66 GHz, 8GB RAM, Vista Ultimate 64-bit. I'm currently using Logitech QuickCam Pro 9000 for my tests.

But I also run it on my TabletPC that has low voltage Core 2 Duo @ 1.6 GHz, 2GB RAM, Vista Business 32-bit. Here frame rate dropped to about 10 fps. But it turned out that the problem was caused by graphics drivers for Intel GMA 965. I used a DropShadowEffect on video border in the MainWindow, but on this graphics adapter its not hardware accelerated. When I removed this effect it runs in 640x480 @ max 40% CPU with one marker.
Nov 1, 2008 at 5:17 AM
Papnkukn,

I really dig it; your WPF sample runs nicely now. And your other two demos are awesome. I really like the transparency slider idea.
The interaction of grabbing a circuit component is well done, but putting it down without an active marker or invocation method is tough.
The Knight game is really a great experience; the game flows well with the use of a marker.

You are leading the pack in creative uses for Touchless; I'd like to post your link on our new "Touchless Media" wiki page.
I'll also look closer at your source code for TouchlessWPF.exe; that might be useful to include in our source repository, if you'd allow.

One problem: I can't view your silverlight videos, it sends me to this site. I have Silverlight 2.

Great work! keep it up!
- Mike
Nov 1, 2008 at 6:17 PM
Hi,

Thanks, it is the Touchless idea that inspired me.

Sure, TouchlessWPF can be inlcuded in svn repository. Even more, it should be the official development version (always the lastest). Main idea is to use a single control (named TouchlessCanvas) in WPF that can be easily integrated in xaml.

Tip for watching demo videos: close browser, uninstall previous version (beta), install new version of Silverlight 2.0 (rtw).

-Papn Kukn
Nov 2, 2008 at 3:52 PM
Hi Papn,

I'm also thinking about puting together some infrastructure around Touchless in WPF as well. I got some inspiration after watching the PDS session about developing with Surface SDK (http://channel9.msdn.com/pdc2008/PC17/). They have a set of WPF Controls that can work with multi-touch input. But the controls work on top of some driver that sends routed events for each contact. I think we should be able to use the same model for Touchless. But eventually for the end user it should be as easy as to put a TouchlessCanvas instead of regular canvas to get multi-touch input (or TouchlessScatterView). I will be prototyping it this week.

-Szymon

Nov 21, 2008 at 10:00 AM
Hi kobush,

Actually there is already a project that will allow you to make what you want. Look at MultiTouchVista project. All you have to do is to implement an "input provider" (one simple interface) that will be using Touchless.

-Nesher
Apr 19, 2010 at 7:51 AM

Help! me please !

i just downloaded http://cid-4c7ec0c2176a0b0d.skydrive.live.com/self.aspx/Public/Touchless|_20081028.zip as kobush reccommented.

after that i open it in Visual Studio 2008 sp1

then i start deployment but it show this error

"Exception has been thrown by the target of an invocation"

What should i do next ?

Project Directory : C:\Users\Pattadon\Documents\Visual Studio 2008\Projects\Touchless

OS : Windows7 Ultimate

Apr 21, 2010 at 9:16 AM

Can anyone please give some solution for me ?

Apr 21, 2010 at 9:39 PM

I have the same issue with Windows Vista on a laptop with embedded webcam. If I connect an external webcam and change VideoInputNames[0] to [1] on MainWindowPresentationModel.cs:70 then the application works fine.

So, the solution is hardware (driver) dependent. If you are familiar with DirectShow you can change the way frames are grabbed from a webcam but this is more complex solution. Alternative is to try this demo and use it as sample grabber.