Exemplo n.º 1
0
void FrFeatureVectorMap::init(const FrFeatureVectorMap *oldmap)
{
    m_self = 0 ;
    init() ;
    if (oldmap && oldmap->numFeatures() > 0)
    {
        m_featurecount = oldmap->numFeatures() ;
        m_alloccount = oldmap->m_alloccount ;
        m_names = FrNewN(char*,m_alloccount) ;
        m_sort_order = FrNewN(unsigned,m_alloccount) ;
        if (m_names && m_sort_order)
        {
            // copy the feature names from the old map
            for (size_t i = 0 ; i < numFeatures() ; i++)
            {
                m_names[i] = FrDupString(oldmap->m_names[i]) ;
                m_sort_order[i] = oldmap->m_sort_order[i] ;
            }
        }
        else
        {
            FrFree(m_names) ;
            m_names = 0 ;
            FrFree(m_sort_order) ;
            m_sort_order = 0 ;
            FrNoMemory("while copying feature map") ;
            m_featurecount = m_alloccount = 0 ;
        }
    }
Exemplo n.º 2
0
FrFeatureVectorMap::~FrFeatureVectorMap()
{
    delete m_allocator ;
    m_allocator = 0 ;
    for (size_t i = 0 ; i < numFeatures() ; i++)
        FrFree(m_names[i]) ;
    FrFree(m_names) ;
    FrFree(m_sort_order) ;
    delete m_protected ;
    m_protected = 0 ;
    m_self = 0 ;
    return ;
}
Exemplo n.º 3
0
string HogWrapper::summary() const
{
  stringstream s;
  s << "["<<numFeatures()<<" HOG features]";
  return s.str();
}