artoolkit-docs

Advanced FAQs

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

These are variants on the same algorithm:

The sample tracking algorithm supplied with the ARToolKit examples displays a good usage strategy (code from simpleOSG.c, with extra commenting):

    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) { // .visible is 0 when the marker was not seen in the previous frame.
            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; // Next time around, arGetTransMatSquareCont will be used.
    } else {
        gObjectData[i].visible = 0;
    }

Why isn’t my performance as good as your demos?

ARToolKit works best with a controlled optical environment, in which the image acquired by the camera has a high signal-to-noise ratio, and when the properties of the optical environment are well known; when the lighting is bright (so the camera gain is low, and depth of field is good), when the camera is a good quality camera (with a CMOS sensor, with a large sensor surface, and with good lenses with good light-gathering properties), and when the camera has been accurately calibrated. If any of these requirements can’t be met, performance will be less than the ideal case, but in most cases still usable. See about hardware selection here