1 | initial version |

Well the first loop `for( i = 0; i < d+2; i++ ) {...}`

is used, to fill the Histogramm of the descriptor where `d`

is the width of the descriptor + 2 (e.g. with the 128 elements vector 4 + 2). It is initially filled with zeroes, so it would not occur the possibility, that a histogram bin would point to null instead of a value.

The second loop `for( i = -radius, k = 0; i <= radius; i++ ) {...}`

is used pick the pixel values around the certain keypoint and to calculate the orientation and magnitude of it. The `radius`

value determines what size this window where pixels will be looked up have. e.g. if radius is 15 the algorithms lookup window of the KeyPoint `100,100`

would be a rectangle with the upperLeft and bottomRight coordinates `85, 85`

and `115, 115`

2 | No.2 Revision |

Well the first loop `for( i = 0; i < d+2; i++ ) {...}`

is used, to fill the Histogramm of the descriptor where `d`

is the width of the descriptor + 2 (e.g. with the 128 elements vector 4 + 2). It is initially filled with zeroes, so it would not occur the possibility, that a histogram bin would point to null instead of a value.

The second loop `for( i = -radius, k = 0; i <= radius; i++ ) {...}`

is used pick the pixel values around the certain keypoint and to calculate the orientation and magnitude of it. The `radius`

value determines what size this window where pixels will be looked up have. e.g. if radius is 15 the algorithms lookup window of the KeyPoint `100,100`

would be a rectangle with the upperLeft and bottomRight coordinates `85, 85`

and `115, 115`

If you still don't know what is meant, I strongly suggest you to read a good tutorial about the theory of the algorithm.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.