mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-08 12:30:20 +08:00
fixed DatabaseViewer Export's options
This commit is contained in:
@@ -144,6 +144,7 @@ public:
|
||||
float getCx() const {return _cx;}
|
||||
float getCy() const {return _cy;}
|
||||
const Transform & getPose() const {return _pose;}
|
||||
void getPoseVariance(float & rotVariance, float & transVariance) const;
|
||||
const Transform & getLocalTransform() const {return _localTransform;}
|
||||
void setDepthRaw(const cv::Mat & depth) {_depthRaw = depth;}
|
||||
const cv::Mat & getDepthRaw() const {return _depthRaw;}
|
||||
|
||||
@@ -67,7 +67,8 @@ SensorData::SensorData(const cv::Mat & image,
|
||||
_laserScanMaxPts(0),
|
||||
_userData(userData)
|
||||
{
|
||||
UASSERT(image.type() == CV_8UC1 || // Mono
|
||||
UASSERT(image.empty() ||
|
||||
image.type() == CV_8UC1 || // Mono
|
||||
image.type() == CV_8UC3); // RGB
|
||||
}
|
||||
|
||||
@@ -100,7 +101,8 @@ SensorData::SensorData(const cv::Mat & image,
|
||||
_laserScanMaxPts(0),
|
||||
_userData(userData)
|
||||
{
|
||||
UASSERT(image.type() == CV_8UC1 || // Mono
|
||||
UASSERT(image.empty() ||
|
||||
image.type() == CV_8UC1 || // Mono
|
||||
image.type() == CV_8UC3); // RGB
|
||||
UASSERT(depthOrRightImage.empty() ||
|
||||
depthOrRightImage.type() == CV_32FC1 || // Depth in meter
|
||||
@@ -143,12 +145,13 @@ SensorData::SensorData(const cv::Mat & laserScan,
|
||||
_userData(userData)
|
||||
{
|
||||
UASSERT(_laserScan.empty() || _laserScan.type() == CV_32FC2);
|
||||
UASSERT(image.type() == CV_8UC1 || // Mono
|
||||
UASSERT(image.empty() ||
|
||||
image.type() == CV_8UC1 || // Mono
|
||||
image.type() == CV_8UC3); // RGB
|
||||
UASSERT(depthOrRightImage.type() == CV_32FC1 || // Depth in meter
|
||||
UASSERT(depthOrRightImage.empty() ||
|
||||
depthOrRightImage.type() == CV_32FC1 || // Depth in meter
|
||||
depthOrRightImage.type() == CV_16UC1 || // Depth in millimetre
|
||||
depthOrRightImage.type() == CV_8U); // Right stereo image
|
||||
UASSERT(!depthOrRightImage.empty());
|
||||
UASSERT(!_localTransform.isNull());
|
||||
UASSERT_MSG(uIsFinite(_poseRotVariance) && _poseRotVariance>0 && uIsFinite(_poseTransVariance) && _poseTransVariance>0, "Rotational and transitional variances should not be null! (set to 1 if unknown)");
|
||||
}
|
||||
|
||||
@@ -254,14 +254,13 @@ float Signature::getDepthFy() const {return getFy();}
|
||||
float Signature::getDepthCx() const {return getCx();}
|
||||
float Signature::getDepthCy() const {return getCy();}
|
||||
|
||||
SensorData Signature::toSensorData()
|
||||
void Signature::getPoseVariance(float & rotVariance, float & transVariance) const
|
||||
{
|
||||
this->uncompressData();
|
||||
float rotVariance = 1.0f;
|
||||
float transVariance = 1.0f;
|
||||
rotVariance = 1.0f;
|
||||
transVariance = 1.0f;
|
||||
if(_links.size())
|
||||
{
|
||||
for(std::map<int, Link>::iterator iter = _links.begin(); iter!=_links.end(); ++iter)
|
||||
for(std::map<int, Link>::const_iterator iter = _links.begin(); iter!=_links.end(); ++iter)
|
||||
{
|
||||
if(iter->second.kNeighbor)
|
||||
{
|
||||
@@ -275,6 +274,15 @@ SensorData Signature::toSensorData()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SensorData Signature::toSensorData()
|
||||
{
|
||||
this->uncompressData();
|
||||
float rotVariance = 1.0f;
|
||||
float transVariance = 1.0f;
|
||||
this->getPoseVariance(rotVariance, transVariance);
|
||||
|
||||
return SensorData(_laserScanRaw,
|
||||
_laserScanMaxPts,
|
||||
_imageRaw,
|
||||
|
||||
@@ -723,11 +723,29 @@ void DatabaseViewer::exportDatabase()
|
||||
int id = ids.at(i);
|
||||
|
||||
Signature data = memory_->getSignatureData(id, true);
|
||||
rtabmap::SensorData sensorData = data.toSensorData();
|
||||
if(!dialog.isUserDataExported())
|
||||
float rotVariance = 1.0f;
|
||||
float transVariance = 1.0f;
|
||||
if(dialog.isOdomExported())
|
||||
{
|
||||
sensorData.setUserData(std::vector<unsigned char>());
|
||||
data.getPoseVariance(rotVariance, transVariance);
|
||||
}
|
||||
rtabmap::SensorData sensorData(
|
||||
dialog.isDepth2dExported()?data.getLaserScanRaw():cv::Mat(),
|
||||
dialog.isDepth2dExported()?data.getLaserScanMaxPts():0,
|
||||
dialog.isRgbExported()?data.getImageRaw():cv::Mat(),
|
||||
dialog.isDepthExported()?data.getDepthRaw():cv::Mat(),
|
||||
dialog.isRgbExported() || dialog.isDepthExported()?data.getFx():0,
|
||||
dialog.isRgbExported() || dialog.isDepthExported()?data.getFy():0,
|
||||
dialog.isRgbExported() || dialog.isDepthExported()?data.getCx():0,
|
||||
dialog.isRgbExported() || dialog.isDepthExported()?data.getCy():0,
|
||||
dialog.isRgbExported() || dialog.isDepthExported()?data.getLocalTransform():Transform::getIdentity(),
|
||||
dialog.isOdomExported()?data.getPose():Transform(),
|
||||
rotVariance,
|
||||
transVariance,
|
||||
data.id(),
|
||||
data.getStamp(),
|
||||
dialog.isUserDataExported()?data.getUserData():std::vector<unsigned char>());
|
||||
|
||||
recorder.addData(sensorData);
|
||||
|
||||
progressDialog->appendText(tr("Exported node %1").arg(id));
|
||||
|
||||
Reference in New Issue
Block a user