mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 19:59:08 +08:00
cosmetic changes, removed trailing spaces
This commit is contained in:
parent
e92d0e4bc2
commit
8511c9fcb8
@ -227,8 +227,8 @@ icvInterpolateKeypoint( float N9[3][9], int dx, int dy, int ds, CvSURFPoint *poi
|
||||
int solve_ok;
|
||||
float A[9], x[3], b[3];
|
||||
CvMat matA = cvMat(3, 3, CV_32F, A);
|
||||
CvMat _x = cvMat(3, 1, CV_32F, x);
|
||||
CvMat _b = cvMat(3, 1, CV_32F, b);
|
||||
CvMat _x = cvMat(3, 1, CV_32F, x);
|
||||
CvMat _b = cvMat(3, 1, CV_32F, b);
|
||||
|
||||
b[0] = -(N9[1][5]-N9[1][3])/2; /* Negative 1st deriv with respect to x */
|
||||
b[1] = -(N9[1][7]-N9[1][1])/2; /* Negative 1st deriv with respect to y */
|
||||
@ -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) ;
|
||||
@ -830,7 +816,7 @@ CV_IMPL void
|
||||
cvExtractSURF( const CvArr* _img, const CvArr* _mask,
|
||||
CvSeq** _keypoints, CvSeq** _descriptors,
|
||||
CvMemStorage* storage, CvSURFParams params,
|
||||
int useProvidedKeyPts)
|
||||
int useProvidedKeyPts)
|
||||
{
|
||||
CvMat *sum = 0, *mask1 = 0, *mask_sum = 0;
|
||||
|
||||
@ -858,23 +844,23 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
|
||||
sum = cvCreateMat( img->rows+1, img->cols+1, CV_32SC1 );
|
||||
cvIntegral( img, sum );
|
||||
|
||||
// Compute keypoints only if we are not asked for evaluating the descriptors are some given locations:
|
||||
if (!useProvidedKeyPts)
|
||||
{
|
||||
if( mask )
|
||||
{
|
||||
mask1 = cvCreateMat( img->height, img->width, CV_8UC1 );
|
||||
mask_sum = cvCreateMat( img->height+1, img->width+1, CV_32SC1 );
|
||||
cvMinS( mask, 1, mask1 );
|
||||
cvIntegral( mask1, mask_sum );
|
||||
}
|
||||
keypoints = icvFastHessianDetector( sum, mask_sum, storage, ¶ms );
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Assert(useProvidedKeyPts && (_keypoints != 0) && (*_keypoints != 0));
|
||||
keypoints = *_keypoints;
|
||||
}
|
||||
// Compute keypoints only if we are not asked for evaluating the descriptors are some given locations:
|
||||
if (!useProvidedKeyPts)
|
||||
{
|
||||
if( mask )
|
||||
{
|
||||
mask1 = cvCreateMat( img->height, img->width, CV_8UC1 );
|
||||
mask_sum = cvCreateMat( img->height+1, img->width+1, CV_32SC1 );
|
||||
cvMinS( mask, 1, mask1 );
|
||||
cvIntegral( mask1, mask_sum );
|
||||
}
|
||||
keypoints = icvFastHessianDetector( sum, mask_sum, storage, ¶ms );
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_Assert(useProvidedKeyPts && (_keypoints != 0) && (*_keypoints != 0));
|
||||
keypoints = *_keypoints;
|
||||
}
|
||||
|
||||
N = keypoints->total;
|
||||
if( _descriptors )
|
||||
|
Loading…
Reference in New Issue
Block a user