Recently, I have been working on the Touchlib in order to refine some things, which always bothered me and to add some things of which I think that they would come in handy e.g. a full-grown Pointgrey Flycapture2 filter that allows me to edit the Pointgrey Firefly MV camera’s settings in a way that I described here.
After being able to compile the Touchlib I quickly grew curious about what all those blobconfig parameters in the Touchlib’s config.xml REALLY do.
First of all, some parameters are really useful and it is a shame that the functionality is (nearly) nowhere documented. Even the pros in the nuigroup seem not to know for which purpose they are being used.
If someone wants to know why I am using the Touchlib and not tBeta aka CCV that is because CCV keeps crashing on my computers and I do not have Visual Studio 2008, which is necessary to compile CCV on Windows. Additionally, I had a student adding fiducial support to the Touchlib (by adding the reacTIVision code). Thus, I currently stick to the Touchlib.
Disclaimer: The code version of the Touchlib I used is the one that my student tweaked while adding reacTIVision fiducial support. You can find the Touchlib’s source code at the Touchlib code repository in Google code. However, many users are constantly submitting their code changes to this repository. E.g. the newest file of CBlobTracker, which does the actual tracking of blobs in the camera’s image, does not include the setup function anymore in which certain values of config.xml have been set for the tracker. Thus, those values are not being used in the code version anymore. However, they should still be used in the binary version that you can download here. I will use this older version of CBlobTracker to explain some parameter’s functionalities of config.xml. However, I think that in the Touchlib’s binary version those parameters are being used.
Touchlib searches in subsequent captured frames from the camera for the same blobs. I.e. if a blob in the previous frame has been found at position (x=250, y=300) and in the current frame a blob has been found at position (x=251,y=299) Touchlib interprets this as the same blob. However, tracking is not that simple that Touchlib could search for a blob in the direct surrounding but for each blob of a previous frame all blobs in the current frame are being compared for their distance. Touchlib thinks that the blob in the current frame with the shortest distance is the same blob (It is not that simple but let’s stick to this for now).
1. Attribute minDimension (very handy!):
This is the minimum size that a blob must have. If you e.g. have lots of small white dots in the RectifyFilter that are smaller than minDimension they must not be tracked. (see CBlobTracker line 209). Default value of minDimension is 2. I use a minDimension of 5. However, the appropriate minDimension depends on your camera’s resolution and your table’s size.
2. Attribute maxDimension (very handy!):
This is the maximum size that a blob can have. (see CBlobTracker line 209). Default is 250, which is way too big. I use a maxDimension of 20. However, the appropriate maxDimension depends on your camera’s resolution and your table’s size. This value is extremely handy if you want to prevent that a big object (like a cup or a sheet of paper) that is being put onto the touch surface is recognized as a touch.
3. Attribute distanceThreshold:
With distanceThreshold you can configure with which distance another blob in a consecutive frames might still be interpreted as the same blob. E.g. if distanceThreshold is big the distance between the two blobs can be big and vice versa. (see CBlobTracker lines 755 ff.). I currently do not see the point of this parameter.
4. Attribute minDisplacementThreshold (does nothing so far):
Should do basically the same as distanceThreshold but inverted: minDisplacementThreshold configures how far a blob must have been moved in order that an update is being sent. However, it is being set in CBlobTracker in line 51 but nowhere used in the code.
5. Attribute ghostFrames:
I do not know exactly what ghostFrames does. However, I guess that it regulates the amount of frames in which a blob is not being found in the current frame (for the count of ghostFrames frames) but not deleted as well out of the list of blobs. Thus, if a ghost frame is being sent by the camera (maybe an empty image because of capturing problems) not all blobs are being deleted but the ghost frame can be ignored. However, as I said I do not know the exact functionality. For more detail see CBlobTracker lines 717 – 732.