1

I am trying to use ARtoolkit to detect markers from a number of videos. For each video source, I initialise the arHandle using the following code:

    ARParam         cparam;
    AR_PIXEL_FORMAT pixFormat = AR_PIXEL_FORMAT_RGB;

    cparam.xsize = 1000;
    cparam.ysize = 800; 
    cparam.dist_function_version = 1

    for(int i = 0; i < 4; ++i){
        cparam.dist_factor[i] = calib.distParams[i];
    }
    for(int i = 0; i < 3; ++i){
        for(int j = 0; j < 3; ++j){
            cparam.mat[i][j] = calib.K(i,j);
        }
    }
    for(int i = 0; i < 3; i ++){
        cparam.mat[i][3] = 0.0f;
    }

    arParamDisp( &cparam );

    if ((gCparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) {
        ARLOGe("Error: arParamLTCreate.\n");
        exit(-1);
    }
    if( (arHandle=arCreateHandle(gCparamLT)) == NULL ) {
        ARLOGe("Error: arCreateHandle.\n");
        exit(0);
    }
    if( arSetPixelFormat(arHandle, pixFormat) < 0 ) {
        ARLOGe("Error: arSetPixelFormat.\n");
        exit(0);
    }
    if( (arPattHandle=arPattCreateHandle()) == NULL ) {
        ARLOGe("Error: arPattCreateHandle.\n");
        exit(0);
    }

    patt_id.push_back(arPattLoad(arPattHandle, "hiro.patt"));

    arPattAttach(arHandle, arPattHandle); 

where the calibration information (calib) is calculated for each camera. The handles are created and patterns loaded without error.

I then try to detect the "hiro" marker in each video source using:

    arDetectMarker(arHandle, img.data);

where img is cv::Mat representing each frame of the video in RGB. Its opencv type is CV_8UC3.

However, I always find that markerNum = arGetMarkerNum(arHandle) = 0, for each camera.

Does anyone know why I might be having this problem?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

0 Answers0