本文整理汇总了C++中IVector::setSize方法的典型用法代码示例。如果您正苦于以下问题:C++ IVector::setSize方法的具体用法?C++ IVector::setSize怎么用?C++ IVector::setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVector
的用法示例。
在下文中一共展示了IVector::setSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: classify
boolean CAlgorithmClassifierBliffCFIS::classify(const IFeatureVector& rFeatureVector, float64& rf64Class, IVector& rClassificationValues)
{
bliff::FeatureVector l_oFeatureVector(rFeatureVector.getSize(), 0);
for(uint32 j=0; j<rFeatureVector.getSize(); j++)
{
l_oFeatureVector[j]=rFeatureVector[j];
}
FILE* l_pFile=::fopen(_ParameterFile_, "wb");
::fwrite(m_oConfiguration.getDirectPointer(), m_oConfiguration.getSize(), 1, l_pFile);
::fclose(l_pFile);
itpp::Vec<double> l_vResult;
double l_dResult;
bliff::CFIS l_oBliffCFISClassifier;
l_oBliffCFISClassifier.readParams(_ParameterFile_);
l_vResult=l_oBliffCFISClassifier.classify(l_oFeatureVector);
l_dResult=l_oBliffCFISClassifier.assign(l_oFeatureVector);
if(ip_ui64OutputMode == OVP_TypeId_CFISOutputMode_ClassMembership.toUInteger())
{
itpp::Vec<double> l_vTmpVec(l_oBliffCFISClassifier.getNbClasses());
l_vTmpVec.zeros();
std::vector<double> l_oClassLabels = l_oBliffCFISClassifier.getClassLabels();
//finding the maximal degree of fulfillment for each class
for(uint32 j=0; j < l_oBliffCFISClassifier.getNbRules(); j++)
{
for(uint32 i=0; i < l_oClassLabels.size(); i++)
{
if((l_oBliffCFISClassifier.getRule(j)->getClass() == l_oClassLabels[i]) && (l_vResult[j]>l_vTmpVec[i]))
{
l_vTmpVec[i]=l_vResult[j];
}
}
}
//switching from rule fulfillment to class membership
l_vResult=l_vTmpVec;
}
//converting from BLiFF++ output to OpenViBE output (classification state)
rf64Class=l_dResult;
rClassificationValues.setSize(l_vResult.size());
for(size_t i=0; i<rClassificationValues.getSize(); i++)
{
rClassificationValues[i]=l_vResult[i];
}
//labelling the element of the output vector
if(ip_ui64OutputMode == OVP_TypeId_CFISOutputMode_ClassMembership.toUInteger())
{
char l_sBuffer[1024];
std::vector<double> l_vClassLabels = l_oBliffCFISClassifier.getClassLabels();
for(uint32 i=0; i < rClassificationValues.getSize(); i++)
{
sprintf(l_sBuffer, "Class %d membership degree", (uint32)l_vClassLabels[i]);
rClassificationValues.setElementLabel(i, l_sBuffer);
}
}
else if(ip_ui64OutputMode == OVP_TypeId_CFISOutputMode_RuleFulfillment.toUInteger())
{
char l_sBuffer[1024];
for(uint32 i=0; i < rClassificationValues.getSize(); i++)
{
sprintf(l_sBuffer, "Rule %d degree of fulfillment", (uint32)i+1);
rClassificationValues.setElementLabel(i, l_sBuffer);
}
}
else
{
this->getLogManager() << LogLevel_Warning << "Unhandled CFIS output mode " << ip_ui64OutputMode << " (" << this->getTypeManager().getEnumerationEntryNameFromValue(OVP_TypeId_CFISOutputMode, ip_ui64OutputMode) << "\n";
}
return true;
}