예제 #1
0
bool is_comparable( const Descriptor & desc1, const Descriptor & desc2){
	return !desc1.empty() && !desc2.empty()
                        && desc1.size_a() == desc2.size_a()
                        && desc1.size_z() == desc2.size_z()
                        && desc1.size_r() == desc2.size_r()
                        && desc1.page() == desc2.page();
}
예제 #2
0
float difference(const Descriptor & desc1, const Descriptor & desc2, Descriptor& desc, float (*diff) (float, float) ){
    size_t idx = 0;
    float mindiff = inf;
    size_t height = desc1.height();
    size_t width = desc1.width();
    float sum;
    for( size_t k = 0; k < desc1.page(); ++k)
    { // k: page # of flipped/rotated descriptors
        sum = 0.0f;
        for( size_t i = 0; i < height; ++i){ //i, iterates all zenith and azimuth angle bins
            for( size_t j = 0; j < width; ++j) //j iterates all radius bins
                sum += diff( desc1(i, j, 0), desc2(i,j, k));
        }
        if( mindiff > sum){
            idx = k;
            mindiff = sum;
        }
    }
    desc.clear();
    Matrixf *pm = new Matrixf( *desc2.getPage( idx ) );
    pm->clone();
    *pm -= *desc1.getPage(0);
  //  pm->getAbsoluteValue();
    desc.m_vHistPtr.push_back( pm );
    desc.m_na = desc1.size_a();
    desc.m_nz = desc1.size_z();
    desc.m_nr = desc1.size_r();
    return mindiff / (desc1.sumWeight() + desc2.sumWeight());
}