从硬盘读取SIFT特征点数据,这些数据是David Lowe的程序生成的,不包含读取描述。
http://www.cs.ubc.ca/~lowe/keypoints/
readsift.h
#pragma once
#include <vector>
struct SiftPoint {
double x;
double y;
double scale;
double orientation;
};
bool loadSiftPoints(const char* nameFile, std::vector<SiftPoint>& siftPoints);
readsift.cpp
#include "readsift.h"
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
bool loadSiftPoints(const char* nameFile, std::vector<SiftPoint>& siftPoints)
{
siftPoints.clear();
std::ifstream ifile(nameFile);
int numPoints;
if(ifile.good())
{
std::string str;
std::getline(ifile, str);
std::istringstream s(str);
s >> numPoints;
while (ifile.good())
{
std::string str;
std::getline(ifile, str);
if (ifile.good())
{
std::i