BBTouch, code, multitouch

BBTouch minor updates17 Jun

Hello all, thanks for all the helpful feedback, don't hesitate to let me know if you find any problems or have ideas for more features.

I just committed a handful of updates. Mostly it was to clean up all the compiler warnings, now you should have a warning-free compile (with the exception of all the " warning: 'GetPortPixMap' is deprecated" stuff that you get from the sequence grabber code. I really really do want to use the QTCapture stuff, but i also really really need to be able to turn off the auto exposure and auto gain for the camera... sigh... oh well, someday i will be able to jettison the SG code...

Also, I added some filtering for the ROI so now you cant inadvertently set it too big (ie out of image bounds) which would cause some crashing.

Last thing added today was a config pref for the raw size. if you are using older hardware and you find that it is kinda lagging on a 640x480 image, you can set it to a lower rez and it will speed up dramatically. note: you will have to quit and restart BBTouch for that to update (for now).

also: added an app icon:

it is just a simple one. didn't want to spend too much time on it, but i was tired of the ugly generic app icon :-)

BBTouch, code, multitouch

BBTouch design15 Jun

At this point the BBTouch codebase should be ready to build apps on. There is plenty more work to be done to make it more robust and friendly, but everything should be there for a basic multi-touch system.

I want to talk briefly about the design, and what is going on so that others can build apps on top of this base if they want to.

There are three main objects:

the ConfigurationController

the InputController

the BlobEventController

The Config Controller holds all the 'global' configuration values. this is basically 2 things: the raw video size (which is currently hardcoded at 640x480, but that will change) and the region of interest (in relation to the raw video feed)the config controller's main responsibility is to convert from raw camera coordinates to 'screen' coordinates. Which is currently a normalized value between 0 and 1 relative to the region of interest.

The InputController handles the raw video and makes sure that it gets to the blob detector and that the blob event controller gets any found blobs.  The raw video is currently using the SequeceGrabber API, and the image format is NSImage based. The IC is responsible for setting up the camera object and the blob detector object.  For every frame from the camera, the IC sends the raw data (in the form of an NSImage) to the blob detector. It then queries the blob detector and sends any 'raw' blob objects to the BlobEventController.

The Blob Event Controller takes the raw blob data and 'tracks' the blobs. it decides whether the raw blobs are continuations of older blobs or new ones. it send messages to it's delegate whenever there is a blob down, a blob drag, or a blob up. It also tells the delegate when the current cycle is finished.

That is the basic design.  There are a few more objects that are interesting to note:

The Simple Event Delegate: this is where you would start if you wanted to have the system generate any type of event, or if you wanted to have it send TUIO events down a serial stream, or whatever.  Currently the Simple Event Delegate just generates some NSNotifications for each event, effectively passing them onto anyone who wants to listen for them (in the same app).

Along with that is the Simple Event View, which uses the Notifications generated by the Simple Event Delegate to draw the blobs into it's bounds.  It is very simple however, and I would suggest that you look to the ProjectionConfigView for a slightly better subclass.  (the ProjectionConfigView forces  the same aspect ration as the ROI, which is not necessarily what you want, but is an example of how to use the blob data in a slightly different way.

right now there is not a good full-screen projection config. that is what I am going to work on next.  However, that is not strictly necessary for you to build your apps.

Hopefully this all helps.  Also, I have tried to be very verbose in the code comments, so check those out as well

all code is available at http://code.google.com/p/opentouch.

code, multitouch

Configuration Window15 Jun

Sorry for the big delay since the last update. I was out of town and then I had a paying job come up, so the free stuff had to wait :-) That said, anyone who wants to pay me to work on this, let me know :-)

anyway...

OK, so now the config window is basically done. It has two very simple views. The first is a raw video view that also shows the region of interest. (ie where you want to look for blobs). and the second shows how the blobs get translated to your surface. (scaled down).

the config window

On the left is the raw video/ROI config. you can grab the edges of the red ROI rectangle to adjust the ROI shape (you will see an adjustment cursor). you can also drag the whole thing around from the center of the rectngle (a hand cursor).

the right hand side is the projection config view. it helps get your blobs moving in the proper directions. You can affect this with the rear projection and vertical mirror prefs. These dont affect the raw video (it is the RAW video after all) but do affect how the blobs get translated to the screen coordinates. so you can use those to make sure that your blobs are moving up when you move your hand up and left when you move your hand left etc. You can see in the picture how my set up works. I am projecting from below the surface, and the camera raw video is upside down. However you can see that the blobs are oriented properly (and altho you cant see it, they track properly as well)

I also updated a whole bunch of other code. I made some small changes to the main blob detector so that I can more easily integrate a drop in-replacement that handles CIImages so that it is easier to use the CIFilters that are so handy.

I also 'finished' the configurator coordinate converter. Now it generates 'screen' coordinates that are simply normalized values related to the ROI. currently they follow the NSView coordinate scheme so a blob in the lower left of the ROI (lower left to the user, however you have that setup via the projection prefs) will be at coordinates 0,0 and the upper left will be at 1,1. a point in the center would show up as 0.5,0.5. this makes it nice and easy to make windows that take up your whole projection surface and place the blobs properly into them. (i had originally thought about providing screen coordinates, but that is a bit unwieldy, and this way is easier, i think)

all the code is available here: http://code.google.com/p/opentouch/.

meta

wordpress upgrade14 Jun

after getting some junk spam comments, and noticing that I am behind the curve. I have upgraded my wordpress install.  This will most likely break everything.

BBTouch, FTO xpost, code, multitouch

More New Code01 Jun

I just put up a few new objects into the BBTouch project in the openTouch repository. Not all of it has been fully tested, but it seemed to work OK.

There is now an event controller that generates events for a delegate object. I also made a simple delegate that just resends the events as notifications. In the future there could be delegates to generate system -level events, or TUIO events on a serial port, or whatever.

There is also the stub of a configuration manager that does very little right now, but will eventually house all the configuration data and objects.

I am gong to be gone for a few days so there probably wont be any updates from my end until late next week.

About

meMy full name is Ben Britten Smith.

I go by Ben Britten because Ben Smith is a bit too common and using my full name is a mouthful.

I live in Melbourne, Australia and service clients all over the globe.

Contact

Have some questions?

Feel free to contact me directly at support@benbritten.com with any questions you might have about any of the applications I support.

Thanks!

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIGFib3V0LXdpZGdldDwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL2JlbmJyaXR0ZW4uY29tL3dwLWNvbnRlbnQvdGhlbWVzL3ZpYnJhbnRjbXMvaW1hZ2VzL2FkNDY4LmpwZzwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X3VybDwvc3Ryb25nPiAtIGh0dHA6Ly93d3cud29vdGhlbWVzLmNvbTwvbGk+PGxpPjxzdHJvbmc+d29vX2FsdF9zdHlsZXNoZWV0PC9zdHJvbmc+IC0gYmVuYnJpdHRlbi5jc3M8L2xpPjxsaT48c3Ryb25nPndvb19ibG9ja19pbWFnZTwvc3Ryb25nPiAtIGh0dHA6Ly9iZW5icml0dGVuLmNvbS93cC1jb250ZW50L3RoZW1lcy92aWJyYW50Y21zL2ltYWdlcy9hZDMzNi5qcGc8L2xpPjxsaT48c3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