Touchlib HelloWorld
Posted: 19 March 2008 04:44 AM   [ Ignore ]   [ # 16 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  531
Joined  2006-11-09

See: http://nuigroup.com/wiki/Basic_Touchlib_Application/

// main.cpp

#pragma once
#pragma comment( lib, "user32" )

#define WIN32_LEAN_AND_MEAN 
#define _WIN32_WINNT  0x0500

#include <windows.h>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <map>
#include <tchar.h>
#include "TouchScreenDevice.h"
#include "TouchData.h"
#include <stdio.h>
#include <cvcam.h>

using namespace touchlib;

bool show_window=true;

ITouchScreen *screen;

class 
HelloFinger : public ITouchListener
{
public:
    
HelloFinger()
    
{
    }
    
~HelloFinger()
    
{
    }
    virtual void fingerDown
(TouchData data)
    
{
        printf
("TOUCH_DOWN: %f, %f\n",data.Xdata.Y);    
    
}

    virtual void fingerUpdate
(TouchData data)
    
{    
        printf
("TOUCH_MOVE: %f, %f\n",data.Xdata.Y);    
    
}

    virtual void fingerUp
(TouchData data)
    
{
        printf
("TOUCH_UP: %f, %f\n"data.Xdata.Y);    
    
}

private:
//
};

HelloFinger app;

int _tmain(int argcchar argv[])
{
    screen 
TouchScreenDevice::getTouchScreen();
    
cvNamedWindow"Hello Finger"CV_WINDOW_AUTOSIZE );
    
//! SET CONFIG MODE (Boolean)
    
screen->setDebugMode(false);
    
std::string recLabel,bgLabel;
    if(!
screen->loadConfig("config.xml"))
    
{
        std
::string capLabel screen->pushFilter("dsvlcapture");
        
screen->pushFilter("mono");
        
screen->pushFilter("smooth");
        
bgLabel screen->pushFilter("backgroundremove");
        
std::string bcLabel screen->pushFilter("brightnesscontrast");
        
recLabel screen->pushFilter("rectify");
        
screen->setParameter(recLabel"level""25");
        
screen->setParameter(capLabel"source""cam");
        
screen->setParameter(bcLabel"brightness""0.1");
        
screen->setParameter(bcLabel"contrast""0.4");
        
screen->saveConfig("config.xml");
    
}else{
        recLabel 
screen->findFirstFilter("rectify");                
        
bgLabel screen->findFirstFilter("backgroundremove");        
    
}
    screen
->registerListener((ITouchListener *)&app);
    
screen->beginProcessing();
    
SLEEP(1000);
    
screen->setParameter(bgLabel"mask", (char*)screen->getCameraPoints());
    
screen->setParameter(bgLabel"capture""");
    
screen->beginTracking();
    do
    
{       
       
// main loop.. do any graphics or sound updates here
        
screen->getEvents();
        
SLEEP(16);
    
while( show_window );
    
cvDestroyWindow"Hello Finger" );
    
//screen->saveConfig("config.xml");
    
TouchScreenDevice::destroy();
    return 
0;
}

 Signature 

~

