Esempio n. 1
0
int ar2GetResolution( ARParamLT *cparamLT, float  trans[3][4], float  pos[2], float  dpi[2] )
{
    if( cparamLT != NULL ) {
        return ar2GetResolution2( &(cparamLT->param), trans, pos, dpi );
    }
    else {
        return ar2GetResolution2( NULL, trans, pos, dpi );
    }
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
    ARParam cparam;
    // ARParamLT          *cparamLT;
    float trans[3][4];
    float pos[2];
    float dpi[2];
    // char                name[1024], ext[1024];
    int   i, j;
    float z;

    init(argc, argv);

    if (!cpara)
        cpara = cparaDefault;

    // ar2UtilDivideExt( cpara, name, ext );

    // Load the camera parameters, resize for the window and init.
    // if( arParamLoad(name, ext, 1, &cparam) < 0 )
    if (arParamLoad(cpara, 1, &cparam) < 0)
    {
        ARLOGe("setupCamera(): Error loading parameter file %s for camera.\n", cpara);
        exit(-1);
    }

    if (xsize != -1 && ysize != -1 && (cparam.xsize != xsize || cparam.ysize != ysize))
    {
        ARLOG("*** Camera Parameter resized from %d, %d. ***\n", cparam.xsize, cparam.ysize);
        arParamChangeSize(&cparam, xsize, ysize, &cparam);
    }

    ARLOG("*** Camera Parameter ***\n");
    arParamDisp(&cparam);

    // if ((cparamLT = arParamLTCreate(&cparam, AR_PARAM_LT_DEFAULT_OFFSET)) == NULL) {
    //    ARLOGe("setupCamera(): Error: arParamLTCreate.\n");
    //    exit(-1);
    // }

    pos[0] = 0.0;
    pos[1] = 0.0;

    for (j = 0; j < 3; j++)
        for (i = 0; i < 4; i++)
            trans[j][i] = ((i == j) ? 1.0 : 0.0);

    for (i = 10; i <= 1000; i *= 10)
    {
        for (j = 1; j < 10; j++)
        {
            z           = j * i;
            trans[2][3] = z;
            ar2GetResolution2(&cparam, trans, pos, dpi);
            ARLOG("Distance: %f [mm] --> Resolution = %10.5f, %10.5f [DPI]\n", z, dpi[0], dpi[1]);
        }
    }

    return (0);
}