ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PclAnnotationTool.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "PclAnnotationTool.h"
9 
10 #ifdef _MSC_VER
11 #pragma warning(disable : 4996) // Use of [[deprecated]] feature
12 #endif
13 
14 // Local
15 #include <Utils/PCLConv.h>
16 #include <Utils/cc2sm.h>
17 
18 #include "PclUtils/PCLVis.h"
20 #include "Tools/Common/ecvTools.h"
21 
22 // CV_CORE_LIB
23 #include <CVGeom.h>
24 #include <CVLog.h>
25 #include <CVTools.h>
26 #include <ClassMap.h>
27 
28 // CV_DB_LIB
29 #include <ecvDisplayTools.h>
30 
31 #ifdef USE_TBB
32 #include <tbb/parallel_for.h>
33 #endif
34 
35 // VTK
36 #include <vtkRenderWindowInteractor.h>
37 
38 // QT
39 #include <QDir>
40 #include <QFileInfo>
41 
42 #define DEFAULT_POINT 0
43 #define SELECTED_POINT -1
44 
45 using namespace PclUtils;
46 
48  : ecvGenericAnnotationTool(mode) {}
49 
51  AnnotationMode mode)
52  : ecvGenericAnnotationTool(mode) {
53  this->initialize(viewer);
54 }
55 
57 
60  assert(viewer);
61  setVisualizer(viewer);
62 
63  resetMode();
64 
65  // init annotation manager
66  m_annoManager.reset(
67  new Annotaions(m_annotationMode == AnnotationMode::BOUNDINGBOX
68  ? m_viewer->getRenderWindowInteractor()
69  : nullptr));
70 
71  m_currPickedAnnotation = nullptr;
72 
73  // init m_baseCloud
74  m_baseCloud.reset(new PointCloudI);
75  m_cloudLabel = nullptr;
76 }
77 
78 bool PclAnnotationTool::loadClassesFromFile(const std::string& file) {
79  std::ifstream input(file.c_str(), std::ios_base::in);
80  if (!input.good()) {
81  CVLog::Error(tr("Cannot open file : %1").arg(file.c_str()));
82  return false;
83  }
84 
85  std::vector<std::string> labels;
86  std::string value;
87  while (input >> value) {
88  if (value == "") continue;
89  labels.push_back(value);
90  }
92  tr("load %1 classes from %2").arg(labels.size()).arg(file.c_str()));
93  initAnnotationLabels(labels);
94  return true;
95 }
96 
98  const std::vector<std::string>& labelList) {
99  if (labelList.empty()) return;
100 
101  // cache annotation type history
102  std::vector<int> tempIndex;
103  for (auto anno : m_annoManager->getAnnotations()) {
104  tempIndex.push_back(Annotation::GetTypeIndex(anno->getType()));
105  }
106 
107  // init label type
108  Annotation::GetTypes()->clear();
109  for (size_t i = 0; i < labelList.size(); ++i) {
110  if (labelList[i] == "") {
111  continue;
112  }
113  Annotation::GetTypes()->push_back(labelList[i]);
114  }
115 
116  // update existing annotation type
117  int index = -1;
118 
119  std::vector<Annotation*> toBeRemovedAnnotations;
120  for (auto anno : m_annoManager->getAnnotations()) {
121  index++;
122  if (Annotation::GetTypes()->size() - 1 < tempIndex[index]) {
123  toBeRemovedAnnotations.push_back(anno);
124  CVLog::Warning(tr("drop annotaion[%1] which is out of range or "
125  "current classSets")
126  .arg(anno->getType().c_str()));
127  continue;
128  }
129 
130  anno->setType(Annotation::GetTypes()->at(tempIndex[index]));
131  m_annoManager->updateBalloonByIndex(index);
132  labelCloudByAnnotation(anno);
133  }
134 
135  // remove invalid annotations
136  for (size_t i = 0; i < toBeRemovedAnnotations.size(); ++i) {
137  removeAnnotation(toBeRemovedAnnotations[i]);
138  }
139 
140  updateCloud();
141 }
142 
144  if (!m_viewer) return;
145 
146  m_viewer->toggleAreaPicking();
147 }
148 
150  std::vector<std::string>& labelList) {
151  // get label types
152  labelList.clear();
153  for (size_t i = 0; i < Annotation::GetTypes()->size(); ++i) {
154  if (Annotation::GetTypes()->at(i) == "") {
155  continue;
156  }
157  labelList.push_back(Annotation::GetTypes()->at(i));
158  }
159 }
160 
161 bool PclAnnotationTool::getCurrentAnnotations(std::vector<int>& annos) const {
162  return m_annoManager && m_annoManager->getAnnotations(annos);
163 }
164 
165 bool PclAnnotationTool::setInputCloud(ccPointCloud* cloud, int viewport) {
166  PCLCloud::Ptr smCloud = cc2smReader(cloud).getAsSM();
167  if (!smCloud) {
168  return false;
169  }
170 
171  FROM_PCL_CLOUD(*smCloud, *this->m_baseCloud);
172  if (this->m_baseCloud->size() < 1) {
173  return false;
174  }
175 
176  // hide origin cloud
177  {
178  m_baseCloudId = cloud->getViewId().toStdString();
179  vtkActor* modelActor = m_viewer->getActorById(m_baseCloudId);
180  if (modelActor) {
181  modelActor->SetVisibility(0);
182  }
183  }
184 
185  m_annoManager->preserve(this->m_baseCloud->size());
186 
187  m_pointcloudFileName = CVTools::FromQString(cloud->getFullPath());
188  QFileInfo fileInfo(cloud->getFullPath());
189 
190  QString annoName = fileInfo.baseName();
191  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
192  annoName = fileInfo.baseName() + ".boxes";
193  } else if (m_annotationMode == AnnotationMode::SEMANTICS) {
194  annoName = fileInfo.baseName() + ".labels";
195  }
196 
197  QDir dir(fileInfo.absolutePath());
198 
199  // 1. load classes file if exists in current file path
200  QString classesFile = dir.absoluteFilePath("Classets.classes");
201  if (!(QFile::exists(classesFile) &&
202  loadClassesFromFile(CVTools::FromQString(classesFile)))) {
203  // load default classes!
204  this->loadDefaultClasses();
205  }
206 
207  // 2. load labels or boxes annotaion file if exists in curren file path
208  m_annotationFileName = CVTools::FromQString(dir.absoluteFilePath(annoName));
209  {
210  if (QFile::exists(CVTools::ToQString(m_annotationFileName))) {
211  m_annoManager->loadAnnotations(m_annotationFileName,
213  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
214  CVLog::Print(tr("%1: load %2 boxes")
215  .arg(m_annotationFileName.c_str())
216  .arg(m_annoManager->getSize()));
217  } else if (m_annotationMode == AnnotationMode::SEMANTICS) {
218  CVLog::Print(tr("%1: load %2 classes")
219  .arg(m_annotationFileName.c_str())
220  .arg(m_annoManager->getSize()));
221  }
222  }
223  }
224 
225  refresh();
226  return true;
227 }
228 
229 void PclAnnotationTool::refresh() {
230  m_cloudLabel = new int[m_baseCloud->size()];
231  memset(m_cloudLabel, DEFAULT_POINT, m_baseCloud->size() * sizeof(int));
232  labelCloudByAnnotations();
233 
234  m_colorHandler.setInputCloud(m_baseCloud);
235  m_colorHandler.setLabel(m_cloudLabel);
236  m_viewer->addPointCloud<PointIntensity>(m_baseCloud, m_colorHandler,
237  m_annotationCloudId, 0);
238 
239  // show annotation if exists
240  showAnnotation();
241  updateCloud();
242 }
243 
245  if (m_viewer) {
246  m_viewer->setAreaPickingEnabled(true);
247  m_viewer->setPointPickingEnabled(false);
248 
249  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
250  m_viewer->setActorPickingEnabled(true);
251  }
252 
253  connect(m_viewer, &PCLVis::interactorPickedEvent, this,
255  connect(m_viewer, &PCLVis::interactorKeyboardEvent, this,
257  connect(m_viewer, &PCLVis::interactorAreaPickedEvent, this,
259  }
260 }
261 
263  if (m_viewer) {
264  m_viewer->setAreaPickingEnabled(false);
265  m_viewer->setPointPickingEnabled(true);
266 
267  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
268  m_viewer->setActorPickingEnabled(false);
269  }
270 
271  disconnect(m_viewer, &PCLVis::interactorPickedEvent, this,
273  disconnect(m_viewer, &PCLVis::interactorKeyboardEvent, this,
275  disconnect(m_viewer, &PCLVis::interactorAreaPickedEvent, this,
277  }
278 
279  resetMode();
280  clear();
281  CVLog::Print("unregister annotations tool successfully");
282 }
283 
285  if (viewer) {
286  m_viewer = reinterpret_cast<PCLVis*>(viewer);
287  if (!m_viewer) {
289  "[PclAnnotationTool::setVisualizer] viewer is Null!");
290  }
291  } else {
292  CVLog::Warning("[PclAnnotationTool::setVisualizer] viewer is Null!");
293  }
294 }
296 
299  m_intersectMode = true;
300  m_unionMode = false;
301  m_trimMode = false;
302 }
303 
305  m_intersectMode = false;
306  m_unionMode = true;
307  m_trimMode = false;
308 }
309 
311  m_intersectMode = false;
312  m_unionMode = false;
313  m_trimMode = true;
314 }
315 
317  m_intersectMode = false;
318  m_unionMode = false;
319  m_trimMode = false;
320 }
321 
324 
326  const std::vector<int>& new_selected_slice) {
327  if (new_selected_slice.empty() || !m_viewer) return;
328 
329  int s = m_viewer->getRenderWindowInteractor()->GetShiftKey();
330  int c = m_viewer->getRenderWindowInteractor()->GetControlKey();
331  int a = m_viewer->getRenderWindowInteractor()->GetAltKey();
332  bool skip = a;
333 
334  // remove existed annotated points
335  std::vector<int> selected_slice;
336  filterPickedSlice(new_selected_slice, selected_slice, skip);
337  if (selected_slice.empty()) return;
338 
339  if (!m_last_selected_slice.empty()) {
340  defaultColorPoint(m_last_selected_slice);
341  }
342 
343  if (s && c || m_intersectMode) { // intersection
344  m_last_selected_slice = ecvTools::IntersectionVector(
345  m_last_selected_slice, selected_slice);
346  } else if (s || m_unionMode) { // union
347  m_last_selected_slice =
348  ecvTools::UnionVector(m_last_selected_slice, selected_slice);
349  } else if (c || m_trimMode) { // remove
350  m_last_selected_slice =
351  ecvTools::DiffVector(m_last_selected_slice, selected_slice);
352  } else { // new
353  m_last_selected_slice = selected_slice;
354  }
355 
356  highlightPoint(m_last_selected_slice);
357  updateCloud();
358 }
359 
361  if (m_currPickedAnnotation) {
362  m_currPickedAnnotation->unpicked();
363  m_currPickedAnnotation = nullptr;
364  }
365 
366  if (!actor) {
367  return;
368  }
369 
370  // get the correspond annotation
371  m_currPickedAnnotation = m_annoManager->getAnnotation(actor);
372  if (m_currPickedAnnotation) {
373  m_currPickedAnnotation->picked(m_viewer->getRenderWindowInteractor());
375  } else {
377  }
378 }
379 
380 void PclAnnotationTool::keyboardEventProcess(const std::string& symKey) {
381  // delete annotation
382  if (symKey == "Delete") {
383  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
384  if (m_currPickedAnnotation) {
385  CVLog::Print(
386  tr("remove box annotation [%1] with %2 points")
387  .arg(m_currPickedAnnotation->getType().c_str())
388  .arg(m_currPickedAnnotation->getSlice()
389  .size()));
390  removeAnnotation(m_currPickedAnnotation);
391  updateCloud();
392  }
393  } else if (m_annotationMode == AnnotationMode::SEMANTICS) {
394  if (!m_annoManager->getAnnotations().empty()) {
395  Annotation* anno = m_annoManager->getAnnotations().back();
396  CVLog::Print(tr("remove last annotation [%1] with %2 points")
397  .arg(anno->getType().c_str())
398  .arg(anno->getSlice().size()));
399  removeAnnotation(anno);
400  updateCloud();
401  } else {
402  CVLog::Warning("no annotation exists!");
403  }
404  }
405  }
406 }
408 
410 void PclAnnotationTool::filterPickedSlice(const std::vector<int>& inSlices,
411  std::vector<int>& outSlices,
412  bool skip) {
413  if (!outSlices.empty()) {
414  outSlices.clear();
415  }
416 
417  for (auto& x : inSlices) {
418  if (m_annoManager->getLabelByIndex(x) == DEFAULT_POINT || skip) {
419  outSlices.push_back(x);
420  }
421  }
422 }
423 
424 void PclAnnotationTool::fastLabelCloud(const std::vector<int>& inSlices,
425  int label) {
426  int num = static_cast<int>(inSlices.size());
427  if (m_cloudLabel && num != 0) {
428 #ifdef USE_TBB
429  tbb::parallel_for(0, num,
430  [&](int dataIndex)
431 #else
432 
433 #if defined(_OPENMP)
434 #pragma omp parallel for
435 #endif
436  for (int dataIndex = 0; dataIndex < num; ++dataIndex)
437 #endif
438  { m_cloudLabel[inSlices[dataIndex]] = label; }
439 #ifdef USE_TBB
440  );
441 #endif
442  }
443 }
444 
446  // create annotation from last selected slice
447  if (m_last_selected_slice.size() > 3) {
448  createAnnotationFromSelectPoints(type);
449  } else {
450  // show annotation interactor if current picked annotation is not None
451  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
452  if (m_currPickedAnnotation) {
453  CVLog::Print(
454  tr("Change current picked annotation type from [%1] to "
455  "[%2].")
456  .arg(m_currPickedAnnotation->getType().c_str(),
457  type.c_str()));
458  changeAnnotationType(m_currPickedAnnotation, type);
459  } else {
461  tr("No box picked now! Please pick one box and try "
462  "again!"));
463  }
464  } else if (m_annotationMode == AnnotationMode::SEMANTICS) {
465  std::vector<Annotation*>& annos = m_annoManager->getAnnotations();
466  if (!annos.empty() && annos.back()->getType() != type) {
467  CVLog::Print(tr("Change last annotation type from [%1] to [%2]")
468  .arg(annos.back()->getType().c_str(),
469  type.c_str()));
470  changeAnnotationType(annos.back(), type);
471  } else {
473  tr("No annotation exists now! Please create one and "
474  "try again!"));
475  }
476  }
477  }
478 }
479 
481  if (m_annotationMode == AnnotationMode::SEMANTICS) {
482  m_lastSelectedAnnotations.clear();
483  m_annoManager->getAnnotations(type, m_lastSelectedAnnotations);
484  if (m_lastSelectedAnnotations.empty()) {
485  CVLog::Warning(tr("Cannot find annotation type [%1], ignore it!")
486  .arg(type.c_str()));
487  return;
488  } else {
489  m_last_selected_slice.clear();
490  for (Annotation* anno : m_lastSelectedAnnotations) {
491  if (anno) {
492  m_last_selected_slice.insert(m_last_selected_slice.end(),
493  anno->getSlice().begin(),
494  anno->getSlice().end());
495  m_annoManager->remove(anno);
496  }
497  }
498 
499  if (m_last_selected_slice.empty()) {
500  return;
501  }
502 
503  highlightPoint(m_last_selected_slice);
504  updateCloud();
505  }
506  }
507 }
508 
510  const std::string& type) {
511  if (!anno) return;
512 
513  anno->setType(type);
514  m_annoManager->updateBalloonByAnno(anno);
515  m_annoManager->updateLabels(anno, false);
516  showAnnotation(anno);
517  updateCloud();
518 }
519 
521  m_annoManager->saveAnnotations(m_annotationFileName, int(m_annotationMode));
522  CVLog::Print(tr("Annotations file has been saved to %1")
523  .arg(CVTools::ToQString(m_annotationFileName)));
524 }
525 
526 void PclAnnotationTool::createAnnotationFromSelectPoints(std::string type) {
527  if (m_last_selected_slice.size() > 3) {
528  Annotation* anno = nullptr;
529  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
530  anno = new Annotation(m_baseCloud, m_last_selected_slice, type);
531  } else if (m_annotationMode == AnnotationMode::SEMANTICS) {
532  anno = new Annotation(m_last_selected_slice, type);
533  }
534 
535  m_annoManager->add(anno);
536  m_last_selected_slice.clear();
537  showAnnotation(anno);
538  updateCloud();
539  } else {
540  CVLog::Warning(tr(
541  "No points selected or selected points number is less than 3"));
542  }
543 }
544 
545 void PclAnnotationTool::labelCloudByAnnotations() {
546  if (!m_cloudLabel) return;
547  for (auto anno : m_annoManager->getAnnotations()) {
548  labelCloudByAnnotation(anno);
549  }
550 }
551 
552 void PclAnnotationTool::labelCloudByAnnotation(const Annotation* anno) {
553  if (!anno || anno->getSlice().empty()) return;
554  fastLabelCloud(anno->getSlice(), Annotation::GetTypeIndex(anno->getType()));
555 }
556 
557 void PclAnnotationTool::resetCloudByAnnotation(const Annotation* anno) {
558  if (!m_viewer || !m_viewer->contains(m_annotationCloudId) || !anno ||
559  anno->getSlice().empty()) {
560  return;
561  }
562 
563  fastLabelCloud(anno->getSlice(), DEFAULT_POINT);
564 }
565 
566 void PclAnnotationTool::updateCloudLabel(const std::string& type) {
567  if (!m_cloudLabel || m_last_selected_slice.size() < 1) return;
568 
569  fastLabelCloud(m_last_selected_slice, Annotation::GetTypeIndex(type));
570 }
571 
572 void PclAnnotationTool::loadDefaultClasses() {
573  std::vector<std::string> labels;
574  for (auto it : ClassMap::SemanticMap) {
575  labels.push_back(it.second);
576  }
577 
578  initAnnotationLabels(labels);
579 }
581 
583 void PclAnnotationTool::highlightPoint(std::vector<int>& slice) {
584  if (slice.size() < 1) return;
585 
586  fastLabelCloud(slice, SELECTED_POINT);
587 }
588 
589 void PclAnnotationTool::defaultColorPoint(std::vector<int>& slice) {
590  if (!m_viewer || !m_viewer->contains(m_annotationCloudId)) return;
591 
592  if (slice.empty()) {
593  if (m_cloudLabel) {
594  memset(m_cloudLabel, DEFAULT_POINT,
595  m_baseCloud->size() * sizeof(int));
596  }
597  return;
598  }
599 
600  fastLabelCloud(slice, DEFAULT_POINT);
601 }
602 
604  if (!m_viewer || m_viewer->contains(m_annotationCloudId)) {
605  m_viewer->updatePointCloud<PointIntensity>(m_baseCloud, m_colorHandler,
606  m_annotationCloudId);
608  }
609 }
610 
611 void PclAnnotationTool::setPointSize(const std::string& viewID, int viewport) {
612  if (!m_viewer) return;
613  m_viewer->setPointCloudRenderingProperties(
614  pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, viewID, viewport);
615 }
616 
618  for (auto anno : m_annoManager->getAnnotations()) {
619  showAnnotation(anno);
620  }
621 }
622 
624  for (auto anno : m_annoManager->getAnnotations()) {
625  hideAnnotation(anno);
626  }
627 }
628 
630  if (!m_viewer) return;
631 
632  vtkActor* originActor = m_viewer->getActorById(m_baseCloudId);
633  if (originActor) {
634  originActor->SetVisibility(1);
635  }
636 
637  vtkActor* annotatedActor = m_viewer->getActorById(m_annotationCloudId);
638  if (annotatedActor) {
639  annotatedActor->SetVisibility(0);
640  }
641 }
642 
644  vtkActor* originActor = m_viewer->getActorById(m_baseCloudId);
645  if (originActor) {
646  originActor->SetVisibility(0);
647  }
648 
649  vtkActor* annotatedActor = m_viewer->getActorById(m_annotationCloudId);
650  if (annotatedActor) {
651  annotatedActor->SetVisibility(1);
652  }
653 }
654 
657  m_currPickedAnnotation = nullptr;
658  m_last_selected_slice.clear();
659 }
660 
662  if (!m_viewer) return;
663 
664  m_viewer->removePointCloud(m_annotationCloudId);
665  reset();
666  m_annoManager->release();
667 
668  // show origin cloud
669  {
670  vtkActor* modelActor = m_viewer->getActorById(m_baseCloudId);
671  if (modelActor) {
672  modelActor->SetVisibility(1);
673  }
674  }
675 
676  if (m_cloudLabel) {
677  delete[] m_cloudLabel;
678  m_cloudLabel = nullptr;
679  }
680 }
681 
683  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
684  if (!m_viewer) return;
685  m_viewer->addActorToRenderer(anno->getActor());
686  }
687  labelCloudByAnnotation(anno);
688 }
689 
691  hideAnnotation();
692  m_annoManager->clear();
693  std::vector<int> temp;
694  defaultColorPoint(temp);
695  updateCloud();
696 }
697 
699  hideAnnotation(anno);
700  m_annoManager->remove(anno);
701 }
702 
704  if (m_currPickedAnnotation) {
705  m_currPickedAnnotation->unpicked();
706  m_currPickedAnnotation = nullptr;
707  }
708 
709  resetCloudByAnnotation(anno);
710 
711  if (m_annotationMode == AnnotationMode::BOUNDINGBOX) {
712  if (!m_viewer) return;
713  m_viewer->removeActorFromRenderer(anno->getActor());
714  }
715 }
int size
char type
pcl::PointXYZI PointIntensity
Definition: PCLCloud.h:18
pcl::PointCloud< PointIntensity > PointCloudI
Definition: PCLCloud.h:19
#define FROM_PCL_CLOUD
Definition: PCLConv.h:11
#define SELECTED_POINT
#define DEFAULT_POINT
void picked(vtkRenderWindowInteractor *interactor)
enter picked state, show boxwidget which allow to adjust annotation
Definition: Annotaion.cpp:240
static std::size_t GetTypeIndex(std::string type_)
GetTypeIndex auto add to vector map if has not.
Definition: Annotaion.cpp:362
static std::vector< std::string > * GetTypes()
get types vector pointer
Definition: Annotaion.cpp:354
vtkSmartPointer< vtkActor > getActor() const
Definition: Annotaion.cpp:333
void unpicked()
disable boxWidget
Definition: Annotaion.cpp:277
std::string getType() const
Definition: Annotaion.cpp:320
const std::vector< int > & getSlice() const
Definition: Annotaion.cpp:322
void setType(const std::string value)
change the type of annotation, and color too
Definition: Annotaion.cpp:324
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
static std::string FromQString(const QString &qs)
Definition: CVTools.cpp:100
static QString ToQString(const std::string &s)
Definition: CVTools.cpp:92
virtual void toggleInteractor() override
virtual void initialize(ecvGenericVisualizer3D *viewer) override
virtual void initAnnotationLabels(const std::vector< std::string > &labelList) override
virtual void resetMode() override
virtual void unionMode() override
void pointPickingProcess(int index)
virtual void showOrigin() override
virtual void exportAnnotations() override
export annotations
virtual void start() override
virtual void getAnnotationLabels(std::vector< std::string > &labelList) override
void areaPickingEventProcess(const std::vector< int > &new_selected_slice)
virtual void removeAnnotation() override
virtual void reset() override
clear state before load new cloud and annotation
virtual void stop() override
virtual bool getCurrentAnnotations(std::vector< int > &annos) const override
virtual void changeAnnotationType(const std::string &type) override
virtual void trimMode() override
virtual void showAnnotation() override
void pickedEventProcess(vtkActor *actor)
PclAnnotationTool(AnnotationMode mode=AnnotationMode::BOUNDINGBOX)
virtual void clear() override
void keyboardEventProcess(const std::string &symKey)
virtual bool setInputCloud(ccPointCloud *pointCloud, int viewport=0) override
virtual void intersectMode() override
virtual void setVisualizer(ecvGenericVisualizer3D *viewer=nullptr) override
virtual void hideOrigin() override
virtual void updateCloud() override
virtual void hideAnnotation() override
virtual void selectExistedAnnotation(const std::string &type) override
virtual bool loadClassesFromFile(const std::string &file) override
virtual ~PclAnnotationTool() override
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud to be used.
void addActorToRenderer(const vtkSmartPointer< vtkProp > &actor, int viewport=0)
Definition: PCLVis.cpp:3137
void setAreaPickingEnabled(bool state)
Definition: PCLVis.h:676
void toggleAreaPicking()
Definition: PCLVis.cpp:2845
vtkSmartPointer< vtkRenderWindowInteractor > getRenderWindowInteractor()
Get a pointer to the current interactor style used.
Definition: PCLVis.h:148
void setPointPickingEnabled(bool state)
Definition: PCLVis.h:668
bool removeActorFromRenderer(const vtkSmartPointer< vtkProp > &actor, int viewport=0)
Internal method. Adds a vtk actor to screen.
Definition: PCLVis.cpp:3105
void setActorPickingEnabled(bool state)
Definition: PCLVis.h:681
vtkActor * getActorById(const std::string &viewId)
Definition: PCLVis.cpp:3022
CC to PCL cloud converter.
Definition: cc2sm.h:43
PCLCloud::Ptr getAsSM(std::list< std::string > &requested_fields) const
Definition: cc2sm.cpp:607
QString getViewId() const
Definition: ecvHObject.h:225
QString getFullPath() const
Definition: ecvObject.h:190
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
static void UpdateScreen()
Generic Annotation Tool interface.
AnnotationMode
Default constructor.
void objectPicked(bool isPicked)
Generic visualizer 3D interface.
a[190]
normal_z x
static std::map< size_t, std::string > SemanticMap
Definition: ClassMap.h:15
Rgb at(size_t color_id)
static std::vector< int > DiffVector(std::vector< int > a, std::vector< int > b)
Definition: ecvTools.h:45
static std::vector< int > UnionVector(std::vector< int > &a, std::vector< int > &b)
Definition: ecvTools.h:39
static std::vector< int > IntersectionVector(std::vector< int > &a, std::vector< int > &b)
Definition: ecvTools.h:30