Updated by Marina Kolpakova almost 13 years ago

Hi Guys
I have problem with ORB under feature2d. This function has input bool use ProvidedKeypoints. I put this option true. In this case, It has to use my KeyPoints. The output no descriptor and makes the input KeyPoints becomes zeros. The function works great if the options is false which means that u can not input u keypoints. Is it right ?

This is my test code
<pre><code class="cpp">
#include <C:\OpenCV2.4\build\include\opencv\cxcore.hpp>
#include <C:\OpenCV2.4\build\include\opencv2\features2d\features2d.hpp>
#include <C:\OpenCV2.4\build\include\opencv\highgui.h>
#include <C:\OpenCV2.4\build\include\opencv2\imgproc\imgproc.hpp>
#include <C:\OpenCV2.4\build\include\opencv2\flann\flann.hpp>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <utility>

using namespace std;
using namespace cv;

int main()
{

// Read the image
Mat img1=imread("E:\\Boss_project\\DATABASE\\Multi-PIE\\pose_-45\\session1\\201_01_01_080_05.png");
Mat out1;
cvtColor(img1,out1,CV_RGB2GRAY);

// Read the detected facial features (Key Points)
string STRING;
int pos;
double y;
double x;
string y_str;
string x_str;

Mat disr1;
vector<KeyPoint> kp1;

ifstream infile;
infile.open ("E:\\Boss_project\\PNLL_A_B_C_output\\facialfeature_txt\\13991_L_pts-68.txt");
while(!infile.eof()) // To get you all the lines.
{
getline(infile,STRING); // Saves the line in STRING.
pos=STRING.find_last_of(" ");
if(pos>0)
{
y_str=(STRING.substr(pos));
x_str=(STRING.substr(0,pos-1));
istringstream (y_str) >> y;
istringstream (x_str) >> x;
KeyPoint c(x,y,200,0,0.1,0,-1);
kp1.push_back(c);
}
else
{
break;
}
}

// Extract the descriptor around each facial point
ORB bob;
Mat mask(out1.rows,out1.cols,CV_32F,Scalar(1));
bob(out1,mask,kp1,disr1,true);
</code></pre>

Back