当前位置: 首页>>代码示例>>C++>>正文


C++ ModelFile::readInt方法代码示例

本文整理汇总了C++中ModelFile::readInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelFile::readInt方法的具体用法?C++ ModelFile::readInt怎么用?C++ ModelFile::readInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelFile的用法示例。


在下文中一共展示了ModelFile::readInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadFromFile

void ShapeModel::loadFromFile(ModelFile &file)
{
    printf("Loading Shape model from file...\n");
    file.readInt(pyramidLevel);
    file.readInt(nMarkPoints);
    file.readInt(nTrain);
    file.readInt(nShapeParams);

    file.readReal(searchYOffset);
    file.readReal(searchXOffset);
    file.readReal(searchWScale);
    file.readReal(searchHScale);
    file.readReal(searchStepAreaRatio);
    
    file.readReal(searchScaleRatio);
    file.readReal(searchInitXOffset);
    file.readReal(searchInitYOffset);
    
    // PCA shape model
    file.readPCA(pcaShape);

    meanShape.create(nMarkPoints*2, 1);
    for (int i=0;i<nMarkPoints*2;i++)
        file.readReal(meanShape(i, 0));
    
    // Info for BTSM
    file.readReal(sigma2);
    file.readPCA(pcaFullShape);
    
    shapeInfo.readFromFile(file);
}
开发者ID:bweldon,项目名称:CSCI-448-Group-Project,代码行数:31,代码来源:shapemodel.cpp

示例2: readFromFile

void ShapeInfo::readFromFile(ModelFile &f){
    f.readInt(nContours);
    int t;
    contourStartInd.resize(nContours+1);
    for (int i=0;i<nContours+1;i++)
        contourStartInd[i] = f.readInt(t);
    contourIsClosed.resize(nContours);
    for (int i=0;i<nContours;i++)
        contourIsClosed[i] = f.readInt(t);
    pointInfo.resize(f.readInt(t));
    for (size_t i=0;i<pointInfo.size();i++){
        f.readInt(pointInfo[i].connectFrom);
        f.readInt(pointInfo[i].connectTo);
        f.readInt(pointInfo[i].type);
        f.readInt(pointInfo[i].pathId);
    }
}
开发者ID:franciszayek,项目名称:FeatureFinder,代码行数:17,代码来源:shapeinfo.cpp

示例3: loadFromFile

void ASMModel::loadFromFile(ModelFile& file)
{
    ShapeModel::loadFromFile(file);
    printf("Loading ASM model from file...\n");
    //! parameter k for ASM
    file.readInt(localFeatureRad);
    file.readInt(ns);
    
    int i,j;
    int rows, cols;
    file.readInt(rows);
    file.readInt(cols);
    iCovarG.resize(pyramidLevel+1);
    for (i=0;i<=pyramidLevel;i++){
        iCovarG[i].resize(nMarkPoints);
        for (j=0;j<nMarkPoints;j++){
            iCovarG[i][j].create(rows, cols);
            for (int ii=0;ii<rows;ii++)
                for (int jj=0;jj<cols;jj++)
                    file.readReal(iCovarG[i][j](ii, jj));
        }
    }
    
    file.readInt(rows);
    file.readInt(cols);
    meanG.resize(pyramidLevel+1);
    for (i=0;i<=pyramidLevel;i++){
        meanG[i].resize(nMarkPoints);
        for (j=0;j<nMarkPoints;j++){
            meanG[i][j].create(rows, cols);
            for (int ii=0;ii<rows;ii++)
                for (int jj=0;jj<cols;jj++)
                    file.readReal(meanG[i][j](ii, jj));
        }
    }
    
    // Prepare BTSM pyramid
    double curSigma2 = 0;
    for (i=0; i<pcaFullShape->eigenvalues.rows; i++){
        curSigma2 += pcaFullShape->eigenvalues.at<double>(i, 0);
    }
    printf("sssssssssig: %g\n", curSigma2);
    
    // Layer 2, 5 parameter
    for (i=0; i<5 && i<pcaFullShape->eigenvalues.rows; i++){
        curSigma2 -= pcaFullShape->eigenvalues.at<double>(i, 0);
    }
    sigma2Pyr[2] = curSigma2 / (nMarkPoints*2-4);
    printf("sssssssssig: %g\n", curSigma2);
    pcaPyr[2].eigenvalues = pcaFullShape->eigenvalues.rowRange(0, i);
    pcaPyr[2].eigenvectors = pcaFullShape->eigenvectors.rowRange(0, i);
    pcaPyr[2].mean = pcaFullShape->mean;
    
    // Layer 1, 20 parameter
    for (; i<20 && i<pcaFullShape->eigenvalues.rows; i++){
        curSigma2 -= pcaFullShape->eigenvalues.at<double>(i, 0);
    }
    sigma2Pyr[1] = curSigma2 / (nMarkPoints*2-4);
    pcaPyr[1].eigenvalues = pcaFullShape->eigenvalues.rowRange(0, i);
    pcaPyr[1].eigenvectors = pcaFullShape->eigenvectors.rowRange(0, i);
    pcaPyr[1].mean = pcaFullShape->mean;
    
    /*sigma2Pyr[2] = sigma2Pyr[1] = */sigma2Pyr[0] = sigma2;
    /*pcaPyr[2] = pcaPyr[1]= */pcaPyr[0] = *pcaShape;
}
开发者ID:jakexie,项目名称:face_performance,代码行数:65,代码来源:asmmodel.cpp


注:本文中的ModelFile::readInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。