|
|
|
@ -567,7 +567,6 @@ struct SURFInvoker |
|
|
|
|
DW[i*PATCH_SZ+j] = G_desc.at<float>(i,0) * G_desc.at<float>(j,0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(const BlockedRange& range) const |
|
|
|
|
{ |
|
|
|
|
/* X and Y gradient wavelet data */ |
|
|
|
@ -576,7 +575,6 @@ struct SURFInvoker |
|
|
|
|
const int dy_s[NY][5] = {{0, 0, 4, 2, 1}, {0, 2, 4, 4, -1}}; |
|
|
|
|
|
|
|
|
|
const int descriptor_size = params->extended ? 128 : 64; |
|
|
|
|
|
|
|
|
|
/* Optimisation is better using nOriSampleBound than nOriSamples for
|
|
|
|
|
array lengths. Maybe because it is a constant known at compile time */ |
|
|
|
|
const int nOriSampleBound =(2*ORI_RADIUS+1)*(2*ORI_RADIUS+1); |
|
|
|
@ -591,32 +589,25 @@ struct SURFInvoker |
|
|
|
|
|
|
|
|
|
int k, k1 = range.begin(), k2 = range.end(); |
|
|
|
|
int maxSize = 0; |
|
|
|
|
|
|
|
|
|
for( k = k1; k < k2; k++ ) |
|
|
|
|
{ |
|
|
|
|
maxSize = std::max(maxSize, ((CvSURFPoint*)cvGetSeqElem( keypoints, k ))->size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
maxSize = cvCeil((PATCH_SZ+1)*maxSize*1.2f/9.0f); |
|
|
|
|
Ptr<CvMat> winbuf = cvCreateMat( 1, maxSize > 0 ? maxSize*maxSize : 1, CV_8U ); |
|
|
|
|
|
|
|
|
|
for( k = k1; k < k2; k++ ) |
|
|
|
|
{ |
|
|
|
|
const int* sum_ptr = sum->data.i; |
|
|
|
|
int sum_cols = sum->cols; |
|
|
|
|
int i, j, kk, x, y, nangle; |
|
|
|
|
|
|
|
|
|
float* vec; |
|
|
|
|
CvSurfHF dx_t[NX], dy_t[NY]; |
|
|
|
|
|
|
|
|
|
CvSURFPoint* kp = (CvSURFPoint*)cvGetSeqElem( keypoints, k ); |
|
|
|
|
int size = kp->size; |
|
|
|
|
CvPoint2D32f center = kp->pt; |
|
|
|
|
|
|
|
|
|
/* The sampling intervals and wavelet sized for selecting an orientation
|
|
|
|
|
and building the keypoint descriptor are defined relative to 's' */ |
|
|
|
|
float s = (float)size*1.2f/9.0f; |
|
|
|
|
|
|
|
|
|
/* To find the dominant orientation, the gradients in x and y are
|
|
|
|
|
sampled in a circle of radius 6s using wavelets of size 4s. |
|
|
|
|
We ensure the gradient wavelet size is even to ensure the
|
|
|
|
@ -680,19 +671,14 @@ struct SURFInvoker |
|
|
|
|
besty = sumy; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float descriptor_dir = cvFastArctan( besty, bestx ); |
|
|
|
|
kp->dir = descriptor_dir; |
|
|
|
|
|
|
|
|
|
if( !descriptors ) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
descriptor_dir *= (float)(CV_PI/180); |
|
|
|
|
|
|
|
|
|
/* Extract a window of pixels around the keypoint of size 20s */ |
|
|
|
|
int win_size = (int)((PATCH_SZ+1)*s); |
|
|
|
|
CV_Assert( winbuf->cols >= win_size*win_size ); |
|
|
|
|
|
|
|
|
|
CvMat win = cvMat(win_size, win_size, CV_8U, winbuf->data.ptr); |
|
|
|
|
float sin_dir = sin(descriptor_dir); |
|
|
|
|
float cos_dir = cos(descriptor_dir) ; |
|
|
|
|