Profile
 
 
Posted: 18 April 2008 04:39 AM   [ Ignore ]   [ # 17 ]
Jr. Member
Avatar
RankRank
Total Posts:  120
Joined  2008-01-28

how to make this run ?? ... plz

 Signature 

..’m not the best..but ‘m not like the rest....

Profile
 
 
Posted: 23 April 2008 05:18 AM   [ Ignore ]   [ # 18 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03

that example is not complete, you will need to link quite some *.lib files. Which depend on the used compiler.

 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 01 May 2008 12:57 AM   [ Ignore ]   [ # 19 ]
New Member
Avatar
Rank
Total Posts:  87
Joined  2008-01-16

Try Linux Touchlib Compiling Instructions. I hope that clears it up for you. smile

 Signature 

EasterIsland, LLC.
My Signature Quote

Profile
 
 
Posted: 08 May 2008 04:02 PM   [ Ignore ]   [ # 20 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03

I’ve attached an example project to get you guys starting with c++

File Attachments
example_project.zip  (File Size: 6KB - Downloads: 351)
 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 06 June 2008 05:27 AM   [ Ignore ]   [ # 21 ]
New Member
Rank
Total Posts:  8
Joined  2008-06-06

hi guy, i’m new in nui projects..
however i’ve try to compile your example_project and all the times i receive from vc++ “fatal error C1083: .. . . . . impossible open TouchScreenDevice.h, file not found” or similar.
I’ve configure my system following the instruction for compiling touchlib under windows , find under http://www.multigeture.net (about this, i receive problem with atlthunk.lib...why?)

thank you for your helping, i need you guys!

Profile
 
 
Posted: 06 June 2008 09:19 AM   [ Ignore ]   [ # 22 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03
pleo__ - 06 June 2008 05:27 AM

hi guy, i’m new in nui projects..
however i’ve try to compile your example_project and all the times i receive from vc++ “fatal error C1083: .. . . . . impossible open TouchScreenDevice.h, file not found” or similar.
I’ve configure my system following the instruction for compiling touchlib under windows , find under http://www.multigeture.net (about this, i receive problem with atlthunk.lib...why?)

thank you for your helping, i need you guys!

I think the path to the touchlib header files is set wrong. You could try to set this path manual in your visual studio project settings tab.

 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 09 June 2008 03:44 AM   [ Ignore ]   [ # 23 ]
New Member
Rank
Total Posts:  76
Joined  2008-05-20

hi,

i’ve got this runtime error “This application has failed to start because touchlibd.dll was not found. Re-installing the application may fix this problem.” when running the example_project

how do i fix this?

thanks

Profile
 
 
Posted: 10 June 2008 08:02 AM   [ Ignore ]   [ # 24 ]
New Member
Rank
Total Posts:  8
Joined  2008-06-06

i’ve got the same..i’m trying to solve it.
i’m not so skilled with c++ and vc++

edit: i cant find solution...anybody can tell us how we can do?

Profile
 
 
Posted: 10 June 2008 09:53 AM   [ Ignore ]   [ # 25 ]
New Member
Rank
Total Posts:  8
Joined  2008-06-06

ok ok, probably you’re in my same mystake
for me the fact is that i set the touchlib.lib in my path env var but not the touchlib.dll. For got it, you need to compile touchlib or find it under this forum.
When you’ve got it, you can set the path under path env var and run the example

Profile
 
 
Posted: 10 June 2008 11:13 AM   [ Ignore ]   [ # 26 ]
New Member
Rank
Total Posts:  8
Joined  2008-06-06
Falcon4ever - 08 May 2008 04:02 PM

I’ve attached an example project to get you guys starting with c++

hi falcon, thanks for your helping..i’ve got a question about your example_project.
After some stuff i’ve compile and launch it on my machine: is all ok but i’ve got an address violation on the first if, when in the main you search about the config.xml. On the methods call, i’ve got the address violation, and next, i can’t do nothing.
Well, i see some message on my console, but after a while, the address violation..can you tell me something about it?

sorry, i’m not skilled with c++ and i’m a NEWBIE in visual c++…

thanks!

Profile
 
 
Posted: 17 June 2008 04:49 AM   [ Ignore ]   [ # 27 ]
New Member
Rank
Total Posts:  1
Joined  2008-06-17

Hi, I am new to this nuigroup
I just downloaded and compile the example_project
i got a warning saying
warning C4251: ‘touchlib::IBlobTracker::listenerList’ : class ‘std::vector<_Ty>‘ needs to have dll-interface to be used by clients of class ‘touchlib::IBlobTracker’
1> with
1> [
1> _Ty=touchlib::ITouchListener *
1> ]

does this affect the program? as I got gray screen

Profile
 
 
Posted: 28 August 2008 11:48 AM   [ Ignore ]   [ # 28 ]
New Member
Avatar
Rank
Total Posts:  2
Joined  2008-08-27

I have the same problem here, it indicated about violation of memory.
I have configured the linking state properly.
Can anyone help?

Thanks in advance.

Profile
 
 
Posted: 29 August 2008 01:44 PM   [ Ignore ]   [ # 29 ]
Sr. Member
RankRankRank
Total Posts:  257
Joined  2008-06-09

Hello all,
So, what does this program do when you run it? Does “hello world” appear when you touch the screen? Also, should the libraries included in this project be included in all multi touch applications? Thanks,
rbedi100

 Signature 

My Multi Touch Blog

Profile
 
 
Posted: 29 August 2008 02:58 PM   [ Ignore ]   [ # 30 ]
New Member
Rank
Total Posts:  18
Joined  2008-08-09

The exampleapp.zip program uploaded in the post does nothing. It provides a working base for developing your own program.

 Signature 

Aug 28 19:44:19 <xeladude> sorry, that was a stupid question, MT helps everything:D

Profile