//! Build map of DoH responses void FastHessian::buildResponseMap() { // Calculate responses for the first 4 octaves: // Oct1: 9, 15, 21, 27 // Oct2: 15, 27, 39, 51 // Oct3: 27, 51, 75, 99 // Oct4: 51, 99, 147,195 // Oct5: 99, 195,291,387 // Deallocate memory and clear any existing response layers for(unsigned int i = 0; i < responseMap.size(); ++i) delete responseMap[i]; responseMap.clear(); // Get image attributes int w = (i_width / init_sample); int h = (i_height / init_sample); int s = (init_sample); // Calculate approximated determinant of hessian values if (octaves >= 1) { responseMap.push_back(new ResponseLayer(w, h, s, 9)); responseMap.push_back(new ResponseLayer(w, h, s, 15)); responseMap.push_back(new ResponseLayer(w, h, s, 21)); responseMap.push_back(new ResponseLayer(w, h, s, 27)); } if (octaves >= 2) { responseMap.push_back(new ResponseLayer(w/2, h/2, s*2, 39)); responseMap.push_back(new ResponseLayer(w/2, h/2, s*2, 51)); } if (octaves >= 3) { responseMap.push_back(new ResponseLayer(w/4, h/4, s*4, 75)); responseMap.push_back(new ResponseLayer(w/4, h/4, s*4, 99)); } if (octaves >= 4) { responseMap.push_back(new ResponseLayer(w/8, h/8, s*8, 147)); responseMap.push_back(new ResponseLayer(w/8, h/8, s*8, 195)); } if (octaves >= 5) { responseMap.push_back(new ResponseLayer(w/16, h/16, s*16, 291)); responseMap.push_back(new ResponseLayer(w/16, h/16, s*16, 387)); } // Extract responses from the image for (unsigned int i = 0; i < responseMap.size(); ++i) { buildResponseLayer(responseMap[i]); } }
void FastHessian::buildResponseMap() { // Filter sizes (from [SURF]): // Octave 1: 9, 15, 21, 27 // Octave 2: 15, 27, 39, 51 // Octave 3: 27, 51, 75, 99 // Octave 4: 51, 99, 147, 195 // Octave 5: 99, 195, 291, 387 (from opensurf code) // Each response map is built using the scale of the lowest octave // that needs it (values at coarser scales can be directly read form // the finer scale representation, since scales are powers of two). foreach(ResponseLayer * layer, m_layers) delete layer; m_layers.clear(); int w = (m_img.cols / m_init_sample); int h = (m_img.rows / m_init_sample); int s = m_init_sample; // For each octave, add the layers for filter sizes not included in // a smaller octave. Scale each octave by a factor 2. if(m_octaves >= 1) { m_layers.append(new ResponseLayer(w, h, s, 9)); m_layers.append(new ResponseLayer(w, h, s, 15)); m_layers.append(new ResponseLayer(w, h, s, 21)); m_layers.append(new ResponseLayer(w, h, s, 27)); } if(m_octaves >= 2) { m_layers.append(new ResponseLayer(w/2, h/2, s*2, 39)); m_layers.append(new ResponseLayer(w/2, h/2, s*2, 51)); } if(m_octaves >= 3) { m_layers.append(new ResponseLayer(w/4, h/4, s*4, 75)); m_layers.append(new ResponseLayer(w/4, h/4, s*4, 99)); } if(m_octaves >= 4) { m_layers.append(new ResponseLayer(w/8, h/8, s*8, 147)); m_layers.append(new ResponseLayer(w/8, h/8, s*8, 195)); } if(m_octaves >= 5) { m_layers.append(new ResponseLayer(w/16, h/16, s*8, 291)); m_layers.append(new ResponseLayer(w/16, h/16, s*8, 387)); } foreach(ResponseLayer *layer, m_layers) buildResponseLayer(layer); }
void buildResponseMap(FastHessian *fh) { int w = 0,h = 0,s = 0; unsigned int i = 0; // Get image attributes w = (fh->i_width / fh->init_sample); h = (fh->i_height / fh->init_sample); s = (fh->init_sample); // Calculate approximated determinant of hessian values if (fh->octaves >= 1) { ResLayer(&fh->responseMap[0],w, h, s, 9); ResLayer2(&fh->responseMap[1],w, h, s, 15); ResLayer3(&fh->responseMap[2],w, h, s, 21); ResLayer4(&fh->responseMap[3],w, h, s, 27); } if (fh->octaves >= 2) { ResLayer5(&fh->responseMap[4],w/2, h/2, s*2, 39); ResLayer6(&fh->responseMap[5],w/2, h/2, s*2, 51); } if (fh->octaves >= 3) { ResLayer7(&fh->responseMap[6],w/4, h/4, s*4, 75); ResLayer8(&fh->responseMap[7],w/4, h/4, s*4, 99); } if (fh->octaves >= 4) { ResLayer9(&fh->responseMap[8],w/8, h/8, s*8, 147); ResLayer10(&fh->responseMap[9],w/8, h/8, s*8, 195); } if (fh->octaves >= 5) { ResLayer11(&fh->responseMap[10],w/16, h/16, s*16, 291); ResLayer12(&fh->responseMap[11],w/16, h/16, s*16, 387); } // Extract responses from the image for (i = 0; i<12 ; ++i) { buildResponseLayer(fh, &fh->responseMap[i]); } }