Beispiel #1
0
int match(vector<DMatch> &match, frame &f1, frame &f2)
{
	vector<DMatch> matches;
  FlannBasedMatcher matcher;
  matcher.match(f1.desp, f2.desp, matches);
  
  static reader pd("../config/config.ini");
  
  double min_distance = 9999;
  double match_threshold = atof(pd.get("match_threshold").c_str());
  
  for (int i = 0; i < matches.size(); ++i)
  {
    if (matches[i].distance < min_distance)
    {
      min_distance = matches[i].distance;
    }
  }
  
  for (int i = 0; i < matches.size(); ++i)
  {
    if (matches[i].distance < (min_distance * match_threshold))
    {
      match.push_back(matches[i]);
    }
  }
  
  return match.size();
}
Beispiel #2
0
frame readframe(int index, reader &pd)
{
	frame f;
	
	string rgb = pd.get("rgb");
	string depth = pd.get("depth");
	string suffix = pd.get("suffix");
	
	stringstream name;
	name << rgb << index << suffix;
	string file;
	name >> file;
	f.rgb = imread(file);
	
	name.clear();
	file.clear();
	name << depth << index << suffix;
	name >> file;
	f.depth = imread(file, CV_LOAD_IMAGE_UNCHANGED);
	
	return f;
}