6 of 9
6
CsTI - CSharp Touchlib Interface
Posted: 14 May 2008 10:16 AM   [ Ignore ]   [ # 76 ]
Jr. Member
RankRank
Total Posts:  110
Joined  2007-06-06
Calvin Muller - 14 May 2008 06:17 AM

hi there, donovan i wonder if you could help me

I am trying to use your CSti Wrapper for the TouchLib but i am just wondering how do i implement it and what files do i need in the bin directory of my application?

I have reference the CsTI.dll, but the TouclibWrapper.dll won’t allow me to reference it and so when i do this..

CsTI oCsTI = new CsTI();

oCsTI.startScreen(true);

I get an error saying Error
1 ‘TouchlibWrapper.CsTI.CsTI()’ is inaccessible due to its protection level C:\Documents and Settings\Calvin Muller\Local Settings\Application Data\Temporary Projects\TouchMeMulti\Form1.cs 21 26 TouchMeMulti


I have managed to get the application running by copying like alot of files into the bin directory.. I was wondering how it is possible to use this in a windows forms application and when i load the form up and startScreen and add a few event handlers the form just never appears…

Thanks

That error has nothing to do with dlls in your bin dir, you cant use the default constructor...instead of:

CsTI oCsTI = new CsTI();

use:

CsTI oCsTI = CsTI.Instance();

Profile
 
 
Posted: 14 May 2008 01:37 PM   [ Ignore ]   [ # 77 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

just like admiralUD said.

as for the problem of your forms not showing.

once startScreen is run touchlib enter an endless loop to process the touches. so you need to call it AFTER the initialization process has completed. luckily there’s an event that gets called once that is done. i haven’t used .NET 2 for quite a while but I think the event is something like Form.Loaded. not really sure. but once you find that event. put the following in it:

CsTI oCsTI = CsTI.Instance();
oCsTI.startScreen(true);

then startscreen gets called after everything has been set up.

 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 14 May 2008 04:07 PM   [ Ignore ]   [ # 78 ]
New Member
Rank
Total Posts:  25
Joined  2008-05-14

that doesn’t really work very well because once the form is loaded i then click on a button which starts the startScreen method but this just leads the form to stop responding. How would i pass the finger blob locations to a program??? or to use this to create an application which uses FTIR

Profile
 
 
Posted: 14 May 2008 04:53 PM   [ Ignore ]   [ # 79 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

ok. i have attached a template application that has the code you need to run a console touch application.

what do you mean with doesn’t work very well? the entire touchlib works on an event based system. once a finger is pressed/moved/lifted it sends an event. CsTI allows you to receive those events in a .NET application.

Once you click startScreen ONLY touchlib events are processed - thats what makes it seem to have stopped responding. So your mouse wouldn’t work anymore. the idea is to not use a mouse anyway with the screen.

So in the Program.txt that is attached you’ll see the event handlers for fingerdown/up/update. do whatever needs to be done in those handlers. just like you would for a normal forms application (like button.click).

File Attachments
Program.txt  (File Size: 2KB - Downloads: 112)
 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 15 May 2008 01:44 AM   [ Ignore ]   [ # 80 ]
Sr. Member
RankRankRank
Total Posts:  286
Joined  2007-07-14

Actualy you have to start CsTI on a separate thread. If you use Form.Loaded (winforms) or any other event from Control (winforms) or UIElement (wpf) your UI thread will be blocked and stop application will stop responding.

Profile
 
 
Posted: 15 May 2008 04:33 AM   [ Ignore ]   [ # 81 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

it is a good idea to run it in it’s own thread. but it isn’t *needed*. I have never implicitly started a new thread for it and it works. If .NET automatically starts a new thread for a DLL i don’t know.

 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 15 May 2008 05:50 AM   [ Ignore ]   [ # 82 ]
Sr. Member
RankRankRank
Total Posts:  286
Joined  2007-07-14

.NET does not start any threads automaticaly.

Profile
 
 
Posted: 15 May 2008 02:19 PM   [ Ignore ]   [ # 83 ]
New Member
Rank
Total Posts:  25
Joined  2008-05-14

My final question, i know this has most probably been asked many time but how does one detect that my finger is on a button??

I’m talking about a standard windows button..

Thanks for your awesome work on CsTI, I’m also frm South Africa. I live in Port Elizabeth and constructing a FTIR system.
So if i need any help i know who to call smile

Thanks a mil

Profile
 
 
Posted: 15 May 2008 02:44 PM   [ Ignore ]   [ # 84 ]
New Member
Rank
Total Posts:  4
Joined  2008-03-25

Hi,

your question about thread is very interesting, I’ve develop a multitouch project in wpf now but not with csti. I’m interfaced with tuio protocol, it is more flexible (I can use wiimote....). And to manage thread and input i’ve solve the problem. I reinject custom event in the central wpf input manager and all message are in a sta thread and. You can manage level of priority (input priority, ui priority etc .....).

If you wan’t to see my work you can go to Tangibilis at codeplex. My work is not finish but i hope manage all wpf control since 1-2 month.

If you are interested by this project contact me. I’m alone on this project and some help can be speedup the release.

Profile
 
 
Posted: 15 May 2008 03:47 PM   [ Ignore ]   [ # 85 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

nice! another south african! good luck with the work!

I haven’t tried using multitouch under normal windows forms. I have however done it in WPF/.NET 3 which allows for some really really cool interfaces to be built. Maybe you should consider moving to the newer platform? if you want to see code that finds the uielement that you touched in.net 3. go to here. it contains only the very core of what i’m still working on. touchengine.cs has a method named getTouchedElement where you pass the x and y coordinates and it finds the element.

the basic idea is to just check what elements are underneath the touch and return the top one. my way is not the *best* way but it is a way grin

 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 15 May 2008 05:05 PM   [ Ignore ]   [ # 86 ]
New Member
Rank
Total Posts:  25
Joined  2008-05-14

hahaha. indeed, i think i might be looking into WPF, i got your gallery app. Going to test it when i get my LED’s hopefully sometime this week
Does your webcam resolution need to match your projector resolution or will touchlib do the nescessary conversions for me??

Profile
 
 
Posted: 15 May 2008 05:42 PM   [ Ignore ]   [ # 87 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

yeah, no need for projector to match the webcam. touchlib returns a value between 0 and 1 for the touch. you just multiple that by the width/height of your projector resolution and there you have some correct screen coordinates!

 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 15 May 2008 06:02 PM   [ Ignore ]   [ # 88 ]
New Member
Rank
Total Posts:  25
Joined  2008-05-14

oh okay awesome..
WPF seems like a whole new learning curve.. Does it have like GDI type features??

I want to draw a square or circle on the form where the fingers appear, any idea? rasberry

Something else really weird is happening, it seems to only be picking up objects within a certain area of the webcam. It’s like inside a square, when viewing the rectify filter i get the whole picture but in my form it displays X and Y but as soon as i leave a certain square in the rectify window the co-ordinates just go back to 0,0..

very weird isn’t it.. :(

Profile
 
 
Posted: 15 May 2008 06:38 PM   [ Ignore ]   [ # 89 ]
New Member
Avatar
Rank
Total Posts:  36
Joined  2008-01-29
Calvin Muller - 15 May 2008 06:02 PM

oh okay awesome..
WPF seems like a whole new learning curve.. Does it have like GDI type features??

I want to draw a square or circle on the form where the fingers appear, any idea? rasberry

Something else really weird is happening, it seems to only be picking up objects within a certain area of the webcam. It’s like inside a square, when viewing the rectify filter i get the whole picture but in my form it displays X and Y but as soon as i leave a certain square in the rectify window the co-ordinates just go back to 0,0..

very weird isn’t it.. :(

Think that is because wrong calibration.
Try to copy-paste section of config.xml from originally downloaded file.
This works for me.

Profile
 
 
Posted: 18 May 2008 03:33 PM   [ Ignore ]   [ # 90 ]
New Member
Rank
Total Posts:  10
Joined  2008-05-18

Hello all,

My first post, and I am excited because yesterday I finally got some results in the DIY DI MultiTouch display.
I am wondering is anybody having an error page when trying to download the CsTi code?

anybody has an alternative download link?

Thanks to all for their hard work and dedication to making this a resourceful forum.

Fadi .K

Profile
 
 
   
6 of 9
6