mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
Added cvsba support for post-processing bundle adjustment (SBA)
This commit is contained in:
@@ -472,6 +472,7 @@ inline std::list<V> uVectorToList(const std::vector<V> & v)
|
||||
|
||||
/**
|
||||
* Convert a std::multimap to a std::map
|
||||
* @see uMultimapToMapUnique to keep only unique keys
|
||||
*/
|
||||
template<class K, class V>
|
||||
inline std::map<K, V> uMultimapToMap(const std::multimap<K, V> & m)
|
||||
@@ -479,6 +480,25 @@ inline std::map<K, V> uMultimapToMap(const std::multimap<K, V> & m)
|
||||
return std::map<K, V>(m.begin(), m.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a std::multimap to a std::map, keeping only unique keys!
|
||||
*/
|
||||
template<class K, class V>
|
||||
inline std::map<K, V> uMultimapToMapUnique(const std::multimap<K, V> & m)
|
||||
{
|
||||
std::map<K, V> mapOut;
|
||||
std::list<K> uniqueKeys = uUniqueKeys(m);
|
||||
for(typename std::list<K>::const_iterator iter = uniqueKeys.begin(); iter!=uniqueKeys.end(); ++iter)
|
||||
{
|
||||
if(m.count(*iter) == 1)
|
||||
{
|
||||
typename std::multimap<K, V>::const_iterator jter=m.find(*iter);
|
||||
mapOut.insert(std::pair<K,V>(jter->first, jter->second));
|
||||
}
|
||||
}
|
||||
return mapOut;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a list to another list.
|
||||
* @param list the list on which the other list will be appended
|
||||
|
||||
Reference in New Issue
Block a user