Dealing with multitouch events

37 views
Skip to first unread message

greyscale

unread,
Oct 12, 2010, 9:27:22 AM10/12/10
to va-users
Hi everyone,

I'm very new to VirtualAwesome and the Nortd Touchkit and I was
wondering if someone had a simple code example that deals with
multitouch events e.g. moving a picture, zooming, rotating...

Thank you for your help.

stefan)

unread,
Oct 13, 2010, 10:44:54 AM10/13/10
to va-u...@googlegroups.com
hey grayscale,

moving is easy, just use a PanelWidget (which can be invisible) and
nest the image in it. There is some code in exampleWidget for that.
Basically you write something like mypanel->addChild(myimageshape).

As for zooming and rotating, these are basically gestures. At this
point there is no gesture recognizer in va. The way of doing this
would be to write your own code into the basic touch handlers. This
can be done in many ways but probably the best way is to write a
PanelGestureWidget analog to PanelWidget with gesture code in
touchDown, touchMove, touchUp.

As for the transformation you would probably want set the pivot point
(this->setPivot(x,y,z)) to the midpoint between the two touches, set
the scale (this->setScale(x,y,z)) to the overall distance delta
between the touches, and the rotation (this->setRotation(angle,
0,0,1)) to the overall angle delta of the line between the touches.

If I get a chance I will try to post some code ...

/stefan

greyscale

unread,
Oct 14, 2010, 3:54:08 AM10/14/10
to va-users
Hi Stefan,

Thank you for your quick reply. I'll have a look at the PanelWidget
and the different ways to handle gestures.

I got two more questions if I may post them here in the same thread.

- How to flip the video stream captured by the camera (horizontal and
vertical) ? Currently, every move is inverted when I run the
exampleTouchkitSimple.

- I've got lots of linking warnings (LNK4099) when I'm compiling the
exampleTouchkitSimple project related to the vaOpenCV libs (e.g.
warning LNK4099: PDB 'cxcore110d.pdb' was not found with '..\..\..
\addons\vaOpencv\libs\opencv-win32\lib\cxcore110d.lib' or at 'D:
\Workspace\VirtualAwesome\apps\addonExamples\exampleTouchkitSimple\bin
\Debug\cxcore110d.pdb'; linking object as if no debug info). Is this a
known issue or am I doing something wrong ?

Many thanks for your help.

Regards

stefan)

unread,
Oct 18, 2010, 8:59:45 PM10/18/10
to va-u...@googlegroups.com
hey grayscale,

Just added some example code to the virtualawesome git repository:
http://github.com/stefanix/VirtualAwesome

You will find a new GestureWidget class that handles basic two finger
gestures like, drag, pinch-zoom, rotate. You can either subclass it
for your own widgets or you can use it as a starting point for writing
your own gesture recognizer. Basically all the action happens in
touchDown and touchMove. Along with this new class there is also an
exampleGestureWidget for testing. At the moment exampleGestureWidget
uses an apple touchpad for input but the same code works in the
touchkit example.

Please be aware that there are some minor changes (from va 0.4.3) in
the Node and Widget classes on which the GestureWidget depends on.
Also if you use the latest repository code you will have to drop in
the precompiled libs manually that are bundled with the release
downloads. The repo does not include these dependencies.


> How to flip the video stream

I am surprised your feed is flipped. What OS, Camera are you using?
To fix this you can go to the Tracker.cpp file, around line 198 and
uncomment the following:
// _image->flip(true, false);
If I remember correctly, first parameter is horizontal flip and second
vertical flip.


> I've got lots of linking warnings

They should be fine. From what you sent me I think it just means that
some of the dependency libs don't have debug info.


The gesture code is not super trivial. Quite some matrix math
involved. Feel free to ask about any details.

Hope this helps,

/stefan

--
Stefan Hechenberger, Nortd Labs
http://labs.nortd.com | http://blog.nortd.com

greyscale

unread,
Oct 21, 2010, 4:51:17 AM10/21/10
to va-users
Hi Stefan,

Thank you for your precious help !

>> Just added some example code...

I'll take a look at your code example and play around with it a bit.

>> What OS, Camera are you using?

Actually, I'm using the Firefly cam provided with your Touchkit with
the FlyCapture 2.1 (release 04) driver on Windows 7.

By the way, the image->flip(true, false) line works fine.

Regards.

On Oct 19, 2:59 am, "stefan)" <ste...@nortd.com> wrote:
> hey grayscale,
>
Reply all
Reply to author
Forward
0 new messages