BRISK: Binary Robust Invariant Scalable Keypoints
void BriskScaleSpace::constructPyramid(const cv::Mat& image){ // set correct size: pyramid_.clear(); // fill the pyramid: pyramid_.push_back(BriskLayer(image.clone())); if(layers_>1){ pyramid_.push_back(BriskLayer(pyramid_.back(),BriskLayer::CommonParams::TWOTHIRDSAMPLE)); } const int octaves2=layers_; for(uint8_t i=2; i<octaves2; i+=2){ pyramid_.push_back(BriskLayer(pyramid_[i-2],BriskLayer::CommonParams::HALFSAMPLE)); pyramid_.push_back(BriskLayer(pyramid_[i-1],BriskLayer::CommonParams::HALFSAMPLE)); } }
1 __inline__ bool BriskScaleSpace::isMax2D(const uint8_t layer, 2 const int x_layer, const int y_layer){ 3 const cv::Mat& scores = pyramid_[layer].scores(); 4 const int scorescols = scores.cols; 5 uchar* data=scores.data + y_layer*scorescols + x_layer; 6 // decision tree: 7 const uchar center = (*data); 8 data--; 9 const uchar s_10=*data; //1 10 if(center<s_10) return false; 11 data+=2; 12 const uchar s10=*data; //2 13 if(center<s10) return false; 14 data-=(scorescols+1); 15 const uchar s0_1=*data; //3 16 if(center<s0_1) return false; 17 data+=2*scorescols; 18 const uchar s01=*data; //4 19 if(center<s01) return false; 20 data--; 21 const uchar s_11=*data; //5 22 if(center<s_11) return false; 23 data+=2; 24 const uchar s11=*data; //6 25 if(center<s11) return false; 26 data-=2*scorescols; 27 const uchar s1_1=*data; //7 28 if(center<s1_1) return false; 29 data-=2; 30 const uchar s_1_1=*data;//8 31 if(center<s_1_1) return false; 32 33 /*8 3 7 34 1 0 2 35 5 4 6*/ 36 37 // reject neighbor maxima 38 std::vector<int> delta; 39 // put together a list of 2d-offsets to where the maximum is also reached 40 if(center==s_1_1) { //8 41 delta.push_back(-1); 42 delta.push_back(-1); 43 } 44 if(center==s0_1) { //3 45 delta.push_back(0); 46 delta.push_back(-1); 47 } 48 if(center==s1_1) { //7 49 delta.push_back(1); 50 delta.push_back(-1); 51 } 52 if(center==s_10) { //1 53 delta.push_back(-1); 54 delta.push_back(0); 55 } 56 if(center==s10) { //2 57 delta.push_back(1); 58 delta.push_back(0); 59 } 60 if(center==s_11) { //5 61 delta.push_back(-1); 62 delta.push_back(1); 63 } 64 if(center==s01) { //4 65 delta.push_back(0); 66 delta.push_back(1); 67 } 68 if(center==s11) { //6 69 delta.push_back(1); 70 delta.push_back(1); 71 } 72 const unsigned int deltasize=delta.size(); 73 if(deltasize!=0){ 74 // in this case, we have to analyze the situation more carefully: 75 // the values are gaussian blurred and then we really decide 76 data=scores.data + y_layer*scorescols + x_layer; 77 int smoothedcenter=4*center+2*(s_10+s10+s0_1+s01)+s_1_1+s1_1+s_11+s11; 78 for(unsigned int i=0; i<deltasize;i+=2){ 79 //这里把左上角作为中心点进行平滑不知道是何意? 80 data=scores.data + (y_layer-1+delta[i+1])*scorescols + x_layer+delta[i]-1; 81 int othercenter=*data; 82 data++; 83 othercenter+=2*(*data); 84 data++; 85 othercenter+=*data; 86 data+=scorescols; 87 othercenter+=2*(*data); 88 data--; 89 othercenter+=4*(*data); 90 data--; 91 othercenter+=2*(*data); 92 data+=scorescols; 93 othercenter+=*data; 94 data++; 95 othercenter+=2*(*data); 96 data++; 97 othercenter+=*data; 98 if(othercenter>smoothedcenter) return false; 99 } 100 } 101 return true; 102 }
a.BRISK使用固定的样本模式点,而且是以R为半径围绕关键点周围的圆进行均匀取样。因此特定的高斯核平滑不会突然地扭曲亮度内容的信息(模糊邻近的两个采样点的亮度,从而保证亮度平滑过渡)
b.与两两组成的点对相比,BRISK显著的减少了采样点的数量(例如,单个的样本点参与了更多的比较),限制了亮度查找表的复杂度
c.这里的比较是受到空间的限制的,所以亮度的改变仅仅只是需要局部一致性就可以了。
1.利用least square进行曲线拟合中的参数计算
3.<BRISK: Binary Robust Invariant Scalable Keypoints> Stefan Leutenegger, Margarita Chli and Roland Y. Siegwart