@@ -103,7 +103,7 @@ extern "C" {
103103 int pageNo;
104104 int i, j, k;
105105 int flag = -1 ;
106- float err = - 1 ;
106+ float err;
107107 float trans[3 ][4 ];
108108 float trackingTrans[3 ][4 ];
109109 // filetring to verify
@@ -124,7 +124,7 @@ extern "C" {
124124 if (pageNo >= 0 && pageNo < arc->surfaceSetCount ) {
125125 ARLOGi (" Detected page %d.\n " , pageNo);
126126 arc->detectedPage = pageNo;
127- ar2SetInitTrans (arc->surfaceSet [pageNo ], trackingTrans);
127+ ar2SetInitTrans (arc->surfaceSet [arc-> detectedPage ], trackingTrans);
128128 } else {
129129 ARLOGe (" Detected bad page %d.\n " , pageNo);
130130 arc->detectedPage = -2 ;
@@ -135,7 +135,7 @@ extern "C" {
135135 }
136136 }
137137 if ( arc->detectedPage >= 0 && arc->detectedPage < arc->surfaceSetCount ) {
138- if ( ar2Tracking (arc->ar2Handle , arc->surfaceSet [pageNo ], arc->videoLuma , trackingTrans, &err) < 0 ) {
138+ if ( ar2Tracking (arc->ar2Handle , arc->surfaceSet [arc-> detectedPage ], arc->videoLuma , trackingTrans, &err) < 0 ) {
139139 ARLOGi (" Tracking lost.\n " );
140140 arc->detectedPage = -2 ;
141141 } else {
@@ -322,7 +322,7 @@ extern "C" {
322322
323323 int loadNFTMarker (arController *arc, int surfaceSetCount, const char * datasetPathname) {
324324 int i, pageNo;
325- AR2SurfaceSetT *surfaceSet;
325+ // AR2SurfaceSetT *surfaceSet;
326326 KpmRefDataSet *refDataSet;
327327
328328 KpmHandle *kpmHandle = arc->kpmHandle ;
@@ -353,12 +353,12 @@ extern "C" {
353353 // Load AR2 data.
354354 ARLOGi (" Reading %s.fset\n " , datasetPathname);
355355
356- if ((surfaceSet = ar2ReadSurfaceSet (datasetPathname, " fset" , NULL )) == NULL ) {
356+ if ((arc-> surfaceSet [surfaceSetCount] = ar2ReadSurfaceSet (datasetPathname, " fset" , NULL )) == NULL ) {
357357 ARLOGe (" Error reading data from %s.fset\n " , datasetPathname);
358358 }
359359 ARLOGi (" Done.\n " );
360360
361- arc-> surfaceSets [ surfaceSetCount] = surfaceSet ;
361+ if ( surfaceSetCount == PAGES_MAX) exit (- 1 ) ;
362362
363363 if (kpmSetRefDataSet (kpmHandle, refDataSet) < 0 ) {
364364 ARLOGe (" Error: kpmSetRefDataSet\n " );
0 commit comments