這是SIFT的簡單代碼,我得到的是非常奇怪的描述符,它們是正確的嗎?SIFT opencv2.3.1/2.4.3同時給出很奇怪的描述符..例如7.,29.,39.,11.,2.3.1給出很奇怪的描述符
描述符:[0,7,29,39,11,0,0,0,32,30,39,52,16 , 1.,12.,38.,14.,10.,20.,28.,93.,45.,37.,93.,3.,6., 11.,23.,107 24.,80.,0.,2.,47.,53.,0.,1.,9.,8.,104., 85.,35.,41.,1.,10。 ,32.,19.,130.,73.,0.,0.,8.,76.,31., 42.,61.,40.,10.,5.,83.,130., 28.,31.,3.,0.,0,0,0,0。 2.,12.,17.,60.,4.,0.,0。,0.,31.,76 ...,83.,130.,38.,10., 6.,15.,10.,16.,89.,19.,21.,16.,23.,130.,94., ,3.,1. ]
#include "stdafx.h"
#include <iostream>
#include <cv.h>
#include <highgui.h>
#include <C:\opencv243\include\opencv2\nonfree\features2d.hpp>
using namespace cv;
using namespace std;
int main(int argc, const char* argv[])
{
string path="matrices.xml";
FileStorage fs(path, FileStorage::WRITE);
cv::siftFeatureDetector detector;
cv::SiftDescriptorExtractor extractor;
cv::Mat descriptors_1;
std::vector<cv::KeyPoint> keypoints;
const cv::Mat input=cv::imread("image path",0);
detector.detect(input, keypoints);
extractor.compute(input, keypoints, descriptors_1);
fs <<"descriptor"<<descriptors_1;
fs.release();
return 0;
}
描述符有什麼奇怪的地方? – 2013-02-22 18:53:04
爲了訓練的目的,我想保存文件(xml)上的篩選描述符,所以我可以在將來使用它,我想要浮點描述符,因爲我在衝浪的情況下。 – Vivek 2013-02-23 08:01:22
sift.cpp中的評論提到該實現基於OpenSift實現。 OpenSift也將float轉換爲512的整數作爲閾值。雖然我也不確定爲什麼。 – adikshit 2014-04-09 01:52:48