Parallelize cloud generation in export/view clouds dialog and rtabmap-export (#1757)

* Parallelize cloud generation in export/view clouds dialog and rtabmap-export

* Simplified NodeExportData by holding Signature directly. Added --threads option (default max cores) for CLI and UI.

* Parallelized texturing phase the same way than cloud generation

* Fixed not cancelable (right away) cloud generation in UI

---------

Co-authored-by: matlabbe <[email protected]>
This commit is contained in:
Torjus Iveland
2026-08-30 17:49:28 -07:00
committed by GitHub
co-authored by matlabbe
parent 9279ab68ca
commit 7eb26e1dc2
8 changed files with 901 additions and 515 deletions
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QDialog>
#include <QMap>
#include <QColor>
#include <QtCore/QSettings>
#include <rtabmap/core/Signature.h>
@@ -46,6 +47,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class Ui_ExportCloudsDialog;
class QAbstractButton;
namespace clams {
class DiscreteDepthDistortionModel;
}
namespace rtabmap {
class ProgressDialog;
class GainCompensator;
@@ -132,7 +137,30 @@ private Q_SLOTS:
void cancel();
private:
int numThreads() const; // resolves the "Auto" value of the threads spin box
std::map<int, Transform> filterNodes(const std::map<int, Transform> & poses);
struct CloudGenResult
{
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloud;
pcl::IndicesPtr indices;
bool hasScan = false;
bool scanHasRGB = false;
std::vector<std::pair<QString, QColor> > messages;
};
CloudGenResult generateCloudForNode(
int nodeId,
const Transform & pose,
int index,
int totalPoses,
const std::vector<float> & roiRatios,
const clams::DiscreteDepthDistortionModel * model,
const QMap<int, Signature> & cachedSignatures,
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
const std::map<int, LaserScan> & cachedScans,
const ParametersMap & parameters,
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr * previousCloud,
pcl::IndicesPtr * previousIndices,
Transform * previousPose) const;
std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > getClouds(
const std::map<int, Transform> & poses,
const QMap<int, Signature> & cachedSignatures,
File diff suppressed because it is too large Load Diff
+36 -10
View File
@@ -31,7 +31,7 @@
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QGridLayout" name="gridLayout_8" columnstretch="0,1">
<item row="17" column="0">
<item row="18" column="0">
<widget class="QCheckBox" name="checkBox_cameraProjection">
<property name="text">
<string/>
@@ -45,7 +45,7 @@
</property>
</widget>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QCheckBox" name="checkBox_filtering">
<property name="text">
<string/>
@@ -59,7 +59,7 @@
</property>
</widget>
</item>
<item row="18" column="1">
<item row="19" column="1">
<widget class="QLabel" name="label_binaryFile_12">
<property name="text">
<string>Meshing.</string>
@@ -69,7 +69,7 @@
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<widget class="QLabel" name="label_binaryFile_9">
<property name="text">
<string>Cloud filtering.</string>
@@ -89,14 +89,14 @@
</property>
</widget>
</item>
<item row="18" column="0">
<item row="19" column="0">
<widget class="QCheckBox" name="checkBox_meshing">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="17" column="1">
<widget class="QLabel" name="label_gainCompensation">
<property name="text">
<string>Gain compensation. Normalize brightness of images.</string>
@@ -208,7 +208,7 @@
</property>
</widget>
</item>
<item row="15" column="0">
<item row="16" column="0">
<widget class="QCheckBox" name="checkBox_smoothing">
<property name="text">
<string/>
@@ -229,7 +229,7 @@
</item>
</widget>
</item>
<item row="15" column="1">
<item row="16" column="1">
<widget class="QLabel" name="label_smoothing">
<property name="text">
<string>Cloud smoothing using Moving Least Squares algorithm (MLS).</string>
@@ -278,7 +278,7 @@
</item>
</widget>
</item>
<item row="17" column="1">
<item row="18" column="1">
<widget class="QLabel" name="label_cameraProjection">
<property name="text">
<string>Camera projection. This can be used to colorize point cloud created from scans and/or export camera IDs for each point of the cloud.</string>
@@ -329,7 +329,7 @@
</property>
</widget>
</item>
<item row="16" column="0">
<item row="17" column="0">
<widget class="QCheckBox" name="checkBox_gainCompensation">
<property name="text">
<string/>
@@ -403,6 +403,32 @@
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QSpinBox" name="spinBox_numThreads">
<property name="specialValueText">
<string>Auto</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>128</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="label_numThreads">
<property name="text">
<string>Number of threads used to generate the clouds and to texture the mesh (Auto=one per core, 1=process them one by one).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>