AppController::AppController() : lastTick_(0), frameCounter_(0), frameRate_(0) { model_ = new AppModel(); gui_ = new MainWindow(model_, this); // register data update functions to model boost::function<void()> data_cb = boost::bind(&AppController::dataUpdated, this); update_con_ = model_->registerCallback(data_cb); // register pointpick callback of model to gui boost::function<void(const pcl::visualization::PointPickingEvent &)> pointpick_cb = boost::bind(&AppModel::pickPoint, model_, _1); gui_->registerPointPickCallback(pointpick_cb); // connect signal / slots to gui connect(this, SIGNAL(newCloud()), gui_, SLOT(updatePointCloud())); connect(this, SIGNAL(newSmallCloud(void)), gui_, SLOT(updateSmallPointCloud(void))); qRegisterMetaType<QImage>("QImage"); connect(this, SIGNAL(newRgbImage(QImage)), gui_, SLOT(updateRgbImage(QImage))); qRegisterMetaType<QString>("QString"); connect(this, SIGNAL(newStatusMessage(QString)), gui_, SLOT(updateStatusMessage(QString))); gui_->show(); }
void SLPointCloudWidget::keyPressEvent(QKeyEvent *event){ // std::cout << event->key() << std::endl; // Switch between color handlers switch(event->key()){ case '1': surfaceReconstruction = false; visualizer->removePolygonMesh("meshPCL"); colorHandler = new pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB>(); break; case '2': surfaceReconstruction = false; visualizer->removePolygonMesh("meshPCL"); colorHandler = new pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZRGB>("z"); break; case '3': surfaceReconstruction = true; visualizer->removePointCloud("pointCloudPCL"); break; } updatePointCloud(pointCloudPCL); if(!(('0' <= event->key()) & (event->key() <= '9'))) QVTKWidget::keyPressEvent(event); }
void testApp::update() { if(reloadImage) { curKinect = loadRaw(kinectList.getPath(curImage), 640, 480); // curKinect.loadRaw(kinectList.getPath(curImage), 640, 480); kinectCalibration.undistort(toCv(curKinect)); updatePointCloud(); curColor.loadImage(colorList.getPath(curImage)); curColor.update(); updateColors(); reloadImage = false; } }