void CvHOGEvaluator::writeFeatures( FileStorage &fs, const Mat& featureMap ) const
{
  int featIdx;
  int componentIdx;
  const Mat_<int>& featureMap_ = (const Mat_<int>&) featureMap;
  fs << FEATURES << "[";
  for ( int fi = 0; fi < featureMap.cols; fi++ )
    if( featureMap_( 0, fi ) >= 0 )
    {
      fs << "{";
      featIdx = fi / getFeatureSize();
      componentIdx = fi % getFeatureSize();
      features[featIdx].write( fs, componentIdx );
      fs << "}";
    }
  fs << "]";
}
Exemple #2
0
void SampleList::setFeatureNames (unsigned int number, char **names) {

	if (_samples.empty () || number == getFeatureSize ()) {
		ssi_err ("number of features (%d) not compatible to sample list (%d)", number, getFeatureSize ());
	}

	if (_feature_names) {
		for (unsigned int i = 0; i < _n_features; i++) {
			delete[] _feature_names[i];
		}
		delete[] _feature_names;
	}

	_n_features = number;
	_feature_names = new char *[_n_features];
	for (unsigned int i = 0; i < _n_features; i++) {
		_feature_names[i] = new char[strlen (names[i]) + 1];
		ssi_strcpy (_feature_names[i], names[i]);
	}
}