Exemplo n.º 1
0
int ar2GetImageValue2(const ARParamLT *cparamLT, const float trans[3][4], const AR2ImageT *image,
                      const float sx, const float sy, const int blurLevel, ARUint8 *pBW1, ARUint8 *pBW2, ARUint8 *pBW3)
{
    float mx, my;
    float iix, iiy;
    int   ix, iy;

    if (ar2ScreenCoord2MarkerCoord(cparamLT, trans, sx, sy, &mx, &my) < 0)
        return -1;

    ar2MarkerCoord2ImageCoord(image->xsize, image->ysize, image->dpi, mx, my, &iix, &iiy);
    ix = (int)(iix + 0.5);
    iy = (int)(iiy + 0.5);

    if (ix < 0 || ix >= image->xsize
        || iy < 0 || iy >= image->ysize)
        return -1;

    if (blurLevel < 1)
        blurLevel = 1;

    if (blurLevel >= AR2_BLUR_IMAGE_MAX - 1)
        blurLevel = AR2_BLUR_IMAGE_MAX - 2;

    *pBW1 = image->imgBWBlur[blurLevel - 1][iy * image->xsize + ix];
    *pBW2 = image->imgBWBlur[blurLevel][iy * image->xsize + ix];
    *pBW3 = image->imgBWBlur[blurLevel + 1][iy * image->xsize + ix];

    return 0;
}
Exemplo n.º 2
0
int ar2GetImageValue( const ARParamLT *cparamLT, const float  trans[3][4], const AR2ImageT *image,
                      const float  sx, const float  sy, const int blurLevel, ARUint8 *pBW )
{
    float   mx, my;
    float   iix, iiy;
    int     ix, iy;

    if( ar2ScreenCoord2MarkerCoord( cparamLT, trans, sx, sy, &mx, &my ) < 0 ) return -1;
    ar2MarkerCoord2ImageCoord( image->xsize, image->ysize, image->dpi, mx, my, &iix, &iiy );
    ix = (int)(iix + 0.5F);
    iy = (int)(iiy + 0.5F);

    if( ix < 0 || ix >= image->xsize
     || iy < 0 || iy >= image->ysize ) return -1;

    *pBW = image->imgBWBlur[blurLevel][iy*image->xsize+ix];

    return 0;
}