openMVG----features

这个模块提供特征和特征描述子的通用容器

特征

提供基本的结构和IO来存储`特征点。存储特征点的类:

  • PointFeature:存储特征的位置(x,y)
  • SIOPointFeature:存储特征的位置、方向和尺度(x,y,s,o)
描述子

提供基本的结构和IO来存储`特征描述子。

  • template <typename T, std::size_t N> class Descriptor:存储N个类型是T的值,连续内存
// SIFT like descriptor
using siftDescriptorData Descriptor<float, 128>;

// SURF like descriptor
using surfDescriptorData = Descriptor<float, 64>;

// Binary descriptor (128 bits)
using binaryDescriptor_bitset = Descriptor<std::bitset<128>,1> binaryDescriptor_bitset;
// or using unsigned chars
using binaryDescriptor_uchar = Descriptor<unsigned char, 128/sizeof(unsigned char)>;

特征点集

存储一系列特征及其描述子:

  • template<typename FeaturesT, typename DescriptorsT> class KeypointSet
// Define SIFT Keypoints:

// Define the SIFT descriptor [128 floating point value]
using Descriptor<float, 128> DescriptorT;

// Use SIFT compatible features (scale, orientation and position)
using FeatureT = SIOPointFeature;

// Describe what a collection of local feature is for a given image:
using FeatsT = std::vector<FeatureT>;
using DescsT = std::vector<DescriptorT>;

// Link features and their descriptors as a collection:
using KeypointSetT = KeypointSet<FeatsT, DescsT>;

//示例
  Feats_T vec_feats;
  for (int i = 0; i < CARD; ++i)
    vec_feats.push_back(Feature_T(i, i*2, i*3, i*4));
  //Save them to a file
  saveFeatsToFile("tempFeats.feat", vec_feats);
  Feats_T vec_feats_read;
  loadFeatsFromFile("tempFeats.feat", vec_feats_read);
  //vec_feats_read.size();
  //vec_feats[i].coords(), .scale(), .orientation()

// Create an input series of descriptor
  Descs_T vec_descs;
  for (int i = 0; i < CARD; ++i)
  {
    Desc_T desc;
    for (int j = 0; j < DESC_LENGTH; ++j)
      desc[j] = i*DESC_LENGTH+j;
    vec_descs.emplace_back(desc);
  }
  saveDescsToFile("tempDescs.desc", vec_descs);
  Descs_T vec_descs_read;
  loadDescsFromFile("tempDescs.desc", vec_descs_read);
  //vec_descs_read.size();
  //vec_descs[i][j]
  
  //保存为二进制文件
  saveDescsToBinFile("tempDescsBin.desc", vec_descs);
  loadDescsFromBinFile("tempDescsBin.desc", vec_descs_read)

还可以通过cereal把特征描述子保存为json格式

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值