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 640×480, 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.
Latest Comments
RSS