La Réalité Augmentée

ARToolKit

ARToolKit est une bibliothèque logicielle permettant de créer ses propres applications de réalité augmentée. Il permet d'affranchir le développeur de tous les calculs d'analyse et de rendu d'images dont nous avons parlés précédemment.

Architecture

La bibliothèque se découpe en trois couches principales:

Architecture

Fonctionnement globale

Le fonctionnement globale d'une application de réalité augmentée en utilisant ARToolKit se décompose en 5 étapes distinctes :

Fonctionnement global

Développement

Utilisation du pattern dans le code

char *patt_name = "Data/patt.hiro";
static void init( void )
{
	arParamChangeSize( &wparam, xsize, ysize, &cparam );
	arInitCparam( &cparam );
	printf("*** Camera Parameter ***\n");
	arParamDisp( &cparam );
	if( (patt_id=arLoadPatt(patt_name)) < 0 ) {
		printf("pattern load error !!\n");
		exit(0);
	}

	/* open the graphics window */
	argInit( &cparam, 1.0, 0, 0, 0, 0 );
}

				

Chargement d'une image

					
static void mainLoop(void)
{
	static int      contF = 0;
	ARUint8         *dataPtr;
	ARMarkerInfo    *marker_info;
	int             marker_num;
	int             j, k;
		
	/* grab a vide frame */
	if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL )
	{
		arUtilSleep(2);
		return;
	}
	if( count == 0 ) arUtilTimerReset();
		count++;
	argDrawMode2D();
}
	
				

Détection du marqueur


/* grab a vide frame */
if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ){
	arUtilSleep(2);
    return;
}
if( count == 0 ) arUtilTimerReset();
count++;
argDrawMode2D();
argDispImage( dataPtr, 0,0 );

/* detect the markers in the video frame */
if( arDetectMarker(dataPtr, thresh, &marker_info,&marker_num) < 0 ){
    cleanup();
    exit(0);
}
arVideoCapNext();

				

Calcul de la matrice de transformation


/* check for object visibility */
....
/* get the transformation between the marker and the real camera */
arGetTransMat(&marker_info[k], patt_center, patt_width, patt_trans);
draw();
argSwapBuffers();
}

				

Notre première application!!!

Première application de réalité augmentée

OSGArt >>>