Exemplo n.º 1
0
 /// Export in two separate files the regions and their corresponding descriptors.
 bool Save(
   const std::string& sfileNameFeats,
   const std::string& sfileNameDescs) const override
 {
   return saveFeatsToFile(sfileNameFeats, vec_feats_)
         & saveDescsToBinFile(sfileNameDescs, vec_descs_);
 }
Exemplo n.º 2
0
 /// Export in two separate files the feats and their corresponding descriptors
 ///  descriptor in binary to save place
 bool saveToBinFile(
   const std::string& sfileNameFeats,
   const std::string& sfileNameDescs) const
 {
   return saveFeatsToFile(sfileNameFeats, _feats)
         & saveDescsToBinFile(sfileNameDescs, _descs);
 }
Exemplo n.º 3
0
TEST(OpenmvgDescriptor, BINARY) {
  	// 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.push_back(desc);
  	}

  	//Save them to a file
  	saveDescsToBinFile("tempDescsBin.desc", vec_descs);

  	//Read the saved data and compare to input (to check write/read IO)
  	Descs_T vec_descs_read;
  	loadDescsFromBinFile("tempDescsBin.desc", vec_descs_read);
  	EXPECT_EQ(CARD, vec_descs_read.size());

  	for(int i = 0; i < CARD; ++i) 
  	{
  		for(int j = 0; j < DESC_LENGTH; ++j)
  			EXPECT_EQ(vec_descs[i][j], vec_descs_read[i][j]);
  	}
}
Exemplo n.º 4
0
void hulo::saveAKAZEBin(std::string filename, cv::Mat& mat) {
	CV_Assert(mat.type()==CV_8UC1);
	std::vector<openMVG::features::Descriptor<unsigned char, 64>> vec_descs;
	for (int i=0; i<mat.rows; i++) {
		openMVG::features::Descriptor<unsigned char, 64> desc;
		for (int j=0; j<64; j++) {
			if (j<mat.cols) {
				desc[j] = (int)mat.at<uchar>(i, j);
			} else {
				desc[j] = 0.0;
			}
		}
		vec_descs.push_back(desc);
	}
	saveDescsToBinFile(filename, vec_descs);
}