void CameraParameters::AdditionalCalibrationInformation::addSettingsToList(
    VarList& list) {
  for (int i = 0; i < kNumControlPoints; ++i) {
    list.addChild(control_point_set[i]);
  }

  list.addChild(initial_distortion);
  list.addChild(camera_height);
  list.addChild(line_search_corridor_width);
  list.addChild(image_boundary);
  list.addChild(max_feature_distance);
  list.addChild(convergence_timeout);
  list.addChild(cov_corner_x);
  list.addChild(cov_corner_y);
  list.addChild(cov_ls_x);
  list.addChild(cov_ls_y);
  list.addChild(pointSeparation);
}
void CameraParameters::addSettingsToList(VarList& list) {
  list.addChild(focal_length);
  list.addChild(principal_point_x);
  list.addChild(principal_point_y);
  list.addChild(distortion);
  list.addChild(q0);
  list.addChild(q1);
  list.addChild(q2);
  list.addChild(q3);
  list.addChild(tx);
  list.addChild(ty);
  list.addChild(tz);
}
Example #3
0
MainWindow::MainWindow(bool start_capture, bool enforce_affinity)
{

  affinity=0;
  if (enforce_affinity) affinity=new AffinityManager();
  //opt=new GetOpt();
  settings=0;
  setupUi((QMainWindow *)this);

  tree_view=new VarTreeView();
  tmodel=new VarTreeModel();

  splitter = new QSplitter(Qt::Horizontal,this);
  splitter2 = new QSplitter(Qt::Vertical);

  root=new VarList("Vision System");

  opts=new RenderOptions();
  right_tab=0;

  QString stack_id="";

  //opt->addArgument("stack",&stack_id);
  //opt->parse();

  //load RoboCup SSL stack by default:
  multi_stack=new MultiStackRoboCupSSL(opts, 2);

  VarExternal * stackvar;
  root->addChild(stackvar= new VarExternal((multi_stack->getSettingsFileName() + ".xml").c_str(),multi_stack->getName()));
  stackvar->addChild(multi_stack->getSettings());
  //create tabs, GL visualizations and tool-panes for each capture thread in the multi-stack:
  for (unsigned int i=0;i<multi_stack->threads.size();i++) {
    VisionStack * s = multi_stack->threads[i]->getStack();
    if (affinity!=0) multi_stack->threads[i]->setAffinityManager(affinity);

    GLWidget * gl=new GLWidget(0,false);
    gl->setRingBuffer(multi_stack->threads[i]->getFrameBuffer());
    gl->setVisionStack(s);
    QString label = "Camera " + QString::number(i);

    VarList * threadvar = new VarList(label.toStdString());

    threadvar->addChild(s->getSettings());
    //iterate through plugin variables

    QSplitter * stack_widget = new QSplitter(Qt::Horizontal);
    stack_widgets.push_back(stack_widget);
    QSplitter * stack_vis_splitter = new QSplitter(Qt::Vertical);
    stack_widget->addWidget(stack_vis_splitter);
    QTabWidget * stack_control_tab = new QTabWidget();
    stack_control_tab->setTabPosition(QTabWidget::East);
    stack_widget->addWidget(stack_control_tab);

    VideoWidget * w=new VideoWidget(label,gl);
    display_widgets.push_back(gl);
    threadvar->addChild(multi_stack->threads[i]->getSettings());

    stack_vis_splitter->addWidget(w);
    //iterate through all plugins
    unsigned int n=s->stack.size();
    for (unsigned int j=0;j<n;j++) {
      VisionPlugin * p=s->stack[j];
      if (p->isSharedAmongStacks()) {
        if (i==0) {
          //this is a shared global plugin...
          //add it to global pane
          if (p->getSettings()!=0) stackvar->addChild(p->getSettings());

          QWidget * tmp_control = p->getControlWidget();
          if (tmp_control!=0) {
            if (right_tab==0) {
              right_tab=new QTabWidget();
              right_tab->setTabPosition(QTabWidget::East);
            }
            right_tab->addTab(tmp_control,QString::fromStdString(p->getName()));
          }
        
          QWidget * tmp_vis = p->getVisualizationWidget();
          if (tmp_vis!=0) splitter2->addWidget(tmp_vis);
        }
      
      } else {
        if (p->getSettings()!=0) threadvar->addChild(p->getSettings());
        //this is a local plugin relating only to a single thread
        //add it to the context.
        QWidget * tmp_control = p->getControlWidget();
        if (tmp_control!=0) stack_control_tab->addTab(tmp_control,QString::fromStdString(p->getName()));
      
        QWidget * tmp_vis = p->getVisualizationWidget();
        if (tmp_vis!=0) stack_vis_splitter->addWidget(tmp_vis);
      }
    }
    stackvar->addChild(threadvar);

    splitter2->addWidget(stack_widget);
  }
  
  if (affinity!=0) affinity->demandCore(multi_stack->threads.size());

  // Set position and size of main window:
  QSettings window_settings("RoboCup", "ssl-vision");
  window_settings.beginGroup("MainWindow");
  QPoint pos = window_settings.value("pos", QPoint(100, 100)).toPoint();
  QSize size = window_settings.value("size", QSize(800, 600)).toSize();
  window_settings.endGroup();
  resize(size);
  move(pos);

  //FINISHED STRUCTURAL TREE
  //NOW LOAD DATA:

  world.push_back(root); 
  world=VarXML::read( world,"settings.xml");

  //update network output settings from xml file
  ((MultiStackRoboCupSSL*)multi_stack)->RefreshNetworkOutput();
  multi_stack->start();

  if (start_capture==true) {
    for (unsigned int i = 0; i < multi_stack->threads.size(); i++) {
      CaptureThread * ct = multi_stack->threads[i];
      ct->init();
    }
  }

  tree_view->setModel(tmodel);
  tmodel->setRootItems(world);
  tree_view->expandAndFocus(stackvar);
  tree_view->fitColumns();

  left_tab=new QTabWidget();
  left_tab->setTabPosition(QTabWidget::West);

  splitter->addWidget(left_tab);
  splitter->addWidget(splitter2);
  if (right_tab!=0) splitter->addWidget(right_tab);

  left_tab->addTab(tree_view,"Data-Tree");

  setCentralWidget(splitter); //was splitter

  startTimer(10);

}