Reputation: 5649
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?Upvotes: 3
Views: 1569
Reputation: 4074
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));
}
}
Upvotes: 2