#include <nrt/config.h>
#if defined(NRT_HAVE_CLOUD) && defined(NRT_HAVE_OPENNI)
using namespace nrt;
int main(int argc, char const* argv[])
{
try
{
mgr.launch();
window->createContext();
window->lookAt(Eigen::Vector3d(0, -3, 3), Eigen::Vector3d(0, 0, 0), Eigen::Vector3d::UnitZ());
bool first = false;
const size_t maxIters = 20;
Registration myRegistrationSVD( correspondenceEstimator, {correspondencePrunerDistance, correspondencePrunerRANSAC},
estimationSVD,
convergeCritera );
Registration myRegistrationLM( correspondenceEstimator, {correspondencePrunerDistance, correspondencePrunerRANSAC},
estimationLM,
convergeCritera );
bool downSample = true;
bool f2f = false;
std::mutex theMutex;
std::thread inputthread([&](){
while(true)
{
std::cout << "a to append q to quit r to reset: ";
char buf;
std::cin >> buf;
if(buf == 'q') exit(0);
else if( buf == 'a' )
{
std::lock_guard<std::mutex> lock( theMutex );
firstCloud.
append( downSampledCloudRotated );
firstCloudDense.
append( cloudRotated );
}
else if( buf == 'r' )
{
std::lock_guard<std::mutex> lock( theMutex );
firstCloud = downSampledCloud;
firstCloudDense = cloud;
}
else if( buf == 'f' )
{
std::lock_guard<std::mutex> lock( theMutex );
f2f = true;
firstCloud = downSampledCloud;
firstCloudDense = cloud;
}
}});
while (true)
{
if ( !mySource->ok() )
{
usleep( 1.0 / 100.0 * 1000000 );
continue;
}
window->initFrame();
mySource->in_rgbd(image, depth, ir);
auto data = mySource->getDeviceData();
{
data.Depth.focalLength, false);
if( downSample )
else
downSampledCloud = cloud;
}
{
if( downSample )
else
downSampledCloud = cloud;
}
if( !first )
{
firstCloudDense = cloud;
firstCloud = downSampledCloud;
first = true;
}
else
{
std::lock_guard<std::mutex> lock( theMutex );
t.reset();
alignment = myRegistrationLM.align( downSampledCloud, f2f ? previousCloud : firstCloud, lastAlignment );
lastAlignment = alignment;
previousCloud = downSampledCloud;
cloudRotated = cloud;
downSampledCloudRotated = downSampledCloud;
}
window->renderFrame();
}
}
return 0;
}
#else // no openni
int main(int argc, char const * argv[] )
{
return 0;
}
#endif // NRT_HAVE_OPENNI