• 大小: 70.48MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2022-09-09
  • 语言: 其他
  • 标签: jar  

资源简介

For the VINS mobile of the slam , I just push up to csdn to backup

资源截图

代码片段和文件信息

/**
 * File: BowVector.cpp
 * Date: March 2011
 * Author: Dorian Galvez-Lopez
 * Description: bag of words vector
 * License: see the LICENSE.txt file
 *
 */

#include 
#include 
#include 
#include 
#include 

#include “BowVector.h“

namespace DBoW2 {

// --------------------------------------------------------------------------

BowVector::BowVector(void)
{
}

// --------------------------------------------------------------------------

BowVector::~BowVector(void)
{
}

// --------------------------------------------------------------------------

void BowVector::addWeight(WordId id WordValue v)
{
  BowVector::iterator vit = this->lower_bound(id);
  
  if(vit != this->end() && !(this->key_comp()(id vit->first)))
  {
    vit->second += v;
  }
  else
  {
    this->insert(vit BowVector::value_type(id v));
  }
}

// --------------------------------------------------------------------------

void BowVector::addIfNotExist(WordId id WordValue v)
{
  BowVector::iterator vit = this->lower_bound(id);
  
  if(vit == this->end() || (this->key_comp()(id vit->first)))
  {
    this->insert(vit BowVector::value_type(id v));
  }
}

// --------------------------------------------------------------------------

void BowVector::normalize(LNorm norm_type)
{
  double norm = 0.0; 
  BowVector::iterator it;

  if(norm_type == DBoW2::L1)
  {
    for(it = begin(); it != end(); ++it)
      norm += fabs(it->second);
  }
  else
  {
    for(it = begin(); it != end(); ++it)
      norm += it->second * it->second;
norm = sqrt(norm);  
  }

  if(norm > 0.0)
  {
    for(it = begin(); it != end(); ++it)
      it->second /= norm;
  }
}

// --------------------------------------------------------------------------

std::ostream& operator<< (std::ostream &out const BowVector &v)
{
  BowVector::const_iterator vit;
  std::vector::const_iterator iit;
  unsigned int i = 0; 
  const unsigned int N = v.size();
  for(vit = v.begin(); vit != v.end(); ++vit ++i)
  {
    out << “<“ << vit->first << “ “ << vit->second << “>“;
    
    if(i < N-1) out << “ “;
  }
  return out;
}

// --------------------------------------------------------------------------

void BowVector::saveM(const std::string &filename size_t W) const
{
  std::fstream f(filename.c_str() std::ios::out);
  
  WordId last = 0;
  BowVector::const_iterator bit;
  for(bit = this->begin(); bit != this->end(); ++bit)
  {
    for(; last < bit->first; ++last)
    {
      f << “0 “;
    }
    f << bit->second << “ “;
    
    last = bit->first + 1;
  }
  for(; last < (WordId)W; ++last)
    f << “0 “;
  
  f.close();
}

// --------------------------------------------------------------------------

} // namespace DBoW2


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-26 04:19  VINS-Mobile-master\
     文件         454  2017-12-26 04:19  VINS-Mobile-master\.gitignore
     文件       35140  2017-12-26 04:19  VINS-Mobile-master\LICENSE
     文件        4024  2017-12-26 04:19  VINS-Mobile-master\README.md
     目录           0  2017-12-26 04:19  VINS-Mobile-master\Resources\
     文件    81074608  2017-12-26 04:19  VINS-Mobile-master\Resources\boost.a
     文件    60030120  2017-12-26 04:19  VINS-Mobile-master\Resources\brief_k10L6.bin
     文件        6977  2017-12-26 04:19  VINS-Mobile-master\Resources\brief_pattern.yml
     文件     2123528  2017-12-26 04:19  VINS-Mobile-master\Resources\libjpeg.a
     目录           0  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\
     目录           0  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\
     文件        2752  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\BowVector.cpp
     文件        1885  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\BowVector.h
     文件        2230  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\DBoW2.h
     文件        2382  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\FBrief.cpp
     文件        1597  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\FBrief.h
     文件        1642  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\FClass.h
     文件        1831  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\FeatureVector.cpp
     文件        1080  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\FeatureVector.h
     文件        1384  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\QueryResults.cpp
     文件        4142  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\QueryResults.h
     文件        7890  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\Scoringobject.cpp
     文件        2449  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\Scoringobject.h
     文件       37670  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\TemplatedDatabase.h
     文件       41407  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DBoW\TemplatedVocabulary.h
     目录           0  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\
     文件        1079  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\DException.h
     文件        1056  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\DUtils.h
     文件        2886  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\Random.cpp
     文件        3690  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\Random.h
     文件        5117  2017-12-26 04:19  VINS-Mobile-master\ThirdParty\DUtils\Timestamp.cpp
............此处省略1215个文件信息

评论

共有 条评论