Commit 8e776837 authored by Vladimir Dudnik's avatar Vladimir Dudnik

minor changes: removed trailing spaces in some files

parent dd45fe13
...@@ -156,7 +156,7 @@ icvResizeHaarPattern( const int src[][5], CvSurfHF* dst, int n, int oldSize, int ...@@ -156,7 +156,7 @@ icvResizeHaarPattern( const int src[][5], CvSurfHF* dst, int n, int oldSize, int
* Calculate the determinant and trace of the Hessian for a layer of the * Calculate the determinant and trace of the Hessian for a layer of the
* scale-space pyramid * scale-space pyramid
*/ */
CV_INLINE void CV_INLINE void
icvCalcLayerDetAndTrace( const CvMat* sum, int size, int sampleStep, CvMat *det, CvMat *trace ) icvCalcLayerDetAndTrace( const CvMat* sum, int size, int sampleStep, CvMat *det, CvMat *trace )
{ {
const int NX=3, NY=3, NXY=4; const int NX=3, NY=3, NXY=4;
...@@ -184,7 +184,7 @@ icvCalcLayerDetAndTrace( const CvMat* sum, int size, int sampleStep, CvMat *det, ...@@ -184,7 +184,7 @@ icvCalcLayerDetAndTrace( const CvMat* sum, int size, int sampleStep, CvMat *det,
/* Ignore pixels where some of the kernel is outside the image */ /* Ignore pixels where some of the kernel is outside the image */
margin = (size/2)/sampleStep; margin = (size/2)/sampleStep;
for( i=0; i<samples_i; i++ ) for( i = 0; i < samples_i; i++ )
{ {
sum_ptr = sum->data.i + (i*sampleStep)*sum->cols; sum_ptr = sum->data.i + (i*sampleStep)*sum->cols;
det_ptr = det->data.fl + (i+margin)*det->cols + margin; det_ptr = det->data.fl + (i+margin)*det->cols + margin;
...@@ -275,9 +275,9 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam ...@@ -275,9 +275,9 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam
CvSurfHF Dm; CvSurfHF Dm;
int i, j, size, margin, layer_rows, layer_cols; int i, j, size, margin, layer_rows, layer_cols;
float *det_ptr, *trace_ptr; float *det_ptr, *trace_ptr;
size = sizes[layer]; size = sizes[layer];
/* The integral image 'sum' is one pixel bigger than the source image */ /* The integral image 'sum' is one pixel bigger than the source image */
layer_rows = (sum->rows-1)/sampleStep; layer_rows = (sum->rows-1)/sampleStep;
layer_cols = (sum->cols-1)/sampleStep; layer_cols = (sum->cols-1)/sampleStep;
...@@ -287,7 +287,7 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam ...@@ -287,7 +287,7 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam
if( mask_sum ) if( mask_sum )
icvResizeHaarPattern( dm, &Dm, NM, 9, size, mask_sum->cols ); icvResizeHaarPattern( dm, &Dm, NM, 9, size, mask_sum->cols );
for( i = margin; i < layer_rows-margin; i++ ) for( i = margin; i < layer_rows-margin; i++ )
{ {
det_ptr = dets[layer]->data.fl + i*dets[layer]->cols; det_ptr = dets[layer]->data.fl + i*dets[layer]->cols;
...@@ -309,13 +309,13 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam ...@@ -309,13 +309,13 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam
const float *det1 = dets[layer-1]->data.fl + i*c + j; const float *det1 = dets[layer-1]->data.fl + i*c + j;
const float *det2 = dets[layer]->data.fl + i*c + j; const float *det2 = dets[layer]->data.fl + i*c + j;
const float *det3 = dets[layer+1]->data.fl + i*c + j; const float *det3 = dets[layer+1]->data.fl + i*c + j;
float N9[3][9] = { { det1[-c-1], det1[-c], det1[-c+1], float N9[3][9] = { { det1[-c-1], det1[-c], det1[-c+1],
det1[-1] , det1[0] , det1[1], det1[-1] , det1[0] , det1[1],
det1[c-1] , det1[c] , det1[c+1] }, det1[c-1] , det1[c] , det1[c+1] },
{ det2[-c-1], det2[-c], det2[-c+1], { det2[-c-1], det2[-c], det2[-c+1],
det2[-1] , det2[0] , det2[1], det2[-1] , det2[0] , det2[1],
det2[c-1] , det2[c] , det2[c+1] }, det2[c-1] , det2[c] , det2[c+1] },
{ det3[-c-1], det3[-c], det3[-c+1], { det3[-c-1], det3[-c], det3[-c+1],
det3[-1] , det3[0] , det3[1], det3[-1] , det3[0] , det3[1],
det3[c-1] , det3[c] , det3[c+1] } }; det3[c-1] , det3[c] , det3[c+1] } };
...@@ -343,7 +343,7 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam ...@@ -343,7 +343,7 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam
double center_i = sum_i + (double)(size-1)/2; double center_i = sum_i + (double)(size-1)/2;
double center_j = sum_j + (double)(size-1)/2; double center_j = sum_j + (double)(size-1)/2;
CvSURFPoint point = cvSURFPoint( cvPoint2D32f(center_j,center_i), CvSURFPoint point = cvSURFPoint( cvPoint2D32f(center_j,center_i),
CV_SIGN(trace_ptr[j]), sizes[layer], 0, val0 ); CV_SIGN(trace_ptr[j]), sizes[layer], 0, val0 );
/* Interpolate maxima location within the 3x3x3 neighbourhood */ /* Interpolate maxima location within the 3x3x3 neighbourhood */
...@@ -352,14 +352,14 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam ...@@ -352,14 +352,14 @@ icvFindMaximaInLayer( const CvMat *sum, const CvMat* mask_sum, const CvSURFParam
/* Sometimes the interpolation step gives a negative size etc. */ /* Sometimes the interpolation step gives a negative size etc. */
if( interp_ok ) if( interp_ok )
{ {
/*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/ /*printf( "KeyPoint %f %f %d\n", point.pt.x, point.pt.y, point.size );*/
#ifdef HAVE_TBB #ifdef HAVE_TBB
static tbb::mutex m; static tbb::mutex m;
tbb::mutex::scoped_lock lock(m); tbb::mutex::scoped_lock lock(m);
#endif #endif
cvSeqPush( points, &point ); cvSeqPush( points, &point );
} }
} }
} }
} }
...@@ -381,13 +381,13 @@ struct SURFBuildInvoker ...@@ -381,13 +381,13 @@ struct SURFBuildInvoker
dets = _dets; dets = _dets;
traces = _traces; traces = _traces;
} }
void operator()(const BlockedRange& range) const void operator()(const BlockedRange& range) const
{ {
for( int i=range.begin(); i<range.end(); i++ ) for( int i=range.begin(); i<range.end(); i++ )
icvCalcLayerDetAndTrace( sum, sizes[i], sampleSteps[i], dets[i], traces[i] ); icvCalcLayerDetAndTrace( sum, sizes[i], sampleSteps[i], dets[i], traces[i] );
} }
const CvMat *sum; const CvMat *sum;
const int *sizes; const int *sizes;
const int *sampleSteps; const int *sampleSteps;
...@@ -422,7 +422,7 @@ struct SURFFindInvoker ...@@ -422,7 +422,7 @@ struct SURFFindInvoker
icvFindMaximaInLayer( sum, mask_sum, params, dets, traces, sizes, layer, icvFindMaximaInLayer( sum, mask_sum, params, dets, traces, sizes, layer,
sampleSteps[layer], points ); sampleSteps[layer], points );
} }
} }
const CvMat *sum; const CvMat *sum;
const CvMat *mask_sum; const CvMat *mask_sum;
...@@ -440,7 +440,7 @@ struct SURFFindInvoker ...@@ -440,7 +440,7 @@ struct SURFFindInvoker
/* Wavelet size at first layer of first octave. */ /* Wavelet size at first layer of first octave. */
const int HAAR_SIZE0 = 9; const int HAAR_SIZE0 = 9;
/* Wavelet size increment between layers. This should be an even number, /* Wavelet size increment between layers. This should be an even number,
such that the wavelet sizes in an octave are either all even or all odd. such that the wavelet sizes in an octave are either all even or all odd.
...@@ -468,7 +468,7 @@ static CvSeq* icvFastHessianDetector( const CvMat* sum, const CvMat* mask_sum, ...@@ -468,7 +468,7 @@ static CvSeq* icvFastHessianDetector( const CvMat* sum, const CvMat* mask_sum,
cv::AutoBuffer<int> sampleSteps(nTotalLayers); cv::AutoBuffer<int> sampleSteps(nTotalLayers);
cv::AutoBuffer<int> middleIndices(nMiddleLayers); cv::AutoBuffer<int> middleIndices(nMiddleLayers);
int octave, layer, step, index, middleIndex; int octave, layer, step, index, middleIndex;
/* Allocate space and calculate properties of each layer */ /* Allocate space and calculate properties of each layer */
index = 0; index = 0;
middleIndex = 0; middleIndex = 0;
...@@ -514,17 +514,17 @@ namespace cv ...@@ -514,17 +514,17 @@ namespace cv
{ {
/* Methods to free data allocated in SURFInvoker constructor */ /* Methods to free data allocated in SURFInvoker constructor */
template<> inline void Ptr<float>::delete_obj(){ cvFree(&obj); } template<> inline void Ptr<float>::delete_obj() { cvFree(&obj); }
template<> inline void Ptr<CvPoint>::delete_obj(){ cvFree(&obj); } template<> inline void Ptr<CvPoint>::delete_obj() { cvFree(&obj); }
struct SURFInvoker struct SURFInvoker
{ {
enum { ORI_RADIUS = 6, ORI_WIN = 60, PATCH_SZ = 20 }; enum { ORI_RADIUS = 6, ORI_WIN = 60, PATCH_SZ = 20 };
static const int ORI_SEARCH_INC; static const int ORI_SEARCH_INC;
static const float ORI_SIGMA; static const float ORI_SIGMA;
static const float DESC_SIGMA; static const float DESC_SIGMA;
SURFInvoker( const CvSURFParams* _params, SURFInvoker( const CvSURFParams* _params,
CvSeq* _keypoints, CvSeq* _descriptors, CvSeq* _keypoints, CvSeq* _descriptors,
const CvMat* _img, const CvMat* _sum ) const CvMat* _img, const CvMat* _sum )
...@@ -537,7 +537,7 @@ struct SURFInvoker ...@@ -537,7 +537,7 @@ struct SURFInvoker
/* Simple bound for number of grid points in circle of radius ORI_RADIUS */ /* Simple bound for number of grid points in circle of radius ORI_RADIUS */
const int nOriSampleBound = (2*ORI_RADIUS+1)*(2*ORI_RADIUS+1); const int nOriSampleBound = (2*ORI_RADIUS+1)*(2*ORI_RADIUS+1);
/* Allocate arrays */ /* Allocate arrays */
apt = (CvPoint*)cvAlloc(nOriSampleBound*sizeof(CvPoint)); apt = (CvPoint*)cvAlloc(nOriSampleBound*sizeof(CvPoint));
aptw = (float*)cvAlloc(nOriSampleBound*sizeof(float)); aptw = (float*)cvAlloc(nOriSampleBound*sizeof(float));
...@@ -567,13 +567,14 @@ struct SURFInvoker ...@@ -567,13 +567,14 @@ struct SURFInvoker
DW[i*PATCH_SZ+j] = G_desc.at<float>(i,0) * G_desc.at<float>(j,0); DW[i*PATCH_SZ+j] = G_desc.at<float>(i,0) * G_desc.at<float>(j,0);
} }
} }
void operator()(const BlockedRange& range) const void operator()(const BlockedRange& range) const
{ {
/* X and Y gradient wavelet data */ /* X and Y gradient wavelet data */
const int NX=2, NY=2; const int NX=2, NY=2;
const int dx_s[NX][5] = {{0, 0, 2, 4, -1}, {2, 0, 4, 4, 1}}; const int dx_s[NX][5] = {{0, 0, 2, 4, -1}, {2, 0, 4, 4, 1}};
const int dy_s[NY][5] = {{0, 0, 4, 2, 1}, {0, 2, 4, 4, -1}}; const int dy_s[NY][5] = {{0, 0, 4, 2, 1}, {0, 2, 4, 4, -1}};
const int descriptor_size = params->extended ? 128 : 64; const int descriptor_size = params->extended ? 128 : 64;
/* Optimisation is better using nOriSampleBound than nOriSamples for /* Optimisation is better using nOriSampleBound than nOriSamples for
array lengths. Maybe because it is a constant known at compile time */ array lengths. Maybe because it is a constant known at compile time */
...@@ -586,7 +587,7 @@ struct SURFInvoker ...@@ -586,7 +587,7 @@ struct SURFInvoker
CvMat matY = cvMat(1, nOriSampleBound, CV_32F, Y); CvMat matY = cvMat(1, nOriSampleBound, CV_32F, Y);
CvMat _angle = cvMat(1, nOriSampleBound, CV_32F, angle); CvMat _angle = cvMat(1, nOriSampleBound, CV_32F, angle);
CvMat _patch = cvMat(PATCH_SZ+1, PATCH_SZ+1, CV_8U, PATCH); CvMat _patch = cvMat(PATCH_SZ+1, PATCH_SZ+1, CV_8U, PATCH);
int k, k1 = range.begin(), k2 = range.end(); int k, k1 = range.begin(), k2 = range.end();
int maxSize = 0; int maxSize = 0;
for( k = k1; k < k2; k++ ) for( k = k1; k < k2; k++ )
...@@ -649,7 +650,7 @@ struct SURFInvoker ...@@ -649,7 +650,7 @@ struct SURFInvoker
} }
matX.cols = matY.cols = _angle.cols = nangle; matX.cols = matY.cols = _angle.cols = nangle;
cvCartToPolar( &matX, &matY, 0, &_angle, 1 ); cvCartToPolar( &matX, &matY, 0, &_angle, 1 );
float bestx = 0, besty = 0, descriptor_mod = 0; float bestx = 0, besty = 0, descriptor_mod = 0;
for( i = 0; i < 360; i += ORI_SEARCH_INC ) for( i = 0; i < 360; i += ORI_SEARCH_INC )
{ {
...@@ -682,7 +683,7 @@ struct SURFInvoker ...@@ -682,7 +683,7 @@ struct SURFInvoker
CvMat win = cvMat(win_size, win_size, CV_8U, winbuf->data.ptr); CvMat win = cvMat(win_size, win_size, CV_8U, winbuf->data.ptr);
float sin_dir = sin(descriptor_dir); float sin_dir = sin(descriptor_dir);
float cos_dir = cos(descriptor_dir) ; float cos_dir = cos(descriptor_dir) ;
/* Subpixel interpolation version (slower). Subpixel not required since /* Subpixel interpolation version (slower). Subpixel not required since
the pixels will all get averaged when we scale down to 20 pixels */ the pixels will all get averaged when we scale down to 20 pixels */
/* /*
...@@ -798,17 +799,17 @@ struct SURFInvoker ...@@ -798,17 +799,17 @@ struct SURFInvoker
const CvMat* sum; const CvMat* sum;
CvSeq* keypoints; CvSeq* keypoints;
CvSeq* descriptors; CvSeq* descriptors;
/* Pre-calculated values */ /* Pre-calculated values */
int nOriSamples; int nOriSamples;
cv::Ptr<CvPoint> apt; cv::Ptr<CvPoint> apt;
cv::Ptr<float> aptw; cv::Ptr<float> aptw;
cv::Ptr<float> DW; cv::Ptr<float> DW;
}; };
const int SURFInvoker::ORI_SEARCH_INC = 5; const int SURFInvoker::ORI_SEARCH_INC = 5;
const float SURFInvoker::ORI_SIGMA = 2.5f; const float SURFInvoker::ORI_SIGMA = 2.5f;
const float SURFInvoker::DESC_SIGMA = 3.3f; const float SURFInvoker::DESC_SIGMA = 3.3f;
} }
...@@ -870,9 +871,9 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask, ...@@ -870,9 +871,9 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
cvSeqPushMulti( descriptors, 0, N ); cvSeqPushMulti( descriptors, 0, N );
} }
if ( N > 0 ) if ( N > 0 )
cv::parallel_for(cv::BlockedRange(0, N), cv::parallel_for(cv::BlockedRange(0, N),
cv::SURFInvoker(&params, keypoints, descriptors, img, sum) ); cv::SURFInvoker(&params, keypoints, descriptors, img, sum) );
......
...@@ -10,14 +10,15 @@ ...@@ -10,14 +10,15 @@
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
#endif #endif
static inline int sign(float r){ static inline int sign(float r)
{
if(r > 0.0001f) return 1; if(r > 0.0001f) return 1;
if(r < -0.0001f) return -1; if(r < -0.0001f) return -1;
return 0; return 0;
} }
/* /*
// Getting feature map for the selected subimage // Getting feature map for the selected subimage
// //
// API // API
// int getFeatureMaps(const IplImage * image, const int k, featureMap **map); // int getFeatureMaps(const IplImage * image, const int k, featureMap **map);
...@@ -29,7 +30,7 @@ static inline int sign(float r){ ...@@ -29,7 +30,7 @@ static inline int sign(float r){
// RESULT // RESULT
// Error status // Error status
*/ */
int getFeatureMaps_dp(const IplImage * image,const int k, CvLSVMFeatureMap **map) int getFeatureMaps_dp(const IplImage* image,const int k, CvLSVMFeatureMap **map)
{ {
int sizeX, sizeY; int sizeX, sizeY;
int p, px, strsz; int p, px, strsz;
......
This diff is collapsed.
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
IplImage * resize_opencv (IplImage * img, float scale){ IplImage* resize_opencv(IplImage* img, float scale)
IplImage * imgTmp; {
IplImage* imgTmp;
int W, H, tW, tH; int W, H, tW, tH;
...@@ -14,14 +15,10 @@ IplImage * resize_opencv (IplImage * img, float scale){ ...@@ -14,14 +15,10 @@ IplImage * resize_opencv (IplImage * img, float scale){
tW = (int)(((float)W) * scale + 0.5); tW = (int)(((float)W) * scale + 0.5);
tH = (int)(((float)H) * scale + 0.5); tH = (int)(((float)H) * scale + 0.5);
imgTmp = cvCreateImage(cvSize(tW , tH), img->depth, img->nChannels); imgTmp = cvCreateImage(cvSize(tW , tH), img->depth, img->nChannels);
cvResize( cvResize(img, imgTmp, CV_INTER_AREA);
img,
imgTmp,
CV_INTER_AREA
);
return imgTmp; return imgTmp;
} }
...@@ -42,7 +39,7 @@ IplImage * resize_opencv (IplImage * img, float scale){ ...@@ -42,7 +39,7 @@ IplImage * resize_opencv (IplImage * img, float scale){
// int i; // int i;
// for(i = 0; i < n; i++){ // for(i = 0; i < n; i++){
// dst[ofs[i].di] += ofs[i].alpha * src[ofs[i].si]; // dst[ofs[i].di] += ofs[i].alpha * src[ofs[i].si];
// } // }
//} //}
// //
//int round(float val){ //int round(float val){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment