mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
GUI/ExportClouds: fixed color of scans having RGB instead of intensity.
This commit is contained in:
@@ -138,7 +138,8 @@ private:
|
|||||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||||
const std::map<int, LaserScan> & cachedScans,
|
const std::map<int, LaserScan> & cachedScans,
|
||||||
const ParametersMap & parameters,
|
const ParametersMap & parameters,
|
||||||
bool & has2dScans) const;
|
bool & has2dScans,
|
||||||
|
bool & scansHaveRGB) const;
|
||||||
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> >());
|
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> >());
|
||||||
void saveMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode = true);
|
void saveMeshes(const QString & workingDirectory, const std::map<int, Transform> & poses, const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode = true);
|
||||||
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);
|
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);
|
||||||
@@ -150,6 +151,7 @@ private:
|
|||||||
bool _canceled;
|
bool _canceled;
|
||||||
GainCompensator * _compensator;
|
GainCompensator * _compensator;
|
||||||
const DBDriver * _dbDriver;
|
const DBDriver * _dbDriver;
|
||||||
|
bool _scansHaveRGB;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ ExportCloudsDialog::ExportCloudsDialog(QWidget *parent) :
|
|||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
_canceled(false),
|
_canceled(false),
|
||||||
_compensator(0),
|
_compensator(0),
|
||||||
_dbDriver(0)
|
_dbDriver(0),
|
||||||
|
_scansHaveRGB(false)
|
||||||
{
|
{
|
||||||
_ui = new Ui_ExportCloudsDialog();
|
_ui = new Ui_ExportCloudsDialog();
|
||||||
_ui->setupUi(this);
|
_ui->setupUi(this);
|
||||||
@@ -1323,7 +1324,7 @@ void ExportCloudsDialog::viewClouds(
|
|||||||
for(unsigned int j=0; j<vertices.vertices.size(); ++j)
|
for(unsigned int j=0; j<vertices.vertices.size(); ++j)
|
||||||
{
|
{
|
||||||
UASSERT(oi < cloud->size());
|
UASSERT(oi < cloud->size());
|
||||||
UASSERT_MSG(vertices.vertices[j] < (int)originalCloud->size(), uFormat("%d vs %d", vertices.vertices[j], (int)originalCloud->size()).c_str());
|
UASSERT_MSG((int)vertices.vertices[j] < (int)originalCloud->size(), uFormat("%d vs %d", vertices.vertices[j], (int)originalCloud->size()).c_str());
|
||||||
cloud->at(oi) = originalCloud->at(vertices.vertices[j]);
|
cloud->at(oi) = originalCloud->at(vertices.vertices[j]);
|
||||||
vertices.vertices[j] = oi; // new vertice index
|
vertices.vertices[j] = oi; // new vertice index
|
||||||
++oi;
|
++oi;
|
||||||
@@ -1413,7 +1414,7 @@ void ExportCloudsDialog::viewClouds(
|
|||||||
_progressDialog->appendText(tr("Viewing the cloud %1 (%2 points)...").arg(iter->first).arg(iter->second->size()));
|
_progressDialog->appendText(tr("Viewing the cloud %1 (%2 points)...").arg(iter->first).arg(iter->second->size()));
|
||||||
_progressDialog->incrementStep();
|
_progressDialog->incrementStep();
|
||||||
|
|
||||||
if(!_ui->checkBox_fromDepth->isChecked() &&
|
if(!_ui->checkBox_fromDepth->isChecked() && !_scansHaveRGB &&
|
||||||
!(_ui->checkBox_cameraProjection->isEnabled() &&
|
!(_ui->checkBox_cameraProjection->isEnabled() &&
|
||||||
_ui->checkBox_cameraProjection->isChecked() &&
|
_ui->checkBox_cameraProjection->isChecked() &&
|
||||||
_ui->checkBox_camProjRecolorPoints->isChecked() &&
|
_ui->checkBox_camProjRecolorPoints->isChecked() &&
|
||||||
@@ -1641,7 +1642,8 @@ bool ExportCloudsDialog::getExportedClouds(
|
|||||||
cachedClouds,
|
cachedClouds,
|
||||||
cachedScans,
|
cachedScans,
|
||||||
parameters,
|
parameters,
|
||||||
has2dScans);
|
has2dScans,
|
||||||
|
_scansHaveRGB);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2574,7 +2576,7 @@ bool ExportCloudsDialog::getExportedClouds(
|
|||||||
{
|
{
|
||||||
TexturingState texturingState(_progressDialog, false);
|
TexturingState texturingState(_progressDialog, false);
|
||||||
|
|
||||||
if(!_ui->checkBox_fromDepth->isChecked())
|
if(!_ui->checkBox_fromDepth->isChecked() && !_scansHaveRGB)
|
||||||
{
|
{
|
||||||
// When laser scans are exported, convert Intensity to GrayScale
|
// When laser scans are exported, convert Intensity to GrayScale
|
||||||
int maxIntensity = 1;
|
int maxIntensity = 1;
|
||||||
@@ -2812,7 +2814,7 @@ bool ExportCloudsDialog::getExportedClouds(
|
|||||||
pcl::PointXYZRGBNormal & pt = assembledCloud->at(i);
|
pcl::PointXYZRGBNormal & pt = assembledCloud->at(i);
|
||||||
if(pointToPixel[i].first.first <=0)
|
if(pointToPixel[i].first.first <=0)
|
||||||
{
|
{
|
||||||
if(_ui->checkBox_camProjRecolorPoints->isChecked() && !_ui->checkBox_fromDepth->isChecked())
|
if(_ui->checkBox_camProjRecolorPoints->isChecked() && !_ui->checkBox_fromDepth->isChecked() && !_scansHaveRGB)
|
||||||
{
|
{
|
||||||
pt.r = 255;
|
pt.r = 255;
|
||||||
pt.g = 0;
|
pt.g = 0;
|
||||||
@@ -3270,7 +3272,7 @@ bool ExportCloudsDialog::getExportedClouds(
|
|||||||
for(int k=0; k<polygonSize; ++k)
|
for(int k=0; k<polygonSize; ++k)
|
||||||
{
|
{
|
||||||
//uv
|
//uv
|
||||||
UASSERT(vertices.vertices[k] < (int)oter->second.size());
|
UASSERT((int)vertices.vertices[k] < (int)oter->second.size());
|
||||||
int originalVertex = oter->second[vertices.vertices[k]];
|
int originalVertex = oter->second[vertices.vertices[k]];
|
||||||
textureMesh->tex_coordinates[0][i*polygonSize+k] = Eigen::Vector2f(
|
textureMesh->tex_coordinates[0][i*polygonSize+k] = Eigen::Vector2f(
|
||||||
float(originalVertex % w) / float(w), // u
|
float(originalVertex % w) / float(w), // u
|
||||||
@@ -3455,8 +3457,10 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
|
|||||||
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
const std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGB>::Ptr, pcl::IndicesPtr> > & cachedClouds,
|
||||||
const std::map<int, LaserScan> & cachedScans,
|
const std::map<int, LaserScan> & cachedScans,
|
||||||
const ParametersMap & parameters,
|
const ParametersMap & parameters,
|
||||||
bool & has2dScans) const
|
bool & has2dScans,
|
||||||
|
bool & scansHaveRGB) const
|
||||||
{
|
{
|
||||||
|
scansHaveRGB = false;
|
||||||
has2dScans = false;
|
has2dScans = false;
|
||||||
std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > clouds;
|
std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::IndicesPtr> > clouds;
|
||||||
int index=1;
|
int index=1;
|
||||||
@@ -3628,6 +3632,10 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
|
|||||||
_ui->spinBox_normalKSearch->value(),
|
_ui->spinBox_normalKSearch->value(),
|
||||||
_ui->doubleSpinBox_normalRadiusSearch->value());
|
_ui->doubleSpinBox_normalRadiusSearch->value());
|
||||||
|
|
||||||
|
if(!scan.empty())
|
||||||
|
{
|
||||||
|
scansHaveRGB = scan.hasRGB();
|
||||||
|
}
|
||||||
localTransform = scan.localTransform();
|
localTransform = scan.localTransform();
|
||||||
cloud = util3d::laserScanToPointCloudRGBNormal(scan, localTransform); // put in base frame by default
|
cloud = util3d::laserScanToPointCloudRGBNormal(scan, localTransform); // put in base frame by default
|
||||||
indices->resize(cloud->size());
|
indices->resize(cloud->size());
|
||||||
@@ -3732,6 +3740,10 @@ std::map<int, std::pair<pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr, pcl::Indic
|
|||||||
_ui->spinBox_normalKSearch->value(),
|
_ui->spinBox_normalKSearch->value(),
|
||||||
_ui->doubleSpinBox_normalRadiusSearch->value());
|
_ui->doubleSpinBox_normalRadiusSearch->value());
|
||||||
|
|
||||||
|
if(!scan.empty())
|
||||||
|
{
|
||||||
|
scansHaveRGB = scan.hasRGB();
|
||||||
|
}
|
||||||
localTransform = scan.localTransform();
|
localTransform = scan.localTransform();
|
||||||
cloud = util3d::laserScanToPointCloudRGBNormal(scan, localTransform); // put in base frame by default
|
cloud = util3d::laserScanToPointCloudRGBNormal(scan, localTransform); // put in base frame by default
|
||||||
indices->resize(cloud->size());
|
indices->resize(cloud->size());
|
||||||
@@ -3896,7 +3908,7 @@ void ExportCloudsDialog::saveClouds(
|
|||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudRGBWithoutNormals;
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudRGBWithoutNormals;
|
||||||
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIWithoutNormals;
|
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIWithoutNormals;
|
||||||
pcl::PointCloud<pcl::PointXYZINormal>::Ptr cloudIWithNormals;
|
pcl::PointCloud<pcl::PointXYZINormal>::Ptr cloudIWithNormals;
|
||||||
if(!_ui->checkBox_fromDepth->isChecked() &&
|
if(!_ui->checkBox_fromDepth->isChecked() && !_scansHaveRGB &&
|
||||||
!(_ui->checkBox_cameraProjection->isEnabled() &&
|
!(_ui->checkBox_cameraProjection->isEnabled() &&
|
||||||
_ui->checkBox_cameraProjection->isChecked() &&
|
_ui->checkBox_cameraProjection->isChecked() &&
|
||||||
_ui->checkBox_camProjRecolorPoints->isChecked() &&
|
_ui->checkBox_camProjRecolorPoints->isChecked() &&
|
||||||
@@ -4087,7 +4099,7 @@ void ExportCloudsDialog::saveClouds(
|
|||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudRGBWithoutNormals;
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudRGBWithoutNormals;
|
||||||
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIWithoutNormals;
|
pcl::PointCloud<pcl::PointXYZI>::Ptr cloudIWithoutNormals;
|
||||||
pcl::PointCloud<pcl::PointXYZINormal>::Ptr cloudIWithNormals;
|
pcl::PointCloud<pcl::PointXYZINormal>::Ptr cloudIWithNormals;
|
||||||
if(!_ui->checkBox_fromDepth->isChecked())
|
if(!_ui->checkBox_fromDepth->isChecked() && !_scansHaveRGB)
|
||||||
{
|
{
|
||||||
// When laser scans are exported, convert RGB to Intensity
|
// When laser scans are exported, convert RGB to Intensity
|
||||||
if(_ui->spinBox_normalKSearch->value()>0 || _ui->doubleSpinBox_normalRadiusSearch->value()>0.0)
|
if(_ui->spinBox_normalKSearch->value()>0 || _ui->doubleSpinBox_normalRadiusSearch->value()>0.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user