本文整理汇总了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);
}
示例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);
}
}
示例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;
}