fixed DatabaseViewer Export's options

This commit is contained in:
Mathieu Labbe
2015-05-06 13:05:32 -04:00
parent 0d73a20c82
commit 1f8fc91f46
4 changed files with 43 additions and 13 deletions
+1
View File
@@ -144,6 +144,7 @@ public:
float getCx() const {return _cx;} float getCx() const {return _cx;}
float getCy() const {return _cy;} float getCy() const {return _cy;}
const Transform & getPose() const {return _pose;} const Transform & getPose() const {return _pose;}
void getPoseVariance(float & rotVariance, float & transVariance) const;
const Transform & getLocalTransform() const {return _localTransform;} const Transform & getLocalTransform() const {return _localTransform;}
void setDepthRaw(const cv::Mat & depth) {_depthRaw = depth;} void setDepthRaw(const cv::Mat & depth) {_depthRaw = depth;}
const cv::Mat & getDepthRaw() const {return _depthRaw;} const cv::Mat & getDepthRaw() const {return _depthRaw;}
+8 -5
View File
@@ -67,7 +67,8 @@ SensorData::SensorData(const cv::Mat & image,
_laserScanMaxPts(0), _laserScanMaxPts(0),
_userData(userData) _userData(userData)
{ {
UASSERT(image.type() == CV_8UC1 || // Mono UASSERT(image.empty() ||
image.type() == CV_8UC1 || // Mono
image.type() == CV_8UC3); // RGB image.type() == CV_8UC3); // RGB
} }
@@ -100,7 +101,8 @@ SensorData::SensorData(const cv::Mat & image,
_laserScanMaxPts(0), _laserScanMaxPts(0),
_userData(userData) _userData(userData)
{ {
UASSERT(image.type() == CV_8UC1 || // Mono UASSERT(image.empty() ||
image.type() == CV_8UC1 || // Mono
image.type() == CV_8UC3); // RGB image.type() == CV_8UC3); // RGB
UASSERT(depthOrRightImage.empty() || UASSERT(depthOrRightImage.empty() ||
depthOrRightImage.type() == CV_32FC1 || // Depth in meter depthOrRightImage.type() == CV_32FC1 || // Depth in meter
@@ -143,12 +145,13 @@ SensorData::SensorData(const cv::Mat & laserScan,
_userData(userData) _userData(userData)
{ {
UASSERT(_laserScan.empty() || _laserScan.type() == CV_32FC2); 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 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_16UC1 || // Depth in millimetre
depthOrRightImage.type() == CV_8U); // Right stereo image depthOrRightImage.type() == CV_8U); // Right stereo image
UASSERT(!depthOrRightImage.empty());
UASSERT(!_localTransform.isNull()); 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)"); UASSERT_MSG(uIsFinite(_poseRotVariance) && _poseRotVariance>0 && uIsFinite(_poseTransVariance) && _poseTransVariance>0, "Rotational and transitional variances should not be null! (set to 1 if unknown)");
} }
+13 -5
View File
@@ -254,14 +254,13 @@ float Signature::getDepthFy() const {return getFy();}
float Signature::getDepthCx() const {return getCx();} float Signature::getDepthCx() const {return getCx();}
float Signature::getDepthCy() const {return getCy();} float Signature::getDepthCy() const {return getCy();}
SensorData Signature::toSensorData() void Signature::getPoseVariance(float & rotVariance, float & transVariance) const
{ {
this->uncompressData(); rotVariance = 1.0f;
float rotVariance = 1.0f; transVariance = 1.0f;
float transVariance = 1.0f;
if(_links.size()) 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) 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, return SensorData(_laserScanRaw,
_laserScanMaxPts, _laserScanMaxPts,
_imageRaw, _imageRaw,
+21 -3
View File
@@ -723,11 +723,29 @@ void DatabaseViewer::exportDatabase()
int id = ids.at(i); int id = ids.at(i);
Signature data = memory_->getSignatureData(id, true); Signature data = memory_->getSignatureData(id, true);
rtabmap::SensorData sensorData = data.toSensorData(); float rotVariance = 1.0f;
if(!dialog.isUserDataExported()) 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); recorder.addData(sensorData);
progressDialog->appendText(tr("Exported node %1").arg(id)); progressDialog->appendText(tr("Exported node %1").arg(id));