Rtabmap::getSignatureCopy() added withWords and withGlobalDescriptors options

This commit is contained in:
matlabbe
2020-06-22 22:56:25 -04:00
parent c19f81ac12
commit 274903dd63
4 changed files with 39 additions and 24 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
#######################
SET(RTABMAP_MAJOR_VERSION 0)
SET(RTABMAP_MINOR_VERSION 20)
SET(RTABMAP_PATCH_VERSION 1)
SET(RTABMAP_PATCH_VERSION 2)
SET(RTABMAP_VERSION
${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_VERSION})
+4 -2
View File
@@ -180,7 +180,7 @@ public:
void rejectLastLoopClosure();
void deleteLastLocation();
void setOptimizedPoses(const std::map<int, Transform> & poses);
Signature getSignatureCopy(int id, bool images, bool scan, bool userData, bool occupancyGrid) const;
Signature getSignatureCopy(int id, bool images, bool scan, bool userData, bool occupancyGrid, bool withWords, bool withGlobalDescriptors) const;
RTABMAP_DEPRECATED(
void get3DMap(std::map<int, Signature> & signatures,
std::map<int, Transform> & poses,
@@ -195,7 +195,9 @@ public:
bool withImages = false,
bool withScan = false,
bool withUserData = false,
bool withGrid = false) const;
bool withGrid = false,
bool withWords = true,
bool withGlobalDescriptors = true) const;
int detectMoreLoopClosures(
float clusterRadius = 0.5f,
float clusterAngle = M_PI/6.0f,
+33 -20
View File
@@ -4389,7 +4389,7 @@ void Rtabmap::dumpPrediction() const
}
}
Signature Rtabmap::getSignatureCopy(int id, bool images, bool scan, bool userData, bool occupancyGrid) const
Signature Rtabmap::getSignatureCopy(int id, bool images, bool scan, bool userData, bool occupancyGrid, bool withWords, bool withGlobalDescriptors) const
{
Signature s;
if(_memory)
@@ -4410,7 +4410,7 @@ Signature Rtabmap::getSignatureCopy(int id, bool images, bool scan, bool userDat
{
data = _memory->getNodeData(id, images, scan, userData, occupancyGrid);
}
if(!images)
if(!images && withWords)
{
std::vector<CameraModel> models;
StereoCameraModel stereoModel;
@@ -4418,23 +4418,34 @@ Signature Rtabmap::getSignatureCopy(int id, bool images, bool scan, bool userDat
data.setCameraModels(models);
data.setStereoCameraModel(stereoModel);
}
std::multimap<int, cv::KeyPoint> words;
std::multimap<int, cv::Point3f> words3;
std::multimap<int, cv::Mat> wordsDescriptors;
std::vector<rtabmap::GlobalDescriptor> globalDescriptors;
_memory->getNodeWordsAndGlobalDescriptors(id, words, words3, wordsDescriptors, globalDescriptors);
s=Signature(id,
mapId,
weight,
stamp,
label,
odomPoseLocal,
groundTruth,
data);
s.setWords(words);
s.setWords3(words3);
s.setWordsDescriptors(wordsDescriptors);
s.sensorData().setGlobalDescriptors(globalDescriptors);
mapId,
weight,
stamp,
label,
odomPoseLocal,
groundTruth,
data);
if(withWords || withGlobalDescriptors)
{
std::multimap<int, cv::KeyPoint> words;
std::multimap<int, cv::Point3f> words3;
std::multimap<int, cv::Mat> wordsDescriptors;
std::vector<rtabmap::GlobalDescriptor> globalDescriptors;
_memory->getNodeWordsAndGlobalDescriptors(id, words, words3, wordsDescriptors, globalDescriptors);
if(withWords)
{
s.setWords(words);
s.setWords3(words3);
s.setWordsDescriptors(wordsDescriptors);
}
if(withGlobalDescriptors)
{
s.sensorData().setGlobalDescriptors(globalDescriptors);
}
}
if(velocity.size()==6)
{
s.setVelocity(velocity[0], velocity[1], velocity[2], velocity[3], velocity[4], velocity[5]);
@@ -4465,7 +4476,9 @@ void Rtabmap::getGraph(
bool withImages,
bool withScan,
bool withUserData,
bool withGrid) const
bool withGrid,
bool withWords,
bool withGlobalDescriptors) const
{
if(_memory && _memory->getLastWorkingSignature())
{
@@ -4506,7 +4519,7 @@ void Rtabmap::getGraph(
for(std::set<int>::iterator iter = ids.begin(); iter!=ids.end(); ++iter)
{
signatures->insert(std::make_pair(*iter, getSignatureCopy(*iter, withImages, withScan, withUserData, withGrid)));
signatures->insert(std::make_pair(*iter, getSignatureCopy(*iter, withImages, withScan, withUserData, withGrid, withWords, withGlobalDescriptors)));
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>rtabmap</name>
<version>0.20.1</version>
<version>0.20.2</version>
<description>RTAB-Map's standalone library. RTAB-Map is a RGB-D SLAM approach with real-time constraints.</description>
<maintainer email="matlabbe@gmail.com">Mathieu Labbe</maintainer>
<author>Mathieu Labbe</author>