ExportCloudsDialog.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef RTABMAP_CORE_EXPORTCLOUDSDIALOG_H_
29 #define RTABMAP_CORE_EXPORTCLOUDSDIALOG_H_
30 
31 #include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
32 
33 #include <QDialog>
34 #include <QMap>
35 #include <QtCore/QSettings>
36 
37 #include <rtabmap/core/Signature.h>
39 
40 #include <pcl/point_cloud.h>
41 #include <pcl/point_types.h>
42 #include <pcl/PolygonMesh.h>
43 #include <pcl/TextureMesh.h>
44 #include <pcl/pcl_base.h>
45 
46 class Ui_ExportCloudsDialog;
47 class QAbstractButton;
48 
49 namespace rtabmap {
50 class ProgressDialog;
51 class GainCompensator;
52 class DBDriver;
53 
54 class RTABMAP_GUI_EXPORT ExportCloudsDialog : public QDialog
55 {
56  Q_OBJECT
57 
58 public:
59  ExportCloudsDialog(QWidget *parent = 0);
60 
61  virtual ~ExportCloudsDialog();
62 
63  void saveSettings(QSettings & settings, const QString & group = "") const;
64  void loadSettings(QSettings & settings, const QString & group = "");
65 
66  void setDBDriver(const DBDriver * dbDriver) {_dbDriver = dbDriver;}
67  void forceAssembling(bool enabled);
68  void setProgressDialogToMax();
69  void setSaveButton();
70  void setOkButton();
71 
72  void exportClouds(
73  const std::map<int, Transform> & poses,
74  const std::multimap<int, Link> & links,
75  const std::map<int, int> & mapIds,
76  const QMap<int, Signature> & cachedSignatures,
77  const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
78  const std::map<int, LaserScan> & cachedScans,
79  const QString & workingDirectory,
80  const ParametersMap & parameters);
81 
82  void viewClouds(
83  const std::map<int, Transform> & poses,
84  const std::multimap<int, Link> & links,
85  const std::map<int, int> & mapIds,
86  const QMap<int, Signature> & cachedSignatures,
87  const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
88  const std::map<int, LaserScan> & cachedScans,
89  const QString & workingDirectory,
90  const ParametersMap & parameters);
91 
92  bool getExportedClouds(
93  const std::map<int, Transform> & poses,
94  const std::multimap<int, Link> & links,
95  const std::map<int, int> & mapIds,
96  const QMap<int, Signature> & cachedSignatures,
97  const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
98  const std::map<int, LaserScan> & cachedScans,
99  const QString & workingDirectory,
100  const ParametersMap & parameters,
101  std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & clouds,
102  std::map<int, pcl::PolygonMesh::Ptr> & meshes,
103  std::map<int, pcl::TextureMesh::Ptr> & textureMeshes,
104  std::vector<std::map<int, pcl::PointXY> > & textureVertexToPixels);
105 
106  int getTextureSize() const;
107  int getMaxTextures() const;
108  bool isGainCompensation() const;
109  double getGainBeta() const;
110  bool isGainRGB() const;
111  bool isBlending() const;
112  int getBlendingDecimation() const;
113  int getTextureBrightnessConstrastRatioLow() const;
114  int getTextureBrightnessConstrastRatioHigh() const;
115  bool isExposeFusion() const;
116 
117  static bool removeDirRecursively(const QString & dirName);
118 
119 Q_SIGNALS:
120  void configChanged();
121 
122 public Q_SLOTS:
123  void restoreDefaults();
124 
125 private Q_SLOTS:
126  void loadSettings();
127  void saveSettings();
128  void updateReconstructionFlavor();
129  void selectDistortionModel();
130  void selectCamProjMask();
131  void updateMLSGrpVisibility();
132  void cancel();
133 
134 private:
135  std::map<int, Transform> filterNodes(const std::map<int, Transform> & poses);
136  std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > getClouds(
137  const std::map<int, Transform> & poses,
138  const QMap<int, Signature> & cachedSignatures,
139  const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
140  const std::map<int, LaserScan> & cachedScans,
141  const ParametersMap & parameters,
142  bool & has2dScans,
143  bool & scansHaveRGB) const;
144  void saveClouds(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & clouds, bool binaryMode = true, const std::vector<std::map<int, pcl::PointXY> > & pointToPixels = std::vector<std::map<int, pcl::PointXY> >());
145  void saveMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode = true);
146  void saveTextureMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, std::map<int, pcl::TextureMesh::Ptr> & textureMeshes, const QMap<int, Signature> & cachedSignatures, const std::vector<std::map<int, pcl::PointXY> > & textureVertexToPixels);
147 
148 private:
149  Ui_ExportCloudsDialog * _ui;
152  bool _canceled;
156 
157  bool saveOBJFile(const QString &path, pcl::TextureMesh::Ptr &mesh) const;
158  bool saveOBJFile(const QString &path, pcl::PolygonMesh &mesh) const;
159 
160 };
161 
162 }
163 
164 #endif /* EXPORTCLOUDSDIALOG_H_ */
rtabmap::ProgressDialog
Definition: ProgressDialog.h:43
rtabmap::ExportCloudsDialog
Definition: ExportCloudsDialog.h:54
rtabmap::ExportCloudsDialog::_compensator
GainCompensator * _compensator
Definition: ExportCloudsDialog.h:153
rtabmap::ExportCloudsDialog::_progressDialog
ProgressDialog * _progressDialog
Definition: ExportCloudsDialog.h:150
rtabmap::ParametersMap
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
Parameters.h
rtabmap::ExportCloudsDialog::_scansHaveRGB
bool _scansHaveRGB
Definition: ExportCloudsDialog.h:155
rtabmap::GainCompensator
Definition: GainCompensator.h:44
Signature.h
rtabmap::ExportCloudsDialog::_ui
Ui_ExportCloudsDialog * _ui
Definition: ExportCloudsDialog.h:149
rtabmap::ExportCloudsDialog::setDBDriver
void setDBDriver(const DBDriver *dbDriver)
Definition: ExportCloudsDialog.h:66
rtabmap::ExportCloudsDialog::_dbDriver
const DBDriver * _dbDriver
Definition: ExportCloudsDialog.h:154
rtabmap::DBDriver
Definition: DBDriver.h:62
rtabmap::ExportCloudsDialog::_canceled
bool _canceled
Definition: ExportCloudsDialog.h:152
rtabmap::ExportCloudsDialog::_workingDirectory
QString _workingDirectory
Definition: ExportCloudsDialog.h:151
rtabmap
Definition: CameraARCore.cpp:35


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:09