Exemplo n.º 1
0
void Main::cmdReceivedCB(const std_msgs::CharConstPtr & cmd)
{
  switch (cmd->data)
    {
    case 'b':
      clearBackground();
      break;
    case 'c':
      stopTracking();
      break;
    case 'l':
      toggleLearning();
      break;
    case 'a':
      alternatingMode();
      break;
    case 'e':
      exportModel();
      break;
    case 'i':
      importModel();
      break;
    case 'r':
      reset();
      break;
    case 'v':
      sendCenterView();
      break;
    default:
      break;
    }
}
Exemplo n.º 2
0
bool tPclExport::exportToFile(QString fileName, tModel *m){

//  QDomElement root,tag;
  QFile file;
  QString docType;
  QDomElement tag,oldTag;

  docType = "poti_control";

  file.setFileName(fileName);

  if (file.open(QIODevice::WriteOnly)){
    XML = new QDomDocument(docType);
    root = XML->createElement(docType);
    XML->appendChild(root);

    exportModel(m);

    // XML in eine Datei schreiben
    QTextStream stream(&file);
    stream << XML->toString();
    file.close();
    delete XML;
    return true;
  } else {
//    fErrorMessages << "Can't write the given file: \"" + fileName + "\"";
    return false;
  }
}
Exemplo n.º 3
0
    //void Main::cmdReceivedCB(const std_msgs::CharConstPtr & cmd)
    void Main::cmdReceivedCB(const std_msgs::StringConstPtr & cmd)
    {
	  char cd=cmd->data.c_str()[0];
      //switch (cmd->data)
      switch (cd)
      {
        case 'b':
          clearBackground();
          break;
        case 'c':
          stopTracking();
          break;
        case 'l':
          toggleLearning();
          break;
        case 'a':
          alternatingMode();
          break;
        case 'e':
          exportModel();
          break;
        case 'i':
          importModel();
          break;
        case 'r':
          reset();
          break;
        default:
          break;
      }
    }
