forked from carlren/LibISR
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.cpp
64 lines (46 loc) · 2.16 KB
/
demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2014-2015 Isis Innovation Limited and the authors of LibISR
#include <stdio.h>
#include"LibISR/LibISR.h"
#include"LibISR/UI/ImageSourceEngine.h"
#include"LibISR/UI/OpenNIEngine.h"
#include"LibISR/UI/UIEngine.h"
#include"LibISR/Utils/IOUtil.h"
#include"LibISR/Utils/NVTimer.h"
using namespace LibISR::Engine;
using namespace LibISR::Objects;
using namespace LibISRUtils;
using namespace std;
int main(int argc, char** argv)
{
//////////////////////////////////////////////////////////////////////////
// setup for live demo
//////////////////////////////////////////////////////////////////////////
if (argc !=3){
std::cout<<"Usage: ./demo <path to SDF model> <path to calib file>"<<std::endl;
return -1;
}
const char *sdfFile = argv[1];
const char *calibFile = argv[2];
// const char *sdfFile = "/home/carl/Work/Code/github/LibISR/Data/teacan.bin";
// const char *calibFile = "/home/carl/Work/Code/github/LibISR/Data/calib_reg.txt";
ImageSourceEngine *imageSource = new OpenNIEngine(calibFile, NULL, true);
ISRLibSettings isrSettings;
isrSettings.noHistogramDim = HISTOGRAM_BIN;
isrSettings.noTrackingObj = 1;
isrSettings.singleAappearanceModel = true;
isrSettings.useGPU = true;
ISRCoreEngine *coreEngine = new ISRCoreEngine(&isrSettings, &imageSource->calib, imageSource->getDepthImageSize(), imageSource->getRGBImageSize());
coreEngine->shapeUnion->loadShapeFromFile(sdfFile, Vector3i(DT_VOL_SIZE, DT_VOL_SIZE, DT_VOL_SIZE), 0);
for (int i = 1; i < isrSettings.noTrackingObj; i++)
coreEngine->shapeUnion->shareSDFWithExistingShape(*coreEngine->shapeUnion->getShape(0), i);
// initial pose for the tracker
float poses[6] = { 0.0f, 0.0f, 0.8f, -PI/2 , 0, 0 };
coreEngine->trackingState->setHFromParam(poses, 0);
///////////////////////////////////////////////////////////////////////////
// run it!
///////////////////////////////////////////////////////////////////////////
UIEngine::Instance()->Initialise(argc, argv, imageSource, coreEngine, "./");
UIEngine::Instance()->Run();
UIEngine::Instance()->Shutdown();
return 0;
}