32 #include <opencv2/highgui/highgui.hpp> 57 const std::string & label,
107 for(std::list<Link>::const_iterator iter = links.begin(); iter!=links.end(); ++iter)
114 for(std::map<int, Link>::const_iterator iter = links.begin(); iter!=links.end(); ++iter)
124 std::pair<std::map<int, Link>::iterator,
bool> pair =
_links.insert(std::make_pair(link.
to(), link));
125 UASSERT_MSG(pair.second,
uFormat(
"Link %d (type=%d) already added to signature %d!", link.
to(), link.
type(), this->
id()).c_str());
136 std::map<int, Link>::iterator iter =
_links.find(idFrom);
139 Link link = iter->second;
142 _links.insert(std::make_pair(idTo, link));
144 UDEBUG(
"(%d) neighbor ids changed from %d to %d",
_id, idFrom, idTo);
157 int count = (int)
_links.erase(idTo);
160 UDEBUG(
"Removed link %d from %d", idTo, this->
id());
167 for(std::map<int, Link>::iterator iter=
_links.begin(); iter!=
_links.end();)
182 float similarity = 0.0f;
183 const std::multimap<int, cv::KeyPoint> & words = s.
getWords();
187 std::list<std::pair<int, std::pair<cv::KeyPoint, cv::KeyPoint> > > pairs;
192 similarity = float(pairs.size()) /
float(totalWords);
215 _wordsChanged.insert(std::make_pair(oldWordId, activeWordId));
216 for(std::list<cv::KeyPoint>::const_iterator iter=kps.begin(); iter!=kps.end(); ++iter)
218 _words.insert(std::pair<int, cv::KeyPoint>(activeWordId, (*iter)));
220 for(std::list<cv::Point3f>::const_iterator iter=pts.begin(); iter!=pts.end(); ++iter)
222 _words3.insert(std::pair<int, cv::Point3f>(activeWordId, (*iter)));
224 for(std::list<cv::Mat>::const_iterator iter=descriptors.begin(); iter!=descriptors.end(); ++iter)
236 for(std::multimap<int, cv::KeyPoint>::iterator iter=
_words.begin(); iter!=
_words.end(); ++iter)
276 cv::Mat covariance = cv::Mat::eye(6,6,CV_64FC1);
279 for(std::map<int, Link>::const_iterator iter =
_links.begin(); iter!=
_links.end(); ++iter)
281 if(iter->second.kNeighbor)
284 if(iter->second.to() < iter->second.from())
286 covariance = iter->second.infMatrix().inv();
297 long total =
_words.size() *
sizeof(float) * 8 +
298 _words3.size() *
sizeof(float) * 4;
void changeWordsRef(int oldWordId, int activeWordId)
static int findPairs(const std::map< int, cv::KeyPoint > &wordsA, const std::map< int, cv::KeyPoint > &wordsB, std::list< std::pair< int, std::pair< cv::KeyPoint, cv::KeyPoint > > > &pairs, bool ignoreNegativeIds=true)
const std::multimap< int, cv::KeyPoint > & getWords() const
void setWords(const std::multimap< int, cv::KeyPoint > &words)
int getInvalidWordsCount() const
double transVariance() const
void removeVirtualLinks()
double rotVariance() const
std::multimap< int, cv::KeyPoint > _words
#define UASSERT(condition)
std::multimap< int, cv::Mat > _wordsDescriptors
Transform _groundTruthPose
bool hasLink(int idTo) const
#define UASSERT_MSG(condition, msg_str)
std::multimap< int, cv::Point3f > _words3
long getMemoryUsed() const
float compareTo(const Signature &signature) const
long getMemoryUsed(bool withSensorData=true) const
void addLinks(const std::list< Link > &links)
std::vector< V > uValues(const std::multimap< K, V > &mm)
SensorData & sensorData()
std::map< int, Link > _links
void addLink(const Link &link)
void removeLink(int idTo)
bool isBadSignature() const
void removeWord(int wordId)
void changeLinkIds(int idFrom, int idTo)
std::string UTILITE_EXP uFormat(const char *fmt,...)
cv::Mat getPoseCovariance() const
std::map< int, int > _wordsChanged