# Understanding SIFT descriptor calculation

**URL:** <https://forum.opencv.org/t/understanding-sift-descriptor-calculation/4024>\
**Category:** C++\
**Tags:** features2d, sift\
**Created:** [June 25, 2021, 1:40pm UTC](https://forum.opencv.org/t/understanding-sift-descriptor-calculation/4024 "2021-06-25T13:40:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thunderwiring](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/thunderwiring/32/2501_2.png) [@thunderwiring](https://forum.opencv.org/u/thunderwiring)\
**Post date:** [June 25, 2021, 1:40pm UTC](https://forum.opencv.org/t/understanding-sift-descriptor-calculation/4024/1 "2021-06-25T13:40:25Z")

</div>

I need to understand how SIFT calculates the descriptors for the keypoints.

Intuitively, i understand that it takes each keypoint, calculates the gradients for each pixel in a circular neighborhood of the keypoint.  
The paper mentions a coordination system rotation in the keypoint.

My questions:

1. is my intuitive understanding correct?
2. im following this implementation of SIFT, and in the part of the calculation function there is this cos/sin calculation:  
[OpenCV's SIFT implementation · GitHub](https://gist.github.com/lxc-xx/7088609#file-sift-cpp-L540,L541)  
i think this is related to the coord system rotation, can you explain how?

p.s. This is my first post here!
