void SamaelMainWindow::createWidgets()
{
  QObject::connect(m_computationManager, SIGNAL(getClassNames(std::vector<std::string>&)), m_imageDataBase, SLOT(getClassNames(std::vector<std::string>&)));
  QObject::connect(m_computationManager, SIGNAL(getTrainingImages(std::map<std::string, std::vector<SamaelImage*>>&)), m_imageDataBase, SLOT(getTrainingImages(std::map<std::string, std::vector<SamaelImage*>>&)));
  QObject::connect(m_computationManager, SIGNAL(getClassifyImages(std::map<std::string, std::vector<SamaelImage*>>&)), m_imageDataBase, SLOT(getClassifyImages(std::map<std::string, std::vector<SamaelImage*>>&)));

  // Central Widget
  m_CentralWidget = new CentralWidget(this);

  // Viewer Widget
  this->setCentralWidget(m_CentralWidget);
  QObject::connect(m_computationManager, SIGNAL(displayMatrix(cv::Mat)), m_CentralWidget->getDataViewerWidget(), SLOT(displayMatrix(cv::Mat)));
  QObject::connect(m_computationManager, SIGNAL(setConfusionMatrixHeaderData(std::vector<std::string>&)), m_CentralWidget->getDataViewerWidget(), SLOT(setConfusionMatrixHeaderData(std::vector<std::string>&)));

  // Terminal Widget
  m_TerminalWidget->setParent(this);
  this->addDockWidget(Qt::BottomDockWidgetArea, m_TerminalWidget);

  // Tree Widget
  m_TreeWidget = new TreeWidget(this);
  this->addDockWidget(Qt::LeftDockWidgetArea, m_TreeWidget);
  QObject::connect(m_TreeWidget, SIGNAL(addImageToDatabase(std::string, SamaelImage*)), m_imageDataBase, SLOT(addImage(std::string, SamaelImage*)));
  QObject::connect(m_TreeWidget, SIGNAL(removeClassFromDatabase(std::string)), m_imageDataBase, SLOT(removeImages(std::string)));

  // Toolbox Widget
  m_ToolBox = new ToolBox(this);
  this->addDockWidget(Qt::RightDockWidgetArea, m_ToolBox);
  QObject::connect(m_ToolBox, SIGNAL(doClassification()), m_computationManager, SLOT(doClassification()));
}
示例#2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    closeDownRequest = false;

    ui->tableWidget->clear();
    ui->tableWidget->setColumnCount(2);

    ui->tableWidget->verticalHeader()->setVisible(false);

    QStringList labs;
    labs << "Name" << "Probability";
    ui->tableWidget->setHorizontalHeaderLabels(labs);

    ui->startPushButton->setEnabled(true);
    ui->stopPushButton->setEnabled(false);

    timer = new QTimer();

    connect(timer, SIGNAL(timeout()), this, SLOT(doClassification()));

}
示例#3
0
void QMapView::keyPressEvent(QKeyEvent* keyEvent)
{
    switch(keyEvent->key())
     {
       case Qt::Key_Space:
       {
        /*cout<<width()<<endl;
        cout<<height()<<endl;
        Mat result;
        result.create(height(),width(),CV_8UC3);
        GLbyte *buf= new GLbyte[height()*width()*3];

        //GLbyte *buf=(GLbyte *)malloc (height()*width()*3);
        glPixelStorei(GL_PACK_ALIGNMENT,1);
        glReadPixels(0,0,width(),height(),GL_BGR,GL_UNSIGNED_BYTE,buf);
        int t=0;
        for (int i=0; i<height();i++)
        {
            for (int j=0; j<width();j++)
            {
                result.at<Vec3b>(i,j)[0]=buf[t];
                result.at<Vec3b>(i,j)[1]=buf[t+1];
                result.at<Vec3b>(i,j)[2]=buf[t+2];
                t+=3;
            }
        }
        imshow("result",result);
        delete buf[];*/
        doClassification();
        break;
    }
    case Qt::Key_End:
    {
        toDo=false;
        break;
    }
    case Qt::Key_Enter:
    {
        toDo=true;
        break;
    }
    case Qt::Key_Right:
    {
        frame_count++;
        changeXmlFrame();
        break;
    }
    case Qt::Key_Left:
    {
        frame_count--;
        changeXmlFrame();
        break;
    }
        PAIR(Qt::Key_Q, Qt::Key_A, coord_x, 0.0001);
        PAIR(Qt::Key_W, Qt::Key_S, coord_y, 0.0001);
        PAIR(Qt::Key_E, Qt::Key_D, coord_z, 0.0001);
        PAIR(Qt::Key_R, Qt::Key_F, course, 1);
        PAIR(Qt::Key_T, Qt::Key_G, roll, 1);
        PAIR(Qt::Key_Y, Qt::Key_H, pitch, 1);
        PAIR(Qt::Key_U, Qt::Key_J, aspect_x, 0.1);
        PAIR(Qt::Key_I, Qt::Key_K, aspect_y, 0.1);
      default:
      QGLWidget::keyPressEvent(keyEvent);
      break;
    }
}