mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
functional bundler export (camera orientations are correct in MeshLab)
This commit is contained in:
@@ -4632,30 +4632,40 @@ void MainWindow::exportBundlerFormat()
|
|||||||
UERROR("Failed to save image %s", p.toStdString().c_str());
|
UERROR("Failed to save image %s", p.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transform localTransform;
|
||||||
if(_cachedSignatures[iter->first].sensorData().cameraModels().size())
|
if(_cachedSignatures[iter->first].sensorData().cameraModels().size())
|
||||||
{
|
{
|
||||||
out << _cachedSignatures[iter->first].sensorData().cameraModels().at(0).fx() << " 0 0\n";
|
out << _cachedSignatures[iter->first].sensorData().cameraModels().at(0).fx() << " 0 0\n";
|
||||||
|
localTransform = _cachedSignatures[iter->first].sensorData().cameraModels().at(0).localTransform();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out << _cachedSignatures[iter->first].sensorData().stereoCameraModel().left().fx() << " 0 0\n";
|
out << _cachedSignatures[iter->first].sensorData().stereoCameraModel().left().fx() << " 0 0\n";
|
||||||
|
localTransform = _cachedSignatures[iter->first].sensorData().stereoCameraModel().left().localTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
out << iter->second.r11() << " " << iter->second.r12() << " " << iter->second.r13() << "\n";
|
Transform rotation(0,-1,0,0,
|
||||||
out << iter->second.r21() << " " << iter->second.r22() << " " << iter->second.r23() << "\n";
|
0,0,1,0,
|
||||||
out << iter->second.r31() << " " << iter->second.r32() << " " << iter->second.r33() << "\n";
|
-1,0,0,0);
|
||||||
out << iter->second.x() << " " << iter->second.y() << " " << iter->second.z() << "\n";
|
|
||||||
|
|
||||||
//double t[3];
|
Transform R = rotation*iter->second.rotation().inverse();
|
||||||
//matrix_product(3, 3, 3, 1, cameras[idx].R, cameras[idx].t, t);
|
|
||||||
//matrix_scale(3, 1, t, -1.0, t);
|
out << R.r11() << " " << R.r12() << " " << R.r13() << "\n";
|
||||||
//fprintf(f, "%0.10e %0.10e %0.10e\n", t[0], t[1], t[2]);
|
out << R.r21() << " " << R.r22() << " " << R.r23() << "\n";
|
||||||
|
out << R.r31() << " " << R.r32() << " " << R.r33() << "\n";
|
||||||
|
|
||||||
|
Transform t = R * iter->second.translation();
|
||||||
|
t.x() *= -1.0f;
|
||||||
|
t.y() *= -1.0f;
|
||||||
|
t.z() *= -1.0f;
|
||||||
|
out << t.x() << " " << t.y() << " " << t.z() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::Button b = QMessageBox::question(this,
|
QMessageBox::Button b = QMessageBox::question(this,
|
||||||
tr("Exporting cameras in Bundler format..."),
|
tr("Exporting cameras in Bundler format..."),
|
||||||
tr("%1 cameras/images exported to directory \"%2\".\nDo you want to export the cloud/mesh (PLY)?").arg(poses.size()).arg(path));
|
tr("%1 cameras/images exported to directory \"%2\".\nDo you want to export the cloud/mesh (PLY)?").arg(poses.size()).arg(path),
|
||||||
if(b == QMessageBox::Ok)
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if(b == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
this->exportClouds();
|
this->exportClouds();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user