bool
ossimOutlierRejection::execute()
{
   if(!setupModel(theModelDefinitionString))
   {
      return false;
   }
   ossim_float64 variance_pix2;
   if(removeOutliers(&variance_pix2, NULL)) //TBD : use target variance
   {
      //display RMS with unit
      cout<<"RMS="<<std::sqrt(variance_pix2)<<" pixels"<<endl;

      //export results
      if(theGeomOutputFilename!="")
      {
         if(!exportModel(theGeomOutputFilename)) return false;
      }
      if(theInlierOutputFilename!="")
      {
         if(!saveGMLTieSet(theInlierOutputFilename)) return false;
      }
   }
   else
   {
      return false;
   }

   return true;
}
Exemplo n.º 5
0
// Save all models under their original names
void Aten::saveModels()
{
	for (Model* m = models_.first(); m != NULL; m = m->next)
	{
		setCurrentModel(m);

		// Check model's filter - it will be the import filter, so try to get the partner
		FilePluginInterface* plugin = m->plugin();
		if (plugin == NULL)
		{
			Messenger::print("No plugin available for model '%s'. Not saved.", qPrintable(m->name()));
			continue;
		}
		if (! plugin->canExport())
		{
			Messenger::print("Plugin for model '%s' has no export capability (format '%s'). Not saved.", qPrintable(m->name()), qPrintable(plugin->name()));
			continue;
		}
		if (m->filename().isEmpty())
		{
			Messenger::print("Model '%s' has no filename set. Not saved.", qPrintable(m->name()));
			continue;
		}

		// Save the model
		exportModel(m, m->filename(), m->plugin());
	}
}
Exemplo n.º 6
0
// Export all currently loaded models in the referenced format
void Aten::exportModels()
{
	Messenger::enter("Aten::exportModels");
	QFileInfo fileInfo;
	QString newFilename;

	// Loop over loaded models
	for (Model* m = models_.first(); m != NULL; m = m->next)
	{
		// Set current model
		setCurrentModel(m);

		// Generate new filename for model, with new suffix
		fileInfo.setFile(m->filename());
		newFilename = fileInfo.dir().absoluteFilePath(fileInfo.baseName() + "." + exportModelPlugin_->extensions().first());

		QFileInfo newFileInfo(newFilename);
		// Make sure that the new filename is not the same as the old filename
		if (fileInfo == newFileInfo)
		{
			Messenger::print("Exported file would overwrite the original (%s) - not converted.", qPrintable(m->filename()));
			continue;
		}

		if (exportModel(m, newFilename, exportModelPlugin_, FilePluginStandardImportOptions(), exportModelPluginOptions_)) Messenger::print("Model '%s' saved to file '%s' (%s)", qPrintable(m->name()), qPrintable(newFilename), qPrintable(exportModelPlugin_->name()));
		else Messenger::print("Failed to save model '%s'.", qPrintable(m->name()));
		m->enableUndoRedo();
	}
	Messenger::exit("Aten::exportModels");
}
//------------------------------------------------------------------------------------
// Creates and initializes the main window for application
//------------------------------------------------------------------------------------
Window::Window(QWidget *parent):QDialog(parent)
{
	//We create an instance of GLWidget component we built in glwidget.h
	m_glWidget = new GLWidget;

	//Setup application interface. Creates all the required components and sliders.
	setupUi(this);

	//We need to attach our m_glWidget to glWidgetArea
	//All our drawings will be on glWidgetArea
	glWidgetArea->setWidget(m_glWidget);

	//Setting up all the SIGNALS and SLOTS
	connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
	connect(btnReset, SIGNAL(clicked()), m_glWidget, SLOT(reset()));
	connect(chkPerspective, SIGNAL(clicked(bool)), m_glWidget, SLOT(setView(bool)));

	connect(sectorSlider, SIGNAL(valueChanged(int)), m_glWidget, SLOT(setSectors(int)));
	connect(stackSlider, SIGNAL(valueChanged(int)), m_glWidget, SLOT(setStacks(int)));
	connect(seRadiusStart, SIGNAL(valueChanged(double)), m_glWidget, SLOT(setRadiusStart(double)));
	connect(seRadiusEnd, SIGNAL(valueChanged(double)), m_glWidget, SLOT(setRadiusEnd(double)));

	connect(chkSurface, SIGNAL(clicked(bool)), m_glWidget, SLOT(setDrawSurface(bool)));
	connect(chkWireFrame, SIGNAL(clicked(bool)), m_glWidget, SLOT(setDrawWireFrame(bool)));
	connect(chkCrossSections, SIGNAL(clicked(bool)), m_glWidget, SLOT(setDrawCrossSections(bool)));
        connect(chkDrawNormals, SIGNAL(clicked(bool)), m_glWidget, SLOT(setDrawNormals(bool)));

        connect(btnCloseCurve, SIGNAL(clicked()), m_glWidget, SLOT(closeCurve()));
        connect(btnExportModel, SIGNAL(clicked()), m_glWidget, SLOT(exportModel()));

	/*   Connect extra signal/slots here like:
	connect(btnRunAnimation, SIGNAL(clicked()), m_glWidget, SLOT(startAnimation())); 
	connect(btnStopAnimation, SIGNAL(clicked()), m_glWidget, SLOT(stopAnimation())); 
	connect(udX, SIGNAL(valueChanged(double)), m_glWidget, SLOT(selXChanged(double)));
	connect(udY, SIGNAL(valueChanged(double)), m_glWidget, SLOT(selYChanged(double)));
	*/
}
Exemplo n.º 8
0
void Window::createActions()
{
    newSceneAct = new QAction(tr("&New"), this);
    newSceneAct->setStatusTip(tr("Create an empty scene"));
    connect(newSceneAct, SIGNAL(triggered()), glWidget, SLOT(cleanSheet()));
	
	showBrushControlAct = new QAction(tr("&Brush Control"), this);
	showBrushControlAct->setStatusTip(tr("Show brush settings"));
    connect(showBrushControlAct, SIGNAL(triggered()), m_brushControl, SLOT(show()));
	
	showFeatherEditAct = new QAction(tr("&Feather Editor"), this);
	showFeatherEditAct->setStatusTip(tr("Show feather editor"));
    connect(showFeatherEditAct, SIGNAL(triggered()), m_featherEdit, SLOT(show()));
	
	showTimeControlAct = new QAction(tr("&Time Control"), this);
	showTimeControlAct->setStatusTip(tr("Show time control"));
    connect(showTimeControlAct, SIGNAL(triggered()), m_timeControl, SLOT(show()));
	
    showBarbEditAct = new QAction(tr("&Barb Preview"), this);
    showBarbEditAct->setStatusTip(tr("Show barb preview"));
    connect(showBarbEditAct, SIGNAL(triggered()), m_barbEdit, SLOT(show()));
	
	showRenderEditAct = new QAction(tr("&Render View"), this);
    showRenderEditAct->setStatusTip(tr("Show render view"));
    connect(showRenderEditAct, SIGNAL(triggered()), m_renderEdit, SLOT(show()));
	
	showSceneEditAct = new QAction(tr("&Scene Tree"), this);
    showSceneEditAct->setStatusTip(tr("Show scene edit"));
    connect(showSceneEditAct, SIGNAL(triggered()), m_sceneEdit, SLOT(show()));
    
	saveSceneAct = new QAction(tr("&Save"), this);
	saveSceneAct->setStatusTip(tr("Save current scene file"));
    connect(saveSceneAct, SIGNAL(triggered()), glWidget, SLOT(saveSheet()));
	
	saveSceneAsAct = new QAction(tr("&Save As"), this);
	saveSceneAsAct->setStatusTip(tr("Save current scene into another file"));
	connect(saveSceneAsAct, SIGNAL(triggered()), glWidget, SLOT(saveSheetAs()));
	
	importMeshAct = new QAction(tr("&Import Body Mesh"), this);
	importMeshAct->setStatusTip(tr("Load a mesh cache file as the body"));
	connect(importMeshAct, SIGNAL(triggered()), glWidget, SLOT(importBodyMesh()));
	
	importFDMAct = new QAction(tr("&Import Feather Distribution Map"), this);
	importFDMAct->setStatusTip(tr("Load an OpenEXR image as feather distribution"));
	connect(importFDMAct, SIGNAL(triggered()), glWidget, SLOT(importFeatherDistributionMap()));
	
	openSceneAct = new QAction(tr("&Open"), this);
	openSceneAct->setStatusTip(tr("Load a file as current scene"));
	connect(openSceneAct, SIGNAL(triggered()), this, SLOT(openFile()));
	
	revertAct = new QAction(tr("&Revert To Saved"), this);
	revertAct->setStatusTip(tr("Discard changes to current scene after lastest save"));
    connect(revertAct, SIGNAL(triggered()), glWidget, SLOT(revertSheet()));
	
	importBakeAct = new QAction(tr("&Import Body Animation"), this);
	importBakeAct->setStatusTip(tr("Attach bake point cache to the body"));
    connect(importBakeAct, SIGNAL(triggered()), glWidget, SLOT(chooseBake()));
	
	for (int i = 0; i < MaxRecentFiles; ++i) {
        recentFileActs[i] = new QAction(this);
        recentFileActs[i]->setVisible(false);
        connect(recentFileActs[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }
    
    exportBakeAct = new QAction(tr("&Export Baked Feather"), this);
	exportBakeAct->setStatusTip(tr("Write feather cache"));
    connect(exportBakeAct, SIGNAL(triggered()), glWidget, SLOT(exportBake()));
    
    exportStatAct = new QAction(tr("&Export Feather Model"), this);
	exportStatAct->setStatusTip(tr("Write feather model"));
    connect(exportStatAct, SIGNAL(triggered()), glWidget, SLOT(exportModel()));
	
	growOnAct = new QAction(tr("Eable Grow On Faces"), this);
	growOnAct->setStatusTip(tr("Tag selected faces to grow feathers"));
	connect(growOnAct, SIGNAL(triggered()), this, SLOT(tagFaceOn()));
	
	growOffAct = new QAction(tr("Disable Grow On Faces"), this);
	growOffAct->setStatusTip(tr("Tag selected faces NOT to grow feathers"));
    connect(growOffAct, SIGNAL(triggered()), this, SLOT(tagFaceOff()));
	
	selectGrowonAct = new QAction(tr("&Grow On/Off"), this);
	selectGrowonAct->setStatusTip(tr("Choose to activate grow on map"));
	connect(selectGrowonAct, SIGNAL(triggered()), this, SLOT(selectMap0()));
	
	selectDistributeAct = new QAction(tr("&Grow Distribution"), this);
	selectDistributeAct->setStatusTip(tr("Choose to activate distribution map"));
	connect(selectDistributeAct, SIGNAL(triggered()), this, SLOT(selectMap1()));
	
	selectDensityAct = new QAction(tr("&Grow Density"), this);
	selectDensityAct->setStatusTip(tr("Choose to activate density map"));
	connect(selectDensityAct, SIGNAL(triggered()), this, SLOT(selectMap2()));
}
void MainWindow::createInterface() {

    /** building UI **/
    centralWidget = new QWidget(this);
    gridLayout = new QGridLayout(centralWidget);

    /* camera preview */
    camWidget = new CameraWidget(centralWidget, camera->width, camera->height);
    camWidget->setMinimumSize(320, 240);
    gridLayout->addWidget(camWidget, 0, 0);

    /* surface normals */
    normalsWidget = new NormalsWidget(centralWidget, camera->width, camera->height);
    normalsWidget->setMinimumWidth(300);
    /* initially 3d reconstruction will be displayed */
    normalsWidget->hide();
    gridLayout->addWidget(normalsWidget, 0, 1);

    /* 3D reconstruction */
    modelWidget = new ModelWidget(centralWidget, camera->width, camera->height);
    modelWidget->setMinimumWidth(300);
    gridLayout->addWidget(modelWidget, 0, 1);

    /* switching between displaying reconstruction and surface normals */
    radioButtonsLayout = new QGridLayout();
    normalsRadioButton = new QRadioButton("Surface normals");
    connect(normalsRadioButton, SIGNAL(toggled(bool)), this, SLOT(onViewRadioButtonsChecked(bool)));
    radioButtonsLayout->addWidget(normalsRadioButton, 0, 0);

    surfaceRadioButton = new QRadioButton("3D Reconstruction");
    surfaceRadioButton->setChecked(true);
    connect(surfaceRadioButton, SIGNAL(toggled(bool)), this, SLOT(onViewRadioButtonsChecked(bool)));
    radioButtonsLayout->addWidget(surfaceRadioButton, 0, 1);

    gridLayout->addLayout(radioButtonsLayout, 1, 1);

    /* test modus using 8 prev taken photos */
    testModeCheckBox = new QCheckBox("Test/Presentation mode");
    connect(testModeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onTestModeChecked(int)));
    if (camera->inTestMode()) {
        /* no camera found, forcing test mode */
        testModeCheckBox->setChecked(true);
        testModeCheckBox->setDisabled(true);
    }
    gridLayout->addWidget(testModeCheckBox, 1, 0);
    
    /* toggle settings button */
    toggleSettingsButton = new QPushButton("Show settings menu", centralWidget);
    toggleSettingsButton->setCheckable(true);
    connect(toggleSettingsButton, SIGNAL(clicked()), this, SLOT(onToggleSettingsMenu()));
    gridLayout->addWidget(toggleSettingsButton, 2, 0);

    /* export 3d model button */
    exportButton = new QPushButton("Export 3D Model", centralWidget);
    connect(exportButton, SIGNAL(clicked()), modelWidget, SLOT(exportModel()));
    gridLayout->addWidget(exportButton, 2, 1);

    /* add settings to adjust ps parameter and export 3d model */
    paramsGroupBox = new QGroupBox("PS parameters", centralWidget);
    paramsLayout = new QGridLayout(paramsGroupBox);
    
    maxpqLabel = new QLabel("max<sub>pq</sub>", paramsGroupBox);
    maxpqSpinBox = new QDoubleSpinBox(paramsGroupBox);
    maxpqSpinBox->setRange(0, 200);
    maxpqSpinBox->setValue(ps->getMaxPQ());
    connect(maxpqSpinBox, SIGNAL(valueChanged(double)), ps, SLOT(setMaxPQ(double)));
    paramsLayout->addWidget(maxpqLabel, 0, 0);
    paramsLayout->addWidget(maxpqSpinBox, 0, 1);
    
    lambdaLabel = new QLabel("<html><body>&lambda;<body></html>", paramsGroupBox);
    lambdaSpinBox = new QDoubleSpinBox(paramsGroupBox);
    lambdaSpinBox->setRange(0, 10);
    lambdaSpinBox->setSingleStep(0.1);
    lambdaSpinBox->setValue(ps->getLambda());
    connect(lambdaSpinBox, SIGNAL(valueChanged(double)), ps, SLOT(setLambda(double)));
    paramsLayout->addWidget(lambdaLabel, 1, 0);
    paramsLayout->addWidget(lambdaSpinBox, 1, 1);
    
    muLabel = new QLabel("<html><body>&mu;<body></html>", paramsGroupBox);
    muSpinBox = new QDoubleSpinBox(paramsGroupBox);
    muSpinBox->setRange(0, 10);
    muSpinBox->setSingleStep(0.1);
    muSpinBox->setValue(ps->getMu());
    connect(muSpinBox, SIGNAL(valueChanged(double)), ps, SLOT(setMu(double)));
    paramsLayout->addWidget(muLabel, 2, 0);
    paramsLayout->addWidget(muSpinBox, 2, 1);
    
    minIntensLabel = new QLabel("Set min intensity", paramsGroupBox);
    minIntensSlider = new QSlider(Qt::Horizontal, paramsGroupBox);
    minIntensSlider->setRange(1, 255);
    minIntensSlider->setValue(ps->getMinIntensity());
    connect(minIntensSlider, SIGNAL(valueChanged(int)), ps, SLOT(setMinIntensity(int)));
    paramsLayout->addWidget(minIntensLabel, 3, 0);
    paramsLayout->addWidget(minIntensSlider, 3, 1);
    
    unsharpNormsLabel = new QLabel("Unsharp masking normals", paramsGroupBox);
    unsharpNormSlider = new QSlider(Qt::Horizontal, paramsGroupBox);
    unsharpNormSlider->setRange(0, 300);
    unsharpNormSlider->setValue((int)ps->getUnsharpScale()*100);
    connect(unsharpNormSlider, SIGNAL(valueChanged(int)), ps, SLOT(setUnsharpScale(int)));
    paramsLayout->addWidget(unsharpNormsLabel, 4, 0);
    paramsLayout->addWidget(unsharpNormSlider, 4, 1);
    
    paramsGroupBox->setLayout(paramsLayout);
    paramsGroupBox->hide();
    gridLayout->addWidget(paramsGroupBox, 3, 0);
    
    setCentralWidget(centralWidget);
}