Reputation: 2137
I'm extracting SURF descriptors from an image using the following simple lines:
Ptr<DescriptorExtractor> descriptor = DescriptorExtractor::create("SURF");
descriptor->compute(im1, kp, desc1);
Now, when I "watch" the variable desc1.data, it contains integer values in the range 0 to 255.
However, when I investigate the values using the code:
for (int j=0;j<desc1.cols; j++){
float a=desc1.at<float>(0,j);
it contains values between -1 and 1. How is that possible? SURF shouldn't return integer values like SIFT?
Upvotes: 1
Views: 1113
Reputation: 2179
I am not sure what happens in OpenCV, but as far the paper goes this is what SURF does. The SURF descriptor divides a small image patch into 4x4 sub regions and computes wavelet responses over each sub region in a clever fashion. Basically it is a 4 tuple descripor < sum(dx), sum(dy), sum(|dx|), sum(|dy|)>, where dx, dy are wavelet responses in each sub-region. The descriptor is constructed by concatenating all the responses and normalizing the magnitude, which results in a 64 dimensional descriptor. It is clear from the description that normalized sum(dx) and sum(dy) values would lie between -1 and 1, while sum(|dx|) and sum(|dy|) would lie between 0 to 1. If you see the 128 dimensional descriptor, the summation for dx and |dx| is computed separately for dx >= 0 and dy < 0, which doubles the size of the 64 dimensional descriptor.
Upvotes: 1