ARToolKit FAQs

From ARToolworks support library

Jump to: navigation, search

Main Page > ARToolKit Professional > ARToolKit FAQs

What is the difference between arGetTransMatSquare, arGetTransMatSquareCont, and arGetTransMat?

These are variants on the same algorithm.

  • arGetTransMat is the most generic, and gets a pose estimate based on a set of 2D feature points.
  • arGetTransMatSquare is the primary use of arGetTransMat, and works with the constrained case when the 2D feature points are corners of a square. All of the fiducial tracking uses this variant in the user-facing API, the more generic version being used only in our NFT library.
  • arGetTransMatSquareCont enables optimisations in the pose estimate search when a previous valid pose (i.e. the pose from the last frame) is known. It basically begins the pose estimate search with the previous pose and is thus a lot faster. If no previous pose exists, or if there is likely to be significant change between the previous pose and the current pose (e.g. a significant amount of time has passed, or other means such as inertial tracking have been used to determine that significant inter-frame motion has occured) then arGetTransMatSquare should be used instead.

The sample tracking algorithm supplied with the ARToolKit examples displays this usage (code from simpleOSG.c):

			if (k != -1) {
				// Get the transformation between the marker and the real camera.
				//fprintf(stderr, "Saw object %d.\n", i);
				if (gObjectData[i].visible == 0) {
					err = arGetTransMatSquare(gAR3DHandle, &(gARHandle->markerInfo[k]),
											  gObjectData[i].marker_width, gObjectData[i].trans);
				} else {
					err = arGetTransMatSquareCont(gAR3DHandle, &(gARHandle->markerInfo[k]),
												  gObjectData[i].trans,
												  gObjectData[i].marker_width, gObjectData[i].trans);
				}
				gObjectData[i].visible = 1;
			} else {
				gObjectData[i].visible = 0;
			}