FeatureLearningWidgetController.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * \package VisionX::gui-plugins::FeatureLearningWidgetController
17  * \author Julian Zimmer ( urdbu at student dot kit dot edu )
18  * \date 2018
19  * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
25 #include <string>
26 
27 #include <VisionX/interface/components/Calibration.h>
28 
31 
32 
33 #include <DataStructures/DynamicArray.h>
34 #include <Calibration/StereoCalibration.h>
35 
36 #include <Image/ImageProcessor.h>
37 #include <Image/PrimitivesDrawer.h>
38 
41 
42 
43 // MemoryX
50 
51 #include <QMap>
52 #include <QStringList>
53 #include <QSortFilterProxyModel>
54 
55 
56 using namespace armarx;
57 using namespace visionx;
58 using namespace memoryx::EntityWrappers;
59 
61 {
62  qRegisterMetaType<CByteImage**>("CByteImage**");
63 
64  QPointer<QWidget> widgetPointer = getWidget();
65  this->widgetPointer = widgetPointer.data();
66 
67  widget.setupUi(widgetPointer);
68 
69 
70  proxyFinder = new armarx::IceProxyFinder<ImageProviderInterfacePrx>(widgetPointer);
71  proxyFinder->setSearchMask("*Provider|*Result");
72  //ui.horizontalLayout->addWidget(proxyFinder);
73  widget.chooseProviderLayout->addWidget(proxyFinder);
74 
75  imageViewer = new SelectableImageViewer();
76  QSizePolicy sizePoli(QSizePolicy::Expanding, QSizePolicy::Expanding);
77  sizePoli.setVerticalStretch(15);
78  imageViewer->setSizePolicy(sizePoli);
79 
80  widget.imageViewerLayout_2->addWidget(imageViewer);
81  imageViewer->show();
82 
83  featureLearningObjectChooserWidget = new visionx::FeatureLearningObjectChooserWidget();
84  featureLearningObjectChooserWidget->hide();
85 
86 
87  featureLearningSaveToMemoryWidget = new visionx::FeatureLearningSaveToMemoryWidget();
88  featureLearningSaveToMemoryWidget->hide();
89 
90 }
91 
92 
94 {
95 
96 }
97 
98 
100 {
101 
102 }
103 
104 
106 {
107 
108 }
109 
111 {
112  proxyFinder->setIceManager(this->getIceManager(), proxyFinder->getSelectedProxyName().isEmpty());
113 
114  points = Eigen::ArrayX2f::Zero(4, 2);
115  numSelectedPoints = 0;
116 
117 
118  connect(imageViewer, SIGNAL(selected(int, float, float)), this, SLOT(addPolygonPoint(int, float, float)));
119  connect(widget.connectButton, SIGNAL(clicked(bool)), this, SLOT(connectButtonClicked(bool)));
120  connect(widget.loadFeaturesButton, SIGNAL(clicked(bool)), this, SLOT(loadFeaturesButtonClicked(bool)));
121  connect(widget.saveFeaturesButton, SIGNAL(clicked(bool)), this, SLOT(saveFeaturesButtonClicked(bool)));
122  connect(widget.pausePlayButton, SIGNAL(clicked(bool)), this, SLOT(pausePlayButtonClicked(bool)));
123  connect(widget.disconnectButton, SIGNAL(clicked(bool)), this, SLOT(disconnectButtonClicked(bool)));
124  connect(widget.addFeaturesButton, SIGNAL(clicked(bool)), this, SLOT(addFeaturesButtonClicked(bool)));
125  connect(widget.clearFeaturesButton, SIGNAL(clicked(bool)), this, SLOT(clearFeaturesButtonClicked(bool)));
126  connect(widget.objectChooserButton, SIGNAL(clicked(bool)), this, SLOT(objectChooserButtonClicked(bool)));
127  connect(widget.saveToMemoryButton, SIGNAL(clicked(bool)), this, SLOT(saveToMemoryButtonClicked(bool)));
128  connect(featureLearningObjectChooserWidget, SIGNAL(accepted()), this, SLOT(objectChooserAccepted()));
129  connect(featureLearningSaveToMemoryWidget, SIGNAL(accepted()), this, SLOT(saveToMemoryAccepted()));
130 
131 
132 
133  connected = false;
134  isPaused = true;
135 }
136 
138 {
139  objectFeatureSet = new CTexturedFeatureSet("objectFeatureSet");
140  viewFeatureSet = new CTexturedFeatureSet("viewFeatureSet");
141 
142  featureCalculator = new CHarrisSIFTFeatureCalculator(0.01, 1, 10000);
143  // featureCalculator->SetNumberOfLevels(1);
144  // featureCalculator->SetMaxInterestPoints(1500);
145 }
146 
147 
148 //add the features from the current region to the selection
149 int FeatureLearningWidgetController::addFeatures()
150 {
151  int numAdded = 0;
152  for (int i = 0; i < viewFeatureSet->GetSize(); i++)
153  {
154  CFeatureEntry* copiedEntry = viewFeatureSet->GetFeature(i)->Clone();
155  Math2d::ApplyHomography(homography, copiedEntry->point, copiedEntry->point);
156  bool addedSuccessfully = objectFeatureSet->AddFeature(copiedEntry, false);
157  if (addedSuccessfully)
158  {
159  numAdded++;
160  }
161  }
162  return numAdded;
163 }
164 
165 void FeatureLearningWidgetController::clearFeatures()
166 {
167  objectFeatureSet->Clear();
168 }
169 
170 
171 //load a feature set from a .dat file
172 void FeatureLearningWidgetController::loadFeatureSet(QString filePath)
173 {
174  std::string filePathStr = filePath.toStdString();
175  const char* filePathCStr = filePathStr.c_str();
176  if (!objectFeatureSet->LoadFromFile(filePathCStr))
177  {
178  ARMARX_ERROR << " could not load feature set from file " << filePath;
179  widget.lastActionInfoLabel->setText("Loading features failed!");
180  }
181  else
182  {
183  ARMARX_INFO << "loaded feature set with " << objectFeatureSet->GetSize() << " features";
184 
185  QDir currentDir;
186  mySettings.setValue("default_load_dir", currentDir.absoluteFilePath(filePath));
187 
188  widget.lastActionInfoLabel->setText("Loaded feature set with " + QString::number(objectFeatureSet->GetSize()) + " features");
189 
190  float x = fabsf(2.f * objectFeatureSet->m_3dPoint2.x);
191  float y = fabsf(2.f * objectFeatureSet->m_3dPoint2.y);
192  float z = fabsf(2.f * objectFeatureSet->m_3dPoint2.z);
193 
194  int xInt = (int) x;
195  int yInt = (int) y;
196  int zInt = (int) z;
197 
198  widget.widthLineEdit->setText(QString::number(xInt));
199  widget.heightLineEdit->setText(QString::number(yInt));
200  widget.depthLineEdit->setText(QString::number(zInt));
201  }
202 
203  points = Eigen::ArrayX2f::Zero(4, 2);
204  numSelectedPoints = 0;
205 }
206 
207 //save a feature set to a .dat file
208 void FeatureLearningWidgetController::saveFeatureSet(QString filePath, float w, float h, float d)
209 {
210  ARMARX_CHECK_EXPRESSION(objectFeatureSet->GetSize() > 0);
211  ARMARX_CHECK_EXPRESSION(w > 0.f);
212  ARMARX_CHECK_EXPRESSION(h > 0.f);
213  ARMARX_CHECK_EXPRESSION(d > 0.f);
214 
215  Math3d::SetVec(objectFeatureSet->m_3dPoint1, -w / 2.0f, -h / 2.0f, -d / 2.0f);
216  Math3d::SetVec(objectFeatureSet->m_3dPoint2, w / 2.0f, -h / 2.0f, -d / 2.0f);
217  Math3d::SetVec(objectFeatureSet->m_3dPoint3, w / 2.0f, h / 2.0f, -d / 2.0f);
218  Math3d::SetVec(objectFeatureSet->m_3dPoint4, -w / 2.0f, h / 2.0f, -d / 2.0f);
219 
220  std::string filePathStr = filePath.toStdString();
221  const char* filePathCStr = filePathStr.c_str();
222 
223 
224 
225  if (!objectFeatureSet->SaveToFile(filePathCStr))
226  {
227  ARMARX_ERROR << " could not save feature set to file " << filePath;
228  widget.lastActionInfoLabel->setText("Saving features failed!");
229  }
230  else
231  {
232  ARMARX_INFO << " saved feature set with " << objectFeatureSet->GetSize() << " features to file " << filePathCStr;
233 
234 
235  std::string matPath = filePath.toStdString();
236  const unsigned int n = matPath.find_last_of(".dat");
237  matPath.resize(n - 2);
238  matPath += "mat";
239 
240  CFloatMatrix* object = createCuboid(w, h, d);
241  object->SaveToFile(matPath.c_str());
242  delete object;
243 
244  QDir currentDir;
245  mySettings.setValue("default_save_dir", currentDir.absoluteFilePath(filePath));
246  widget.lastActionInfoLabel->setText("Saved " + QString::number(objectFeatureSet->GetSize()) + " features into file");
247  }
248 }
249 
251 {
252 
253 }
254 
256 {
257  points = Eigen::ArrayX2f::Zero(4, 2);
258 
259  if (connected)
260  {
261  for (int i = 0; i < numImages; i++)
262  {
263  delete cameraImages[i];
264  }
265 
266  delete [] cameraImages;
267 
268  delete visualizationImage;
269  delete grayImage;
270  }
271 
272  delete featureCalculator;
273 
274  delete objectFeatureSet;
275  delete viewFeatureSet;
276 
277  // releaseImageProvider(imageProviderName);
278 }
279 
280 
281 // void FeatureLearningWidgetController::thresholdChanged()
282 // {
283 //
284 // const float threshold = 0.001;
285 // if (fThreshold > 0) featureCalculator->SetThreshold(fThreshold);
286 // }
287 
288 
289 static bool SameSide(const Vec2d& p1, const Vec2d& p2, const Vec2d& a, const Vec2d& b)
290 {
291  double ba0 = b.x - a.x;
292  double ba1 = b.y - a.y;
293 
294  double p1a0 = p1.x - a.x;
295  double p1a1 = p1.y - a.y;
296 
297  double p2a0 = p2.x - a.x;
298  double p2a1 = p2.y - a.y;
299 
300  double cp1 = ba0 * p1a1 - ba1 * p1a0;
301  double cp2 = ba0 * p2a1 - ba1 * p2a0;
302 
303  return cp1 * cp2 >= 0;
304 }
305 
306 static bool PointInPoly(const Vec2d& p, const Vec2d& a, const Vec2d& b, const Vec2d& c)
307 {
308  return SameSide(p, a, b, c) && SameSide(p, b, a, c) && SameSide(p, c, a, b);
309 }
310 
311 static double DistancePointStraightLine(const Vec2d& a, const Vec2d& b, const Vec2d p)
312 {
313  Vec2d n = { b.y - a.y, a.x - b.x };
314  Math2d::NormalizeVec(n);
315 
316  return std::fabs(Math2d::ScalarProduct(n, p) - Math2d::ScalarProduct(n, a));
317 }
318 
319 //calculate features for the current region
320 void FeatureLearningWidgetController::updateFeatures()
321 {
322  if (numSelectedPoints == 0)
323  {
324  viewFeatureSet->Clear();
325  return;
326  }
327 
328  // wait until region is selected
329  if (numSelectedPoints < 4)
330  {
331  return;
332  }
333 
334  Vec2d sourcePoints[4];
335 
336  for (int i = 0; i < numSelectedPoints; i++)
337  {
338  sourcePoints[i].x = points(i, 0) * grayImage->width;
339  sourcePoints[i].y = points(i, 1) * grayImage->height;
340  }
341 
342  const float w = widget.widthLineEdit->text().toFloat();
343  const float h = widget.heightLineEdit->text().toFloat();
344 
345  Vec2d targetPoints[4];
346  Math2d::SetVec(targetPoints[0], 0, 0);
347  Math2d::SetVec(targetPoints[1], w, 0);
348  Math2d::SetVec(targetPoints[2], w, h);
349  Math2d::SetVec(targetPoints[3], 0, h);
350 
351  LinearAlgebra::DetermineHomography(sourcePoints, targetPoints, 4, homography, true);
352 
353  objectFeatureSet->SetCornerPoints(targetPoints[0], targetPoints[1], targetPoints[2], targetPoints[3]);
354 
355  CDynamicArray dynamic_array(500);
356  featureCalculator->SetThreshold(0.0001);
357  const int nFeatures = featureCalculator->CalculateFeatures(grayImage, &dynamic_array);
358  viewFeatureSet->Clear();
359 
360  for (int i = 0; i < nFeatures; i++)
361  {
362  CFeatureEntry* pFeatureEntry = (CFeatureEntry*) dynamic_array.GetElement(i);
363 
364  if (PointInPoly(pFeatureEntry->point, sourcePoints[0], sourcePoints[1], sourcePoints[2]) || PointInPoly(pFeatureEntry->point, sourcePoints[2], sourcePoints[3], sourcePoints[0]))
365  {
366  const double dThreshold = 10;
367 
368  if (DistancePointStraightLine(sourcePoints[0], sourcePoints[1], pFeatureEntry->point) > dThreshold &&
369  DistancePointStraightLine(sourcePoints[1], sourcePoints[2], pFeatureEntry->point) > dThreshold &&
370  DistancePointStraightLine(sourcePoints[2], sourcePoints[3], pFeatureEntry->point) > dThreshold &&
371  DistancePointStraightLine(sourcePoints[3], sourcePoints[0], pFeatureEntry->point) > dThreshold)
372  {
373  viewFeatureSet->AddFeature(pFeatureEntry->Clone(), false);
374  }
375  }
376  }
377 
378  ARMARX_LOG << deactivateSpam(2.f) << "Features in polygon " << viewFeatureSet->GetSize();
379 }
380 
381 void FeatureLearningWidgetController::updateSelection()
382 {
383  Vec2d sourcePoints[4];
384 
385  //Depending on the size of the widget, the image gets scaled up or down
386  //The dimensions of the visualization image have to be regarded, to find the position of the mouse click on the image
387  //Vec2d scaledImageDimensions = imageViewer->getScaledImageDimensions();
388  for (int i = 0; i < numSelectedPoints; i++)
389  {
390  float relativeX = points(i, 0);
391  float relativeY = points(i, 1);
392 
393  sourcePoints[i].x = relativeX * visualizationImage->width;
394  sourcePoints[i].y = relativeY * visualizationImage->height;
395  //sourcePoints[i].x = points(i, 0);
396  //sourcePoints[i].y = points(i, 1);
397  }
398 
399  if (numSelectedPoints >= 1)
400  {
401  PrimitivesDrawer::DrawCircle(visualizationImage, sourcePoints[0], 3, 255, 0, 0, -1);
402  //ARMARX_INFO << deactivateSpam(2.f) << "DRAWING POINT 1 AT (" << sourcePoints[0].x << ", " << sourcePoints[0].y << ")";
403  }
404  if (numSelectedPoints >= 2)
405  {
406  PrimitivesDrawer::DrawCircle(visualizationImage, sourcePoints[1], 3, 255, 0, 0, -1);
407  PrimitivesDrawer::DrawLine(visualizationImage, sourcePoints[0], sourcePoints[1], 0, 0, 255);
408  //ARMARX_INFO << deactivateSpam(2.f) << "DRAWING POINT 2 AT (" << sourcePoints[1].x << ", " << sourcePoints[1].y << ")";
409  }
410  if (numSelectedPoints >= 3)
411  {
412  PrimitivesDrawer::DrawCircle(visualizationImage, sourcePoints[2], 3, 255, 0, 0, -1);
413  PrimitivesDrawer::DrawLine(visualizationImage, sourcePoints[1], sourcePoints[2], 0, 0, 255);
414  //ARMARX_INFO << deactivateSpam(2.f) << "DRAWING POINT 3 AT (" << sourcePoints[2].x << ", " << sourcePoints[2].y << ")";
415  }
416  if (numSelectedPoints >= 4)
417  {
418  PrimitivesDrawer::DrawCircle(visualizationImage, sourcePoints[3], 3, 255, 0, 0, -1);
419  PrimitivesDrawer::DrawLine(visualizationImage, sourcePoints[2], sourcePoints[3], 0, 0, 255);
420  PrimitivesDrawer::DrawLine(visualizationImage, sourcePoints[3], sourcePoints[0], 0, 0, 255);
421  //ARMARX_INFO << deactivateSpam(2.f) << "DRAWING POINT 4 AT (" << sourcePoints[3].x << ", " << sourcePoints[3].y << ")";
422  }
423 
424 
425  // draw features
426  if (numSelectedPoints >= 4)
427  {
428  for (int i = 0; i < viewFeatureSet->GetSize(); i++)
429  {
430  const CFeatureEntry* pFeatureEntry = viewFeatureSet->GetFeature(i);
431  PrimitivesDrawer::DrawCircle(visualizationImage, pFeatureEntry->point, 2, 0, 255, 0, -1);
432  }
433  }
434 }
435 
437 {
438 
439  //std::unique_lock<std::mutex> lock(imageMutex, std::try_to_lock);
440  std::unique_lock lock(imageMutex);
441 
442  if (!lock.owns_lock())
443  {
444  ARMARX_INFO << deactivateSpam(3) << "unable to process next image(" << lock.owns_lock() << ")";
445  return;
446  }
447 
448  if (!connected)
449  {
450  ARMARX_INFO << deactivateSpam(3) << "Not connected to any image provider";
451  return;
452  }
453 
454  armarx::MetaInfoSizeBasePtr info;
455  IceUtil::Time timeReceived;
456  if (!isPaused)
457  {
458  //only update current image, if unpaused
459  if (!waitForImages(imageProviderName))
460  {
461  ARMARX_WARNING << "Timeout while waiting for images";
462  return;
463  }
464  if (getImages(imageProviderName, cameraImages, info) != numImages)
465  {
466  ARMARX_WARNING << "Unable to transfer or read images";
467  return;
468  }
469  timeReceived = TimeUtil::GetTime();
470 
471  }
472 
473  //create grayscale image for feature calculation and color image for the visualization
474  ::ImageProcessor::ConvertImage(cameraImages[0], grayImage);
475  ::ImageProcessor::CopyImage(cameraImages[0], visualizationImage);
476 
477  updateFeatures();
478  updateSelection();
479 
480  //update the availability of the buttons etc.
481  updateFeaturesUI();
482 
483 
484  CByteImage** images = new CByteImage* {visualizationImage};
485  imageViewer->setImages(1, images, IceUtil::Time::microSeconds(info->timeProvided), timeReceived);
486 }
487 
488 //*******************************
489 
490 
491 //GENERAL TODO:
492 //DONE:
493 //Add status information which shows, how many features are currently in the polygon - DONE
494 //Add button to add features to selection - DONE
495 //Add status information how many features are currently selected - DONE
496 //Add button to clear selected features - DONE
497 //Add pause button - DONE
498 //Add image monitor status information - DONE
499 //Add disconnect button - DONE
500 //Convert the layout to enable the right column to go to the bottom - DONE
501 //Add width, height, depth line edits to enable them to be set, saved and loaded as in the ivt app - DONE
502 //Choose an object from the memory in order to load the features and object dimensions - DONE
503 //Save the features and object dimensions into the memory - DONE
504 //Add warning label if the features will overwrite a feature file in the memory - DONE
505 
506 
507 //*******************************
508 
509 
510 
511 
513 {
514  if (!connected)
515  {
516  return;
517  }
518 
519  if (numSelectedPoints >= 4)
520  {
521  numSelectedPoints = 0;
522  }
523 
524  points(numSelectedPoints, 0) = x;
525  points(numSelectedPoints, 1) = y;
526 
527  numSelectedPoints++;
528 }
529 
530 
532 {
533  reconnect();
534 }
535 
536 
537 //opens a QDialog with the last used load location and calls the feature loading function
539 {
540  QString previousLoadDirectory = mySettings.value("default_load_dir").toString();
541  if (previousLoadDirectory == "")
542  {
543  QString previousSaveDirectory = mySettings.value("default_save_dir").toString();
544  if (previousSaveDirectory == "")
545  {
546  previousLoadDirectory = "~";
547  }
548  else
549  {
550  previousLoadDirectory = previousSaveDirectory;
551  }
552  }
553  QString filePath = QFileDialog::getOpenFileName(widgetPointer, "Load Features", previousLoadDirectory, "(*.dat)");
554  loadFeatureSet(filePath);
555 
556 }
557 
558 //checks if features are selected and opens a QDialog to choose the save location
560 {
561  if (objectFeatureSet->GetSize() < 1)
562  {
563  QMessageBox emptyFeatureSetBox;
564  emptyFeatureSetBox.setText("Cannot save empty feature set!");
565  emptyFeatureSetBox.setWindowTitle("Feature set empty");
566  emptyFeatureSetBox.exec();
567  return;
568  }
569  float width = widget.widthLineEdit->text().toFloat();
570  float height = widget.heightLineEdit->text().toFloat();
571  float depth = widget.depthLineEdit->text().toFloat();
572 
573  if (width <= 0.f || height <= 0.f || depth <= 0.f)
574  {
575  QMessageBox invalidDimensionsBox;
576  invalidDimensionsBox.setText("Cannot save feature set with object dimensions <= 0!");
577  invalidDimensionsBox.setWindowTitle("Invalid object dimensions");
578  invalidDimensionsBox.exec();
579  return;
580  }
581 
582  QString previousSaveDirectory = mySettings.value("default_save_dir").toString();
583  if (previousSaveDirectory == "")
584  {
585  QString previousLoadDirectory = mySettings.value("default_load_dir").toString();
586  if (previousLoadDirectory == "")
587  {
588  previousSaveDirectory = "~";
589  }
590  else
591  {
592  previousSaveDirectory = previousLoadDirectory;
593  }
594  }
595  QString filePath = QFileDialog::getSaveFileName(widgetPointer, "Save Features", previousSaveDirectory, "(*.dat)");
596  if (filePath.right(4) != ".dat")
597  {
598  filePath += ".dat";
599  }
600  saveFeatureSet(filePath, width, height, depth);
601 }
602 
604 {
605  if (!connected)
606  {
607  isPaused = false;
608  }
609  else
610  {
611  isPaused = !isPaused;
612  }
613  updateImageMonitorUI();
614 }
615 
616 //disconncts and connects again
618 {
619  std::unique_lock lock(imageMutex);
620 
621  disconnectFromProvider();
622 
623  // connect to provider
624  try
625  {
626  connectToProvider();
627  }
628  catch (...)
629  {
631  }
632 }
633 
634 //trying to connect to the image provider
635 void FeatureLearningWidgetController::connectToProvider()
636 {
637  if (connected)
638  {
639  return;
640  }
641 
642 
643  imageProviderName = proxyFinder->getSelectedProxyName().toStdString();
644  ARMARX_INFO << "Trying to connect to provider " << imageProviderName;
645 
646  try
647  {
648  usingImageProvider(imageProviderName);
649  }
650  catch (Ice::NotRegisteredException& e)
651  {
652  ARMARX_ERROR << "Cannot connect to the given image provider called " << imageProviderName;
653 
654  QMessageBox cannotConnectToProviderBox;
655  QString cannotConnectToProviderString = "Cannot connect to the given image provider called " + QString::fromStdString(imageProviderName);
656  cannotConnectToProviderBox.setText(cannotConnectToProviderString);
657  cannotConnectToProviderBox.setWindowTitle("Cannot connect to Image Provider");
658  cannotConnectToProviderBox.exec();
659  return;
660  }
661  catch (armarx::LocalException& e)
662  {
663  ARMARX_ERROR << "Image Provider field is empty, cannot connect!" << imageProviderName;
664 
665  QMessageBox noProviderGivenBox;
666  QString cannotConnectToProviderString = "Cannot connect to an image provider since the field is empty.";
667  noProviderGivenBox.setText(cannotConnectToProviderString);
668  noProviderGivenBox.setWindowTitle("No Provider given");
669  noProviderGivenBox.exec();
670  return;
671  }
672 
673  ARMARX_INFO << getName() << " connecting to " << imageProviderName;
674 
675  // connect to proxy
676  imageProviderInfo = getImageProvider(imageProviderName, visionx::tools::typeNameToImageType("rgb"));
677 
678  // update members
679  imageProviderPrx = imageProviderInfo.proxy;
680  numImages = imageProviderInfo.numberImages;
681 
682  StereoCalibrationProviderInterfacePrx calibrationProvider = StereoCalibrationProviderInterfacePrx::checkedCast(imageProviderInfo.proxy);
683 
684  if (!calibrationProvider)
685  {
686  ARMARX_WARNING << "image provider does not have a stereo calibration interface";
687  }
688  else
689  {
690  undistortImages = calibrationProvider->getImagesAreUndistorted();
691  if (!undistortImages)
692  {
693  ARMARX_ERROR << "Images expected to be undistorted, but the calibration returns that the images are distorted";
694  }
695  // visionx::StereoCalibration stereoCalibration = calibrationProvider->getStereoCalibration();
696  // CStereoCalibration* ivtStereoCalibration = visionx::tools::convert(stereoCalibration);
697  }
698 
699 
700  // create images
701  {
702  std::unique_lock lock(imageMutex);
703  cameraImages = new CByteImage*[numImages];
704 
705  for (int i = 0 ; i < numImages ; i++)
706  {
707  cameraImages[i] = visionx::tools::createByteImage(imageProviderInfo);
708  }
709  }
710 
711  visualizationImage = visionx::tools::createByteImage(imageProviderInfo);
712  grayImage = new CByteImage(imageProviderInfo.imageFormat.dimension.width, imageProviderInfo.imageFormat.dimension.height, CByteImage::eGrayScale);
713 
714 
715 
716  timeProvided = IceUtil::Time::seconds(0);
717 
718  isPaused = false;
719  connected = true;
720  updateImageMonitorUI();
721  updateFeaturesUI();
722 
723 
724  emit imageProviderConnected(true);
725 }
726 
727 
728 //disconnecting the image provider
729 void FeatureLearningWidgetController::disconnectFromProvider()
730 {
731  if (!connected)
732  {
733  return;
734  }
735  ARMARX_INFO << "Disconnecting from provider";
736  {
737  std::unique_lock lock(imageMutex);
738  // clear images
739  if (cameraImages)
740  {
741  for (int i = 0 ; i < numImages ; i++)
742  {
743  delete cameraImages[i];
744  }
745 
746  delete [] cameraImages;
747  }
748  delete visualizationImage;
749  delete grayImage;
750  }
751 
752  releaseImageProvider(imageProviderName);
753 
754  imageProviderPrx = 0;
755 
756  connected = false;
757  isPaused = true;
758  numSelectedPoints = 0;
759 
760  QString emptyFeaturesInfoText = "";
761  widget.lastActionInfoLabel->setText(emptyFeaturesInfoText);
762 
763  updateImageMonitorUI();
764  updateFeaturesUI();
765 
766  emit imageProviderConnected(false);
767 }
768 
769 
770 void FeatureLearningWidgetController::updatePausePlayButtonText()
771 {
772  if (isPaused)
773  {
774  widget.pausePlayButton->setText("Play");
775  return;
776  }
777  widget.pausePlayButton->setText("Pause");
778 }
779 
780 void FeatureLearningWidgetController::updateImageMonitorUI()
781 {
782  updatePausePlayButtonText();
783 
784  widget.disconnectButton->setEnabled(connected);
785  widget.pausePlayButton->setEnabled(connected);
786 
787  if (connected)
788  {
789  QString providerName = imageProviderName.c_str();
790  QString statusString = "Status: connected to image provider " + providerName;
791  if (isPaused)
792  {
793  statusString = statusString + " - PAUSED";
794  }
795  widget.imageMonitorStatusLabel->setText(statusString);
796  }
797  else
798  {
799  widget.imageMonitorStatusLabel->setText("Status: not connected");
800  }
801 
802 }
803 
805 {
806  disconnectFromProvider();
807 }
808 
810 {
811  int numFeaturesAdded = addFeatures();
812  QString featuresString = " features";
813  if (numFeaturesAdded == 1)
814  {
815  featuresString = " feature";
816  }
817  QString addedFeaturesText = "Added " + QString::number(numFeaturesAdded) + featuresString + " to the selection";
818  widget.lastActionInfoLabel->setText(addedFeaturesText);
819  updateFeaturesUI();
820 }
821 
823 {
824  clearFeatures();
825  QString clearedFeaturesText = "Cleared the selected features";
826  widget.lastActionInfoLabel->setText(clearedFeaturesText);
827  updateFeaturesUI();
828 }
829 
830 
831 //updates the information about the features on the right part of the ui
832 void FeatureLearningWidgetController::updateFeaturesUI()
833 {
834  if (!connected)
835  {
836  widget.addFeaturesButton->setEnabled(false);
837  widget.clearFeaturesButton->setEnabled(false);
838  widget.featuresInRegionLabel->setText("");
839  widget.featuresSelectedLabel->setText("");
840  return;
841  }
842  widget.addFeaturesButton->setEnabled(true);
843  widget.clearFeaturesButton->setEnabled(true);
844  QString featuresInRegionString = "Features in Region: ";
845  if (numSelectedPoints == 4)
846  {
847  featuresInRegionString += QString::number(viewFeatureSet->GetSize());
848  }
849  widget.featuresInRegionLabel->setText(featuresInRegionString);
850 
851  QString featuresSelectedString = "Features selected: " + QString::number(objectFeatureSet->GetSize());
852  widget.featuresSelectedLabel->setText(featuresSelectedString);
853 }
854 
855 
856 CFloatMatrix* FeatureLearningWidgetController::createCuboid(float w, float h, float d)
857 {
858  CFloatMatrix* object = new CFloatMatrix(6, 36);
859 
860  int offset = 0;
861  addRectangle(object, offset, 0, 0, 0, w, 0, 0, w, h, 0, 0, h, 0, 0, 0, -1);
862  addRectangle(object, offset, 0, 0, d, w, 0, d, w, h, d, 0, h, d, 0, 0, 1);
863  addRectangle(object, offset, 0, 0, 0, 0, 0, d, 0, h, d, 0, h, 0, -1, 0, 0);
864  addRectangle(object, offset, w, 0, 0, w, 0, d, w, h, d, w, h, 0, 1, 0, 0);
865  addRectangle(object, offset, 0, 0, 0, 0, 0, d, w, 0, d, w, 0, 0, 0, -1, 0);
866  addRectangle(object, offset, 0, h, 0, 0, h, d, w, h, d, w, h, 0, 0, 1, 0);
867 
868  for (int i = 0; i < 36; i++)
869  {
870  const int offset = 6 * i;
871  object->data[offset + 3] -= w / 2.0;
872  object->data[offset + 4] -= h / 2.0;
873  object->data[offset + 5] -= d / 2.0;
874  }
875 
876  return object;
877 }
878 
879 
880 void FeatureLearningWidgetController::addRectangle(CFloatMatrix* object, int& offset,
881  float x1, float y1, float z1,
882  float x2, float y2, float z2,
883  float x3, float y3, float z3,
884  float x4, float y4, float z4,
885  float n1, float n2, float n3)
886 {
887  addTriangle(object, offset, x1, y1, z1, x2, y2, z2, x3, y3, z3, n1, n2, n3);
888  addTriangle(object, offset, x4, y4, z4, x1, y1, z1, x3, y3, z3, n1, n2, n3);
889 }
890 
891 void FeatureLearningWidgetController::addTriangle(CFloatMatrix* object, int& offset,
892  float x1, float y1, float z1,
893  float x2, float y2, float z2,
894  float x3, float y3, float z3,
895  float n1, float n2, float n3)
896 {
897  float* data = object->data;
898 
899  data[offset + 0] = n1;
900  data[offset + 1] = n2;
901  data[offset + 2] = n3;
902  data[offset + 3] = x1;
903  data[offset + 4] = y1;
904  data[offset + 5] = z1;
905  offset += 6;
906 
907  data[offset + 0] = n1;
908  data[offset + 1] = n2;
909  data[offset + 2] = n3;
910  data[offset + 3] = x2;
911  data[offset + 4] = y2;
912  data[offset + 5] = z2;
913  offset += 6;
914 
915  data[offset + 0] = n1;
916  data[offset + 1] = n2;
917  data[offset + 2] = n3;
918  data[offset + 3] = x3;
919  data[offset + 4] = y3;
920  data[offset + 5] = z3;
921  offset += 6;
922 }
923 
925 {
926 
927  memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx;
928  memoryx::GridFileManagerPtr fileManager;
929 
930  if (!connectToPriorMemory(classesSegmentPrx, fileManager))
931  {
932  return;
933  }
934 
935  memoryx::EntityIdList idList = classesSegmentPrx->getAllEntityIds();
936 
937  ARMARX_INFO << "Found " << idList.size() << " object classes in the class segments: " << classesSegmentPrx->getReadCollectionsNS();
938  ARMARX_INFO << "Listing classes:";
939 
940  QComboBox* comboBox = featureLearningObjectChooserWidget->getWidget()->objectComboBox;
941 
942 
943  comboBox->clear();
944 
945  comboBox->addItem("", "");
946 
947  int objNum = 0;
948 
949  for (memoryx::EntityIdList::iterator iter = idList.begin(); iter != idList.end(); iter++)
950  {
951  memoryx::EntityPtr entity = memoryx::EntityPtr::dynamicCast(classesSegmentPrx->getEntityById(*iter));
952 
953  memoryx::ObjectClassPtr objectClass = memoryx::ObjectClassPtr::dynamicCast(entity);
954  QString objectName = QString::fromStdString(objectClass->getName());
955 
956  if (!entity)
957  {
958  ARMARX_IMPORTANT << "RECEIVED NULL Entity";
959  continue;
960  }
961 
962 
963  if (entity->hasAttribute("featureFile"))
964  {
965  TexturedRecognitionWrapperPtr recognitionWrapper = entity->addWrapper(new TexturedRecognitionWrapper(fileManager));
966  std::string featureFileName = recognitionWrapper->getFeatureFile();
967 
968  QString datFileName = QString::fromStdString(featureFileName);
969 
970  comboBox->addItem(objectName, datFileName);
971 
972  objNum++;
973  }
974 
975  }
976 
977  //comboBox->insertItems(0, objectNames);
978 
979  QSortFilterProxyModel* proxy = new QSortFilterProxyModel(comboBox);
980  proxy->setSourceModel(comboBox->model());
981  comboBox->model()->setParent(proxy);
982  comboBox->setModel(proxy);
983  comboBox->model()->sort(0);
984 
985 
986 
987 
988  featureLearningObjectChooserWidget->setModal(true);
989  featureLearningObjectChooserWidget->show();
990 
991 
992 }
993 
995 {
996  if (objectFeatureSet->GetSize() < 1)
997  {
998  QMessageBox emptyFeatureSetBox;
999  emptyFeatureSetBox.setText("Cannot save empty feature set!");
1000  emptyFeatureSetBox.setWindowTitle("Feature set empty");
1001  emptyFeatureSetBox.exec();
1002  return;
1003  }
1004 
1005  memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx;
1006  memoryx::GridFileManagerPtr fileManager;
1007 
1008  if (!connectToPriorMemory(classesSegmentPrx, fileManager))
1009  {
1010  return;
1011  }
1012 
1013 
1014  memoryx::EntityIdList idList = classesSegmentPrx->getAllEntityIds();
1015 
1016  ARMARX_INFO << "Found " << idList.size() << " object classes in the class segments: " << classesSegmentPrx->getReadCollectionsNS();
1017  ARMARX_INFO << "Listing classes:";
1018 
1019  QComboBox* comboBox = featureLearningSaveToMemoryWidget->getWidget()->objectComboBox;
1020 
1021  comboBox->clear();
1022 
1023  comboBox->addItem("", "");
1024 
1025  QMap<QString, bool> hasFeatureFileAlready;
1026 
1027  for (memoryx::EntityIdList::iterator iter = idList.begin(); iter != idList.end(); iter++)
1028  {
1029  memoryx::EntityPtr entity = memoryx::EntityPtr::dynamicCast(classesSegmentPrx->getEntityById(*iter));
1030 
1031 
1032  if (!entity)
1033  {
1034  ARMARX_IMPORTANT << "RECEIVED NULL Entity";
1035  continue;
1036  }
1037 
1038  QString objectName = QString::fromStdString(entity->getName());
1039  QString objectId = QString::fromStdString(entity->getId());
1040 
1041  //adding the object name as text and as data into the combo box
1042  comboBox->addItem(objectName, objectId);
1043 
1044  hasFeatureFileAlready[objectId] = entity->hasAttribute("featureFile");
1045  }
1046 
1047  //comboBox->insertItems(0, objectNames);
1048 
1049  QSortFilterProxyModel* proxy = new QSortFilterProxyModel(comboBox);
1050  proxy->setSourceModel(comboBox->model());
1051  comboBox->model()->setParent(proxy);
1052  comboBox->setModel(proxy);
1053  comboBox->model()->sort(0);
1054 
1055  featureLearningSaveToMemoryWidget->setOverwriteWarningMap(hasFeatureFileAlready);
1056 
1057  featureLearningSaveToMemoryWidget->setModal(true);
1058  featureLearningSaveToMemoryWidget->show();
1059 }
1060 
1062 {
1063  QString objectPath = featureLearningObjectChooserWidget->getWidget()->objectComboBox->itemData(featureLearningObjectChooserWidget->getWidget()->objectComboBox->currentIndex()).toString();
1064 
1065  CTexturedFeatureSet* tempFeatureSet = new CTexturedFeatureSet("tempFeatureSet");
1066 
1067  if (objectPath == "")
1068  {
1069  widget.lastActionInfoLabel->setText("No object choosen!");
1070  delete tempFeatureSet;
1071  return;
1072  }
1073 
1074  if (!featureLearningObjectChooserWidget->getWidget()->loadFeaturesCheckBox->isChecked())
1075  {
1076  loadFeatureSet(objectPath);
1077  delete tempFeatureSet;
1078  return;
1079  }
1080 
1081  const char* filePathCStr = objectPath.toStdString().c_str();
1082  if (!tempFeatureSet->LoadFromFile(filePathCStr))
1083  {
1084  ARMARX_ERROR << " could not load .dat file to extract feature dimensions from file " << filePathCStr;
1085  widget.lastActionInfoLabel->setText("Loading object dimensions failed!");
1086  }
1087  else
1088  {
1089  ARMARX_INFO << "loading feature dimensions";
1090 
1091  widget.lastActionInfoLabel->setText("Loaded object dimensions");
1092 
1093  float x = fabsf(2.f * tempFeatureSet->m_3dPoint2.x);
1094  float y = fabsf(2.f * tempFeatureSet->m_3dPoint2.y);
1095  float z = fabsf(2.f * tempFeatureSet->m_3dPoint2.z);
1096 
1097  int xInt = (int) x;
1098  int yInt = (int) y;
1099  int zInt = (int) z;
1100 
1101  widget.widthLineEdit->setText(QString::number(xInt));
1102  widget.heightLineEdit->setText(QString::number(yInt));
1103  widget.depthLineEdit->setText(QString::number(zInt));
1104 
1105 
1106  }
1107 
1108  delete tempFeatureSet;
1109 }
1110 
1111 
1113 {
1114  QString objectName = featureLearningSaveToMemoryWidget->getWidget()->objectComboBox->itemText(featureLearningSaveToMemoryWidget->getWidget()->objectComboBox->currentIndex());
1115  QString objectId = featureLearningSaveToMemoryWidget->getWidget()->objectComboBox->itemData(featureLearningSaveToMemoryWidget->getWidget()->objectComboBox->currentIndex()).toString();
1116 
1117 
1118  if (objectId == "")
1119  {
1120  widget.lastActionInfoLabel->setText("No object choosen!");
1121  return;
1122  }
1123 
1124 
1125  memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrx;
1126  memoryx::GridFileManagerPtr fileManager;
1127 
1128  if (!connectToPriorMemory(classesSegmentPrx, fileManager))
1129  {
1130  return;
1131  }
1132 
1133 
1134 
1135 
1136  memoryx::EntityPtr entity = memoryx::EntityPtr::dynamicCast(classesSegmentPrx->getEntityById(objectId.toStdString()));
1137 
1138  memoryx::ObjectClassPtr objectClass = memoryx::ObjectClassPtr::dynamicCast(entity);
1139 
1140  ObjectRecognitionWrapperPtr objectRecognitionWrapper = objectClass->addWrapper(new ObjectRecognitionWrapper());
1141 
1142  TexturedRecognitionWrapperPtr recognitionWrapper = objectClass->addWrapper(new TexturedRecognitionWrapper(fileManager));
1143 
1144 
1145 
1146 
1147  const std::string ns = classesSegmentPrx->getWriteCollectionNS();
1148  const size_t found = ns.find_first_of('.');
1149  std::string filesDBName = (found != std::string::npos) ? ns.substr(0, found) : "";
1150 
1151  QString tempDatFilePath = QDir::tempPath();
1152 
1153  tempDatFilePath += "/" + objectName + "_temp.dat";
1154 
1155 
1156  float w = widget.widthLineEdit->text().toFloat();
1157  float h = widget.heightLineEdit->text().toFloat();
1158  float d = widget.depthLineEdit->text().toFloat();
1159 
1160  Math3d::SetVec(objectFeatureSet->m_3dPoint1, -w / 2.0f, -h / 2.0f, -d / 2.0f);
1161  Math3d::SetVec(objectFeatureSet->m_3dPoint2, w / 2.0f, -h / 2.0f, -d / 2.0f);
1162  Math3d::SetVec(objectFeatureSet->m_3dPoint3, w / 2.0f, h / 2.0f, -d / 2.0f);
1163  Math3d::SetVec(objectFeatureSet->m_3dPoint4, -w / 2.0f, h / 2.0f, -d / 2.0f);
1164 
1165 
1166 
1167  if (!objectFeatureSet->SaveToFile(tempDatFilePath.toStdString().c_str()))
1168  {
1169  ARMARX_ERROR << " could not save temp feature set to file " << tempDatFilePath;
1170  widget.lastActionInfoLabel->setText("Saving features to memory failed!");
1171  }
1172  else
1173  {
1174  ARMARX_INFO << " saved temp feature set with " << objectFeatureSet->GetSize() << " features to file " << tempDatFilePath;
1175  }
1176 
1177 
1178  recognitionWrapper->setFeatureFile(tempDatFilePath.toStdString(), filesDBName);
1179  objectRecognitionWrapper->setRecognitionMethod("TexturedObjectRecognition");
1180  classesSegmentPrx->updateEntity(objectClass->getId(), objectClass);
1181 }
1182 
1183 
1184 bool FeatureLearningWidgetController::connectToPriorMemory(memoryx::PersistentObjectClassSegmentBasePrx& classesSegmentPrx, memoryx::GridFileManagerPtr& fileManager)
1185 {
1186  try
1187  {
1188  std::string priorKnowledgeProxyName = "PriorKnowledge";
1189 
1190 
1191  memoryx::PriorKnowledgeInterfacePrx priorKnowledgePrx;
1192  memoryx::PersistentObjectClassSegmentBasePrx classesSegmentPrxTemp;
1193  memoryx::CommonStorageInterfacePrx databasePrx;
1194  memoryx::GridFileManagerPtr fileManagerTemp;
1195 
1196  priorKnowledgePrx = getProxy<memoryx::PriorKnowledgeInterfacePrx>(priorKnowledgeProxyName);
1197  classesSegmentPrxTemp = priorKnowledgePrx->getObjectClassesSegment();
1198  databasePrx = priorKnowledgePrx->getCommonStorage();
1199 
1200  //memoryx::CollectionInterfacePrx coll = databasePrx->requestCollection(getProperty<std::string>("DataBaseObjectCollectionName").getValue());
1201  memoryx::CollectionInterfacePrx coll = databasePrx->requestCollection("memdb.Prior_Objects");
1202 
1203  classesSegmentPrxTemp->addReadCollection(coll);
1204  //classesSegmentPrx->setWriteCollection(coll);
1205 
1206  fileManagerTemp.reset(new memoryx::GridFileManager(databasePrx));
1207 
1208  classesSegmentPrx = classesSegmentPrxTemp;
1209  fileManager = fileManagerTemp;
1210  return true;
1211  }
1212  catch (Ice::Exception& e)
1213  {
1214  ARMARX_ERROR << "Could not connect to PriorMemory";
1215 
1216  QMessageBox priorMemoryNotConnectedBox;
1217  priorMemoryNotConnectedBox.setText("Cannot connect to PriorMemory! Ensure that PriorMemory is present.");
1218  priorMemoryNotConnectedBox.setWindowTitle("PriorMemory not available");
1219  priorMemoryNotConnectedBox.exec();
1220  return false;
1221  }
1222 }
armarx::FeatureLearningWidgetController::reconnect
void reconnect()
Definition: FeatureLearningWidgetController.cpp:617
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::FeatureLearningWidgetController::objectChooserButtonClicked
void objectChooserButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:924
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
armarx::FeatureLearningWidgetController::saveFeaturesButtonClicked
void saveFeaturesButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:559
armarx::FeatureLearningWidgetController::clearFeaturesButtonClicked
void clearFeaturesButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:822
armarx::FeatureLearningWidgetController::loadFeaturesButtonClicked
void loadFeaturesButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:538
armarx::FeatureLearningWidgetController::connectButtonClicked
void connectButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:531
armarx::FeatureLearningWidgetController::loadSettings
virtual void loadSettings(QSettings *settings) override
Definition: FeatureLearningWidgetController.cpp:99
armarx::FeatureLearningWidgetController::saveSettings
virtual void saveSettings(QSettings *settings) override
Definition: FeatureLearningWidgetController.cpp:105
GfxTL::Vec2d
VectorXD< 2, double > Vec2d
Definition: VectorXD.h:694
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
ObjectRecognitionWrapper.h
armarx::FeatureLearningWidgetController::pausePlayButtonClicked
void pausePlayButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:603
ObjectClass.h
UnscentedTransform.h
armarx::FeatureLearningWidgetController::addPolygonPoint
void addPolygonPoint(int, float x, float y)
Definition: FeatureLearningWidgetController.cpp:512
visionx::tools::createByteImage
CByteImage * createByteImage(const ImageFormatInfo &imageFormat, const ImageType imageType)
Creates a ByteImage for the destination type specified in the given imageProviderInfo.
armarx::FeatureLearningWidgetController::onConnectImageProcessor
virtual void onConnectImageProcessor() override
Definition: FeatureLearningWidgetController.cpp:137
IceInternal::Handle
Definition: forward_declarations.h:8
deactivateSpam
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition: Logging.cpp:72
visionx::FeatureLearningSaveToMemoryWidget
Definition: FeatureLearningSaveToMemoryWidget.h:46
armarx::ctrlutil::a
double a(double t, double a0, double j)
Definition: CtrlUtil.h:45
armarx::FeatureLearningWidgetController::saveToMemoryAccepted
void saveToMemoryAccepted()
Definition: FeatureLearningWidgetController.cpp:1112
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
IceProxyFinder.h
memoryx::EntityWrappers::TexturedRecognitionWrapper
TexturedRecognitionWrapper offers a simplified access to the data of an object class or instance rela...
Definition: ObjectRecognitionWrapper.h:66
armarx::FeatureLearningWidgetController::saveToMemoryButtonClicked
void saveToMemoryButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:994
armarx::FeatureLearningWidgetController::onInitImageProcessor
virtual void onInitImageProcessor() override
Definition: FeatureLearningWidgetController.cpp:110
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::FeatureLearningWidgetController::process
virtual void process() override
Definition: FeatureLearningWidgetController.cpp:436
armarx::FeatureLearningWidgetController::disconnectButtonClicked
void disconnectButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:804
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
ARMARX_LOG
#define ARMARX_LOG
Definition: Logging.h:163
armarx::TimeUtil::GetTime
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
Definition: TimeUtil.cpp:42
ExpressionException.h
ProbabilityMeasures.h
armarx::SelectableImageViewer
A clickable, i.e. selectable, visionx::ImageViewerArea.
Definition: SelectableImageViewer.h:44
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
memoryx::EntityWrappers
Definition: AbstractEntityWrapper.cpp:28
armarx::FeatureLearningWidgetController::onExitImageProcessor
virtual void onExitImageProcessor() override
Definition: FeatureLearningWidgetController.cpp:255
armarx::FeatureLearningWidgetController::FeatureLearningWidgetController
FeatureLearningWidgetController()
Controller Constructor.
Definition: FeatureLearningWidgetController.cpp:60
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:32
armarx::FeatureLearningWidgetController::onDisconnectImageProcessor
virtual void onDisconnectImageProcessor() override
Definition: FeatureLearningWidgetController.cpp:250
Entity.h
EarlyVisionConverters.h
armarx::IceProxyFinder< ImageProviderInterfacePrx >
visionx::tools::typeNameToImageType
ImageType typeNameToImageType(const std::string &imageTypeName)
Converts an image type name as string into an ImageType integer.
Definition: TypeMapping.cpp:42
memoryx::EntityWrappers::ObjectRecognitionWrapper
Definition: ObjectRecognitionWrapper.h:40
ImageUtil.h
memoryx::GridFileManager
GridFileManager provides utility functions for working with files in Mongo GridFS and links to them s...
Definition: GridFileManager.h:42
armarx::FeatureLearningWidgetController::objectChooserAccepted
void objectChooserAccepted()
Definition: FeatureLearningWidgetController.cpp:1061
visionx::FeatureLearningObjectChooserWidget
Definition: FeatureLearningObjectChooserWidget.h:45
TypeMapping.h
armarx::handleExceptions
void handleExceptions()
Definition: Exception.cpp:141
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::FeatureLearningWidgetController::addFeaturesButtonClicked
void addFeaturesButtonClicked(bool toggled)
Definition: FeatureLearningWidgetController.cpp:809
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
FeatureLearningWidgetController.h
armarx::FeatureLearningWidgetController::~FeatureLearningWidgetController
virtual ~FeatureLearningWidgetController()
Controller destructor.
Definition: FeatureLearningWidgetController.cpp:93