Exemplo n.º 1
0
bool DataSetVOC::loadBBoxes(CStr &nameNE, vector<Vec4i> &boxes, vecI &clsIdx)
{
	string fName = format(_S(annoPathW), _S(nameNE));
	FileStorage fs(fName, FileStorage::READ);
	FileNode fn = fs["annotation"]["object"];
	boxes.clear();
	clsIdx.clear();
	if (fn.isSeq()){
		for (FileNodeIterator it = fn.begin(), it_end = fn.end(); it != it_end; it++)
			loadBox(*it, boxes, clsIdx);
	}
	else
		loadBox(fn, boxes, clsIdx);
	return true;
}
Exemplo n.º 2
0
bool CvCascadeClassifier::readStages( const FileNode &node)
{
    FileNode rnode = node[CC_STAGES];
    if (!rnode.empty() || !rnode.isSeq())
        return false;
    stageClassifiers.reserve(numStages);
    FileNodeIterator it = rnode.begin();
    for( int i = 0; i < min( (int)rnode.size(), numStages ); i++, it++ )
    {
        Ptr<CvCascadeBoost> tempStage = makePtr<CvCascadeBoost>();
        if ( !tempStage->read( *it, featureEvaluator, *stageParams) )
            return false;
        stageClassifiers.push_back(tempStage);
    }
    return true;
}
Exemplo n.º 3
0
 virtual int readRunParams( FileStorage& fs )
 {
     int code = CV_StereoMatchingTest::readRunParams(fs);
     FileNode fn = fs.getFirstTopLevelNode();
     assert(fn.isSeq());
     for( int i = 0; i < (int)fn.size(); i+=4 )
     {
         string caseName = fn[i], datasetName = fn[i+1];
         RunParams params;
         string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
         string iterCount = fn[i+3]; params.iterCount = atoi(iterCount.c_str());
         caseNames.push_back( caseName );
         caseDatasets.push_back( datasetName );
         caseRunParams.push_back( params );
     }
     return code;
 }
Exemplo n.º 4
0
 virtual int readRunParams( FileStorage& fs )
 {
     int code = CV_StereoMatchingTest::readRunParams(fs);
     FileNode fn = fs.getFirstTopLevelNode();
     assert(fn.isSeq());
     for( int i = 0; i < (int)fn.size(); i+=5 )
     {
         string caseName = fn[i], datasetName = fn[i+1];
         RunParams params;
         string ndisp = fn[i+2]; params.ndisp = atoi(ndisp.c_str());
         string winSize = fn[i+3]; params.winSize = atoi(winSize.c_str());
         string fullDP = fn[i+4]; params.fullDP = atoi(fullDP.c_str()) == 0 ? false : true;
         caseNames.push_back( caseName );
         caseDatasets.push_back( datasetName );
         caseRunParams.push_back( params );
     }
     return code;
 }
Exemplo n.º 5
0
bool CvCascadeClassifier::readStages( const FileNode &node)
{
    FileNode rnode = node[CC_STAGES];
    if (!rnode.empty() || !rnode.isSeq())
        return false;
    stageClassifiers.reserve(numStages);
    FileNodeIterator it = rnode.begin();
    for( int i = 0; i < min( (int)rnode.size(), numStages ); i++, it++ )
    {
        CvCascadeBoost* tempStage = new CvCascadeBoost;
        if ( !tempStage->read( *it, (CvFeatureEvaluator *)featureEvaluator, *((CvCascadeBoostParams*)stageParams) ) )
        {
            delete tempStage;
            return false;
        }
        stageClassifiers.push_back(tempStage);
    }
    return true;
}
Exemplo n.º 6
0
int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
{
    if( !fs.isOpened() )
    {
        ts->printf( CvTS::LOG, "datasetsParams can not be read " );
        return CvTS::FAIL_INVALID_TEST_DATA;
    }
    datasetsParams.clear();
    FileNode fn = fs.getFirstTopLevelNode();
    assert(fn.isSeq());
    for( int i = 0; i < (int)fn.size(); i+=3 )
    {
        string name = fn[i];
        DatasetParams params;
        string sf = fn[i+1]; params.dispScaleFactor = atoi(sf.c_str());
        string uv = fn[i+2]; params.dispUnknVal = atoi(uv.c_str());
        datasetsParams[name] = params;
    }
    return CvTS::OK;
}