I have read some literature about SIFT and watched some videos also. I understood most of the concepts behind SIFT but one thing which confuses me is about SIFT descriptors.
In SIFT:
16 x 16 pixels around the keypoint.16 x 16 blocks into 16 number of 4 x 4 blocks8 bin histogram for each 4 x 4 block4 x 4 x 8 = 128 dimension SIFT descriptor for this keypoint.
My confusion:
128 columns and 1 row.....why???128 columns and 1 row for a single keypoint then if i am getting 50 keypoints then shouldn't it be a 50 rows and 128 colmuns matrix?The opencv's 2.4.8 source says you should get n by 128 descriptor matrix, where n is the number of keypoints. You can see calcDescriptors() creates descriptor for every keypoint by refrencing descriptors rows.
static void calcDescriptors(const vector<Mat>& gpyr, const vector<KeyPoint>& keypoints,
Mat& descriptors, int nOctaveLayers, int firstOctave )
{
int d = SIFT_DESCR_WIDTH, n = SIFT_DESCR_HIST_BINS;
for( size_t i = 0; i < keypoints.size(); i++ )
{
// [...]
// some unrelevant code
calcSIFTDescriptor(img, ptf, angle, size*0.5f, d, n, descriptors.ptr<float>((int)i));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With