Skip to content

Commit

Permalink
trackingInitGetResult instead of kpmGetResult
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Jul 22, 2019
1 parent 162bc15 commit 41eb40a
Show file tree
Hide file tree
Showing 5 changed files with 1,946 additions and 1,941 deletions.
3,837 changes: 1,915 additions & 1,922 deletions build/artoolkitNft.debug.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions build/artoolkitNft.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/artoolkitNft_wasm.js

Large diffs are not rendered by default.

Binary file modified build/artoolkitNft_wasm.wasm
Binary file not shown.
22 changes: 17 additions & 5 deletions emscripten/ARToolKitJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,40 @@ extern "C" {

KpmResult *kpmResult = NULL;
int kpmResultNum = -1;
int pageNo;

//kpmGetResult( arc->kpmHandle, &kpmResult, &kpmResultNum );

kpmGetResult( arc->kpmHandle, &kpmResult, &kpmResultNum );

int i, j, k;
int flag = -1;
float err = -1;
float trans[3][4];
float trackingTrans[3][4];

kpmResultNum = trackingInitGetResult( arc->threadHandle, trackingTrans, &pageNo);
ARLOGi("kpmResultNum is: %d\n", kpmResultNum);

for( i = 0; i < kpmResultNum; i++ ) {
if (kpmResult[i].pageNo == markerIndex && kpmResult[i].camPoseF == 0 ) {
if( flag == -1 || err > kpmResult[i].error ) { // Take the first or best result.
//if (kpmResult[i].pageNo == markerIndex && kpmResult[i].camPoseF == 0 ) {
if (pageNo == markerIndex ) {
// if( flag == -1 || err > kpmResult[i].error ) { // Take the first or best result.
if( flag == -1 ) { // Take the first or best result.
flag = i;
err = kpmResult[i].error;
ARLOGe("error in the tracking");
}
}
}

flag = kpmResultNum;
ARLOGi("flag is: %d\n", flag);
if (flag > -1) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 4; k++) {
trans[j][k] = kpmResult[flag].camPose[j][k];
trans[j][k] = trackingTrans[j][k];
}
}
//ARLOGi("trackingTrans %d\n", trans);
EM_ASM_({
var $a = arguments;
var i = 0;
Expand Down

0 comments on commit 41eb40a

Please sign in to comment.