Exemplo n.º 1
0
float  difference(const Descriptor* desc1, const Descriptor* desc2, Descriptor& desc, float (*diff) (float, float) )
{
    // assuming desc is valid
    if( desc2 == 0){
        desc.clear();
        desc.m_na = desc1->size_a();
        desc.m_nz = desc1->size_z();
        desc.m_nr = desc1->size_r();
        Matrixf *pm = new Matrixf( * desc1->getPage(0)  );
        pm->clone();
        desc.m_vHistPtr.push_back(pm);
        return 0.0f;
    }
    else if( desc1 == desc2 ){
        desc.clear();
        desc.m_na = desc1->size_a();
        desc.m_nz = desc1->size_z();
        desc.m_nr = desc1->size_r();
        Matrixf *pm = new Matrixf( desc.m_na * desc.m_nz, desc.m_nr  );
        pm->setAllZeros();
        desc.m_vHistPtr.push_back(pm);
        return 0.0f;
    }
    else
        return difference(*desc1, *desc2, desc, diff);
}
Exemplo n.º 2
0
Descriptor::Descriptor( const Neuron& neuron, const SphericalMesh& mesh)
    : m_fSumWeight(0)
{
    m_na = mesh.numAzimuth();
    m_nz = mesh.numZenith();
    m_nr = mesh.numRadius();
    vector<Vector3> points;
    vector<float> weights;
    gatherPoints( neuron, points, weights );
    Matrixf* pHist = new Matrixf(height(), width());
    pHist->setAllZeros();
    for( size_t i = 0; i < points.size(); ++i){
        vector<Index3D> index;
        mesh.get_index( points[i].spherical(), index );
        for( size_t j = 0; j < index.size(); ++j){
            float weight = 1.0f;// weights[i];
            assert(weight);
            (*pHist)( index[j].aidx * m_nz +
                      index[j].zidx, index[j].ridx) +=  weight;
            m_fSumWeight += weight;
        }

    }
    m_vHistPtr.push_back( pHist);
    vFlip(true);
    hFlip(true);
    rotate(0); // rotate the original histogram
    rotate(1); // rotate the virtically flipped one
    rotate(2); // rotate the horizontically flipped one
}