Пример #1
0
void MainWindow::on_submitButton_clicked()
{
   if (image_loaded)
   {
       if (checkSegmentation())
       {
           addToDB();
       }
   }
   return;
   static int file_nr = 0;
    m_netwManager = new QNetworkAccessManager(this);
    connect(m_netwManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slot_netwManagerFinished(QNetworkReply*)));


   // QUrl urlSave("http://usteni.gliczarow.info.pl/webcam.jpeg?1293535363894");
    QUrl urlSave("http://192.168.0.214/now.jpg?snap=pre?ww=1600?wh=1200");

   QNetworkRequest request(urlSave);
   m_netwManager->get(request);

   QString name    = ui->nameField->text();
   QString surname = ui->surnameField->text();
//   QString group   = ui->groupField->text();
//   QString faculty = ui->facultyField->text();
   stringstream ss;
   ss << file_nr++;
   QString file_no = ss.str().c_str();
//   QString filename = group + "-" + name + "-" + surname + "-" + faculty + file_no + ".jpg";
   QString catalog  = "capture/";
//   path = catalog + filename;

   //cvSaveImage(path.toStdString().c_str(), image);

   /* moje
    eye.init(path);
   QPixmap img = QPixmap(path);
   ui->imageLabel->setPixmap(img.scaled(700, 525));
   image_loaded = true;
*/
  /* eye.pupil(ui->binaryEdit->text().toInt());
   eye.iris();
   eye.masking();

   if(db.insertUser(ui->nameField->text(), ui->surnameField->text(), ui->groupField->text(), ui->facultyField->text(), eye.get_mask())) {
     ui->resultLabel->setText("User was added!");
     qDebug("Zapisano do bazy.");
   } else {
     qDebug("Wyst¹pi³ b³¹d przy zapisywaniu.");
   }*/
}
Пример #2
0
int Segmenter::attentionSegment(cv::Mat &object_mask, int originalIndex, int salMapNumber)
{

v4r::TimeEstimationClass timeEstimationClass_CustomLocal(CLOCK_THREAD_CPUTIME_ID);
timeEstimates.times_surfaceModelling.at(salMapNumber) = 0;
timeEstimates.times_relationsComputation.at(salMapNumber) = 0;
timeEstimates.times_graphBasedSegmentation.at(salMapNumber) = 0;
timeEstimates.times_maskCreation.at(salMapNumber) = 0;
timeEstimates.times_neigboursUpdate.at(salMapNumber) = 0;
  
  while(true)
  {
timeEstimationClass_CustomLocal.countingStart();
    modelSurfaces();

    //update original index
    std::vector<int> addedTo = surfModeling->getAddedTo();
    if(addedTo.at(originalIndex) >= 0)
    {
      originalIndex = addedTo.at(originalIndex);
      while(addedTo.at(originalIndex) != -1)
      {
        originalIndex = addedTo.at(originalIndex);
      }
    }
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_surfaceModelling.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();

timeEstimationClass_CustomLocal.countingStart();
    computeRelations();
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_relationsComputation.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();

timeEstimationClass_CustomLocal.countingStart();
    graphBasedSegmentation();
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_graphBasedSegmentation.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();

//     printf("Before check object!");
timeEstimationClass_CustomLocal.countingStart();
    if(checkSegmentation(object_mask,originalIndex,salMapNumber))
    {
      printf("Object was segmented!\n");
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_maskCreation.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();
      return(originalIndex);
    }
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_maskCreation.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();

//     printf("After check object!");
timeEstimationClass_CustomLocal.countingStart();
    std::vector<int> selected_surfaces;
    for(size_t i = 0; i < surfaces.size(); ++i)
    {
      if((surfaces.at(i)->selected) && (surfaces.at(i)->valid))
      {
        selected_surfaces.push_back(i);
        if(surfaces.at(i)->isNew)
          surfaces.at(i)->isNew = false;
      }
    }

    for(size_t i = 0; i < selected_surfaces.size(); ++i)
    {
      int idx = selected_surfaces.at(i);
//       printf("Surface %u is selected \n",idx);

      for(std::set<unsigned>::iterator itr = surfaces.at(idx)->neighbors3D.begin(); itr != surfaces.at(idx)->neighbors3D.end(); itr++)
      {
        if( (surfaces.at(*itr)->valid) && (!(surfaces.at(*itr)->selected)) )
        {
//           printf("Adding neigbour %u is selected \n",*itr);
          surfaces.at(*itr)->selected = true;
          surfaces.at(*itr)->isNew = true;
        }
      }
    }
timeEstimationClass_CustomLocal.countingEnd();
timeEstimates.times_neigboursUpdate.at(salMapNumber) += timeEstimationClass_CustomLocal.getWorkTimeInNanoseconds();

  }

  return(-1);
}