I want to know more about KeyPoints, so can anyone told me what are
In OpenCV docs was mentioned that angle is computed orientation of the
If someone came to this question wondering why does keypoint.octave have such a weird value (e.g. 16253184), it is because it actually carries the information on:
octave in the least significant byte of the keypoint.octave fieldlayer of that octave in the second least significant byte of the keypoint.octave fieldkeypoint.octave gets unpacked into the variables octave, layer, and scale (scale is just 1/2^octave) with the method unpackOctave (see OpenCV implementation).
To get a visual understanding of variables octave and layer, this image might help:
If you really want to understand the basics, just go to the basics:
http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf
It is the first, and one of the most influential papers about image feature description/extraction. You may find it a bit hard to swallow, but it offers a good explanation of a complex problem.
If someone doesn't want to read the paper by Lowe, which @sammy mentioned, here is some short resume:
I recommend reading "Learning OpenCV". It is outdated in terms of OpenCV's API but the theory discussed there is really well explained.
Even though I know conceptual about the angle and octave, I wonder what the float angle mean, so I look in the source code of OpenCV2.3.1
in sift.cpp
inline KeyPoint featureToKeyPoint( const feature& feat )
{
float size = (float)(feat.scl * SIFT::DescriptorParams::GET_DEFAULT_MAGNIFICATION() * 4); // 4==NBP
float angle = (float)(feat.ori * a_180divPI);
return KeyPoint( (float)feat.x, (float)feat.y, size, angle, feat.response, feat.feature_data->octv, feat.class_id );
}
ok, I get the angle definition, but what is feat.ori and a_180divPI
the latter is easy to find
const double a_180divPI = 180./CV_PI;
the former needs some effort, after look through several methods, I get
struct feature
{
double x; /**< x coord */
double y; /**< y coord */
double scl; /**< scale of a Lowe-style feature */
double ori; /**< orientation of a Lowe-style feature */
...
};
and the feat.ori is computed through several steps according to Lowe's Paper ( http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf ), including calculate ori_hist, smooth the histogram and add_good_ori_feature.
I am not 100% sure about the exactly meaning of the ori, but I strongly doubt that OpenCV have turned the ori to an proper arc representation, and the final result angle is the normal meaning angel range from -180 degree to 180 degree. The evidences are
1) ori = arctan2( dy, dx)
2) bin = cvRound( n * ( ori * CV_PI ) / PI_2 )
3) new_feat->ori = ( ( PI2 * bin ) / n ) - CV_PI;
hope help you
This may help with regards to the octave:
http://en.wikipedia.org/wiki/Gaussian_pyramid
Basically, the image is blurred to varying degrees. The degree at which the feature is found is the 'octave' level of that feature.