Beispiel #1
0
void RFS::read(const cv::FileNode &fn)
{
	rtrees.clear();
	for (auto it = fn.begin(); it != fn.end(); ++it)
	{
		RTree rfs;
		*it >> rfs;
		rtrees.push_back(rfs);
	}
}
bool ConfigurationDataReader::loadConfigurationFromFileNode(const cv::FileNode &dataFileNode)
{
    bool success = true;
    
    cv::FileNodeIterator itEnd = dataFileNode.end();
    for (cv::FileNodeIterator it = dataFileNode.begin(); it != itEnd && success; it++)
    {
        const char *newDataValueName = (*it).name().c_str();
        success = success && loadNodeFromFileNode(dataFileNode, newDataValueName);
    }
    
    return success;
}
 void read ( const cv::FileNode& node, map< string, V >&result)
 {
   bool node_type_ok = (node.type() & FileNode::MAP) > 0;
   if(!node_type_ok)
   {
     cout << node.type() << endl;
     cout << (node.type() & FileNode::MAP) << endl;
     cout << ((node.type() & FileNode::MAP) > 0) << endl;
     assert(node_type_ok);
   }
   
   for(FileNodeIterator iter = node.begin(); iter != node.end(); ++iter)
   {
     string node_name = (*iter).name();
     V value;
     //iter >> value; 
     deformable_depth::read_in_map(*iter,value);
     result[node_name] = value;
   }
 }
Beispiel #4
0
void read(const cv::FileNode& node, vector<vector< pair<int, int> > >& termPair)
{

    cv::FileNodeIterator it = node.begin(), it_end = node.end();
    for( ; it != it_end; ++it)
    {
        vector<int> first_part;
        vector<int> second_part;
        (*it)["first"] >> first_part;
        (*it)["second"] >> second_part;
        vector<pair<int, int> > first_second;
        first_second.resize(first_part.size());
        for(int j = 0; j < first_part.size(); ++j)
        {
            first_second[j].first =  first_part[j];
            first_second[j].second = second_part[j];
        }
        termPair.push_back(first_second);
    }
    
}
Beispiel #5
0
	persistStore();
}

void ViolenceModel::storeInit(cv::FileStorage &file, std::string exampleStoreName, cv::Mat &exampleStore,
													 std::string classStoreName, cv::Mat &classStore,
													 std::string indexCacheName, std::map<std::string, time_t> &indexCache)
{
	// Read the data structures in from the training store.
	file[exampleStoreName] >> exampleStore;
	std::cout << exampleStoreName << " loaded. size: " << exampleStore.size() << "\n";

	file[classStoreName] >> classStore;
	std::cout << classStoreName << " loaded. size: " << classStore.size() << "\n";

	cv::FileNode indexedFilePaths = file[indexCacheName];
	cv::FileNodeIterator iter = indexedFilePaths.begin(), end = indexedFilePaths.end();
	while ( iter != end )
	{
		std::string path = (*iter)[VIOLENCE_MODEL_TRAINING_EXAMPLE_PATH];
		//std::cout << "found path: " << path << "\n";
		int modTime = (int)(*iter)[VIOLENCE_MODEL_TRAINING_EXAMPLE_MOD_DATE];
		indexCache[path] = (time_t)modTime;
		iter++;
	}

	// Ensure we go no further the height (rows) are not equivalent.
	std::cout << "classes: " << classStore.size().height << " examples: " << exampleStore.size().height << " indices: " << indexCache.size() << "\n";
	assert(classStore.size().height == exampleStore.size().height && classStore.size().height == indexCache.size());
}

void ViolenceModel::index(std::string resourcePath, bool isViolent)