ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
SiftGPU.cpp
Go to the documentation of this file.
1 // File: SiftGPU.cpp
3 // Author: Changchang Wu
4 // Description : Implementation of the SIFTGPU classes.
5 // SiftGPU: The SiftGPU Tool.
6 // SiftGPUEX: SiftGPU + viewer
7 // SiftParam: Sift Parameters
8 //
9 // Copyright (c) 2007 University of North Carolina at Chapel Hill
10 // All Rights Reserved
11 //
12 // Permission to use, copy, modify and distribute this software and its
13 // documentation for educational, research and non-profit purposes, without
14 // fee, and without a written agreement is hereby granted, provided that the
15 // above copyright notice and the following paragraph appear in all copies.
16 //
17 // The University of North Carolina at Chapel Hill make no representations
18 // about the suitability of this software for any purpose. It is provided
19 // 'as is' without express or implied warranty.
20 //
21 // Please send BUG REPORTS to ccwu@cs.unc.edu
22 //
24 
25 
26 #include "GL/glew.h"
27 #include <iostream>
28 #include <fstream>
29 #include <string>
30 #include <iomanip>
31 #include <vector>
32 #include <algorithm>
33 #include <math.h>
34 
35 #include <time.h>
36 using namespace std;
37 
38 
39 #include "GlobalUtil.h"
40 #include "SiftGPU.h"
41 #include "GLTexImage.h"
42 #include "ShaderMan.h"
43 #include "FrameBufferObject.h"
44 #include "SiftPyramid.h"
45 #include "PyramidGL.h"
46 
47 //CUDA works only with vc8 or higher
48 #if defined(SIFTGPU_CUDA_ENABLED)
49 #include "PyramidCU.h"
50 #endif
51 
52 #if defined(CL_SIFTGPU_ENABLED)
53 #include "PyramidCL.h"
54 #endif
55 
56 
58 #if defined(_WIN32)
59  #include "direct.h"
60  #pragma warning (disable : 4786)
61  #pragma warning (disable : 4996)
62 #else
63  //compatible with linux
64  #define _stricmp strcasecmp
65  #include <stdlib.h>
66  #include <string.h>
67  #include <unistd.h>
68 #endif
69 
70 #if !defined(_MAX_PATH)
71  #if defined (PATH_MAX)
72  #define _MAX_PATH PATH_MAX
73  #else
74  #define _MAX_PATH 512
75  #endif
76 #endif
77 
80 //
81 //just want to make this class invisible
82 class ImageList:public std::vector<std::string> {};
83 
85 {
86  _texImage = new GLTexInput;
87  _imgpath = new char[_MAX_PATH];
88  _outpath = new char[_MAX_PATH];
89  _imgpath[0] = _outpath[0] = 0;
90  _initialized = 0;
91  _image_loaded = 0;
92  _current = 0;
93  _list = new ImageList();
94  _pyramid = NULL;
95 }
96 
97 
98 
100 {
101  _view = _sub_view = 0;
102  _view_debug = 0;
104  srand((unsigned int)time(NULL));
105  RandomizeColor();
106 }
107 
108 
110 {
111  float hsv[3] = {0, 0.8f, 1.0f};
112  for(int i = 0; i < COLOR_NUM*3; i+=3)
113  {
114  hsv[0] = (rand()%100)*0.01f; //i/float(COLOR_NUM);
115  HSVtoRGB(hsv, _colors+i);
116  }
117 }
118 
120 {
121  if(_pyramid) delete _pyramid;
122  delete _texImage;
123  delete _list;
124  delete[] _imgpath;
125  delete[] _outpath;
126 }
127 
128 
129 inline void SiftGPU::InitSiftGPU()
130 {
131  if(_initialized || GlobalUtil::_GoodOpenGL ==0) return;
132 
133  //Parse sift parameters
134  ParseSiftParam();
135 
136 #if !defined(SIFTGPU_CUDA_ENABLED)
138  {
140  std::cerr << "---------------------------------------------------------------------------\n"
141  << "CUDA not supported in this binary! To enable it, please use SiftGPU_CUDA_Enable\n"
142  << "solution for VS2005+ or set siftgpu_enable_cuda to 1 in makefile\n"
143  << "----------------------------------------------------------------------------\n";
144  }
145 #else
147  {
148  // GlobalUtil::InitGLParam(0);
149  }
150  if(GlobalUtil::_GoodOpenGL == 0)
151  {
153  std::cerr << "Switch from OpenGL to CUDA\n";
154  }
155 
156  if(GlobalUtil::_UseCUDA && !PyramidCU::CheckCudaDevice(GlobalUtil::_DeviceIndex))
157  {
158  std::cerr << "Switch from CUDA to OpenGL\n";
160  }
161 #endif
162 
163  if(GlobalUtil::_verbose) std::cout <<"\n[SiftGPU Language]:\t"
164  << (GlobalUtil::_UseCUDA? "CUDA" :
165  (GlobalUtil::_UseOpenCL? "OpenCL" : "GLSL")) <<"\n";
166 
167 #if defined(SIFTGPU_CUDA_ENABLED)
169  _pyramid = new PyramidCU(*this);
170  else
171 #endif
172 #if defined(CL_SIFTGPU_ENABLED)
174  _pyramid = new PyramidCL(*this);
175  else
176 #endif
178  _pyramid = new PyramidPacked(*this);
179  else
180  _pyramid = new PyramidNaive(*this);
181 
182 
184  {
185  GlobalUtil::StartTimer("Initialize Pyramids");
188  }
189 
191  _initialized = 1;
192 }
193 
194 int SiftGPU::RunSIFT(int index)
195 {
196  if(_list->size()>0 )
197  {
198  index = index % _list->size();
199  if(strcmp(_imgpath, _list->at(index).data()))
200  {
201  strcpy(_imgpath, _list->at(index).data());
202  _image_loaded = 0;
203  _current = index;
204  }
205  return RunSIFT();
206  }else
207  {
208  return 0;
209  }
210 
211 }
212 
213 int SiftGPU::RunSIFT( int width, int height, const void * data, unsigned int gl_format, unsigned int gl_type)
214 {
215 
216  if(GlobalUtil::_GoodOpenGL ==0 ) return 0;
217  if(!_initialized) InitSiftGPU();
218  else GlobalUtil::SetGLParam();
219  if(GlobalUtil::_GoodOpenGL ==0 ) return 0;
220 
221  if(width > 0 && height >0 && data != NULL)
222  {
223  _imgpath[0] = 0;
224  //try downsample the image on CPU
225  GlobalUtil::StartTimer("Upload Image data");
226  if(_texImage->SetImageData(width, height, data, gl_format, gl_type))
227  {
228  _image_loaded = 2; //gldata;
230  _timing[0] = GlobalUtil::GetElapsedTime();
231 
232  //if the size of image is different, the pyramid need to be reallocated.
233  GlobalUtil::StartTimer("Initialize Pyramid");
234  _pyramid->InitPyramid(width, height, _texImage->_down_sampled);
236  _timing[1] = GlobalUtil::GetElapsedTime();
237 
238  return RunSIFT();
239  }else
240  {
241  return 0;
242  }
243  }else
244  {
245  return 0;
246  }
247 
248 }
249 
250 int SiftGPU::RunSIFT(const char * imgpath)
251 {
252  if(imgpath && imgpath[0])
253  {
254  //set the new image
255  strcpy(_imgpath, imgpath);
256  _image_loaded = 0;
257  return RunSIFT();
258  }else
259  {
260  return 0;
261  }
262 
263 
264 }
265 
266 int SiftGPU::RunSIFT(int num, const SiftKeypoint * keys, int keys_have_orientation)
267 {
268  if(num <=0) return 0;
269  _pyramid->SetKeypointList(num, (const float*) keys, 1, keys_have_orientation);
270  return RunSIFT();
271 }
272 
274 {
275  //check image data
276  if(_imgpath[0]==0 && _image_loaded == 0) return 0;
277 
278  //check OpenGL support
279  if(GlobalUtil::_GoodOpenGL ==0 ) return 0;
280 
282 
283  if(!_initialized)
284  {
285  //initialize SIFT GPU for once
286  InitSiftGPU();
287  if(GlobalUtil::_GoodOpenGL ==0 ) return 0;
288  }else
289  {
290  //in case some OpenGL parameters are changed by users
292  }
293 
294  timer.StartTimer("RUN SIFT");
295  //process input image file
296  if( _image_loaded ==0)
297  {
298  int width, height;
299  //load and try down-sample on cpu
300  GlobalUtil::StartTimer("Load Input Image");
301  if(!_texImage->LoadImageFile(_imgpath, width, height)) return 0;
302  _image_loaded = 1;
304  _timing[0] = GlobalUtil::GetElapsedTime();
305 
306  //make sure the pyrmid can hold the new image.
307  GlobalUtil::StartTimer("Initialize Pyramid");
308  _pyramid->InitPyramid(width, height, _texImage->_down_sampled);
310  _timing[1] = GlobalUtil::GetElapsedTime();
311 
312  }else
313  {
314  //change some global states
316  {
318  _texImage->FitTexViewPort();
319  }
320  if(_image_loaded == 1)
321  {
322  _timing[0] = _timing[1] = 0;
323  }else
324  {//2
325  _image_loaded = 1;
326  }
327  }
328 
329  if(_pyramid->_allocated ==0 ) return 0;
330 
331 
332 #ifdef DEBUG_SIFTGPU
333  _pyramid->BeginDEBUG(_imgpath);
334 #endif
335 
336  //process the image
337  _pyramid->RunSIFT(_texImage);
338 
339  //read back the timing
340  _pyramid->GetPyramidTiming(_timing + 2);
341 
342  //write output once if there is only one input
343  if(_outpath[0] ){ SaveSIFT(_outpath); _outpath[0] = 0;}
344 
345  //terminate the process when -exit is provided.
347 
348  timer.StopTimer();
349  if(GlobalUtil::_verbose)std::cout<<endl;
350 
351  return _pyramid->GetSucessStatus();
352 }
353 
354 
355 void SiftGPU::SetKeypointList(int num, const SiftKeypoint * keys, int keys_have_orientation)
356 {
357  _pyramid->SetKeypointList(num, (const float*)keys, 0, keys_have_orientation);
358 }
359 
360 void SiftGPUEX::DisplayInput()
361 {
362  if(_texImage==NULL) return;
363  _texImage->VerifyTexture();
364  _texImage->BindTex();
365  _texImage->DrawImage();
366  _texImage->UnbindTex();
367 
368 }
369 
370 void SiftGPU::SetVerbose(int verbose)
371 {
372  GlobalUtil::_timingO = verbose>2;
373  GlobalUtil::_timingL = verbose>3;
374  if(verbose == -1)
375  {
376  //Loop between verbose level 0, 1, 2
378  {
382  std::cout << "Console output disabled, press Q/V to enable\n\n";
383  }else
384  {
387  }
388  }else if(verbose == -2)
389  {
390  //trick for disabling all output (still keeps the timing level)
393  }else
394  {
395  GlobalUtil::_verbose = verbose>0;
396  GlobalUtil::_timingS = verbose>1;
397  }
398 }
399 
400 
402 {
403 
404  _level_min = -1;
405  _dog_level_num = 3;
406  _level_max = 0;
407  _sigma0 = 0;
408  _sigman = 0;
409  _edge_threshold = 0;
410  _dog_threshold = 0;
411 
412 
413 }
414 
415 float SiftParam::GetInitialSmoothSigma(int octave_min)
416 {
417  float sa = _sigma0 * powf(2.0f, float(_level_min)/float(_dog_level_num)) ;
418  float sb = _sigman / powf(2.0f, float(octave_min)) ;//
419  float sigma_skip0 = sa > sb + 0.001?sqrt(sa*sa - sb*sb): 0.0f;
420  return sigma_skip0;
421 }
422 
424 {
425 
426  if(_dog_level_num ==0) _dog_level_num = 3;
427  if(_level_max ==0) _level_max = _dog_level_num + 1;
428  if(_sigma0 ==0.0f) _sigma0 = 1.6f * powf(2.0f, 1.0f / _dog_level_num) ;
429  if(_sigman == 0.0f) _sigman = 0.5f;
430 
431 
432  _level_num = _level_max -_level_min + 1;
433 
434  _level_ds = _level_min + _dog_level_num;
435  if(_level_ds > _level_max ) _level_ds = _level_max ;
436 
438  float _sigmak = powf(2.0f, 1.0f / _dog_level_num) ;
439  float dsigma0 = _sigma0 * sqrt (1.0f - 1.0f / (_sigmak*_sigmak) ) ;
440  float sa, sb;
441 
442 
443  sa = _sigma0 * powf(_sigmak, (float)_level_min) ;
444  sb = _sigman / powf(2.0f, (float)GlobalUtil::_octave_min_default) ;//
445 
446  _sigma_skip0 = sa>sb+ 0.001?sqrt(sa*sa - sb*sb): 0.0f;
447 
448  sa = _sigma0 * powf(_sigmak, float(_level_min )) ;
449  sb = _sigma0 * powf(_sigmak, float(_level_ds - _dog_level_num)) ;
450 
451  _sigma_skip1 = sa>sb + 0.001? sqrt(sa*sa - sb*sb): 0.0f;
452 
453  _sigma_num = _level_max - _level_min;
454  _sigma = new float[_sigma_num];
455 
456  for(int i = _level_min + 1; i <= _level_max; i++)
457  {
458  _sigma[i-_level_min -1] = dsigma0 * powf(_sigmak, float(i)) ;
459  }
460 
461  if(_dog_threshold ==0) _dog_threshold = 0.02f / _dog_level_num ;
462  if(_edge_threshold==0) _edge_threshold = 10.0f;
463 }
464 
465 
466 void SiftGPUEX::DisplayOctave(void (*UseDisplayShader)(), int i)
467 {
468  if(_pyramid == NULL)return;
469  const int grid_sz = (int)ceil(_level_num/2.0);
470  double scale = 1.0/grid_sz ;
471  int gx=0, gy=0, dx, dy;
472 
473  if(_pyramid->_octave_min >0) scale *= (1<<_pyramid->_octave_min);
474  else if(_pyramid->_octave_min < 0) scale /= (1<<(-_pyramid->_octave_min));
475 
476 
477  i = i% _pyramid->_octave_num; //
478  if(i<0 ) i+= _pyramid->_octave_num;
479 
480  scale *= ( 1<<(i));
481 
482 
483 
484 
485  UseDisplayShader();
486 
487  glPushMatrix();
488  glScaled(scale, scale, scale);
489  for(int level = _level_min; level<= _level_max; level++)
490  {
491  GLTexImage * tex = _pyramid->GetLevelTexture(i+_pyramid->_octave_min, level);
492 
493  dx = tex->GetImgWidth();
494  dy = tex->GetImgHeight();
495 
496  glPushMatrix();
497 
498  glTranslated(dx*gx, dy*gy, 0);
499 
500  tex->BindTex();
501 
502  tex->DrawImage();
503  tex->UnbindTex();
504 
505  glPopMatrix();
506 
507  gx++;
508  if(gx>=grid_sz)
509  {
510  gx =0;
511  gy++;
512  }
513 
514  }
515 
516  glPopMatrix();
518 }
519 
520 void SiftGPUEX::DisplayPyramid( void (*UseDisplayShader)(), int dataName, int nskip1, int nskip2)
521 {
522 
523  if(_pyramid == NULL)return;
524  int grid_sz = (_level_num -nskip1 - nskip2);
525  if(grid_sz > 4) grid_sz = (int)ceil(grid_sz*0.5);
526  double scale = 1.0/grid_sz;
527  int stepx = 0, stepy = 0, dx, dy=0, nstep;
528 
529  if(_pyramid->_octave_min >0) scale *= (1<<_pyramid->_octave_min);
530  else if(_pyramid->_octave_min < 0) scale /= (1<<(-_pyramid->_octave_min));
531 
532 
533  glPushMatrix();
534  glScaled(scale, scale, scale);
535 
536  for(int i = _pyramid->_octave_min; i < _pyramid->_octave_min+_pyramid->_octave_num; i++)
537  {
538 
539  nstep = i==_pyramid->_octave_min? grid_sz: _level_num;
540  dx = 0;
541  UseDisplayShader();
542  for(int j = _level_min + nskip1; j <= _level_max-nskip2; j++)
543  {
544  GLTexImage * tex = _pyramid->GetLevelTexture(i, j, dataName);
545  if(tex->GetImgWidth() == 0 || tex->GetImgHeight() == 0) continue;
546  stepx = tex->GetImgWidth();
547  stepy = tex->GetImgHeight();
549  if(j == _level_min + nskip1 + nstep)
550  {
551  dy += stepy;
552  dx = 0;
553  }
554 
555  glPushMatrix();
556  glTranslated(dx, dy, 0);
557  tex->BindTex();
558  tex->DrawImage();
559  tex->UnbindTex();
560  glPopMatrix();
561 
562  dx += stepx;
563 
564  }
565 
567 
568  dy+= stepy;
569  }
570 
571  glPopMatrix();
572 }
573 
574 
575 void SiftGPUEX::DisplayLevel(void (*UseDisplayShader)(), int i)
576 {
577  if(_pyramid == NULL)return;
578 
579  i = i%(_level_num * _pyramid->_octave_num);
580  if (i<0 ) i+= (_level_num * _pyramid->_octave_num);
581  int octave = _pyramid->_octave_min + i/_level_num;
582  int level = _level_min + i%_level_num;
583  double scale = 1.0;
584 
585  if(octave >0) scale *= (1<<octave);
586  else if(octave < 0) scale /= (1<<(-octave));
587 
588  GLTexImage * tex = _pyramid->GetLevelTexture(octave, level);
589 
590  UseDisplayShader();
591 
592  glPushMatrix();
593  glScaled(scale, scale, scale);
594  tex->BindTex();
595  tex->DrawImage();
596  tex->UnbindTex();
597  glPopMatrix();
599 }
600 
602 {
603  if(_pyramid == NULL) return;
604  glEnable(GlobalUtil::_texTarget);
605  switch(_view)
606  {
607  case 0:
608  DisplayInput();
609  DisplayFeatureBox(_sub_view);
610  break;
611  case 1:
613  break;
614  case 2:
615  DisplayOctave(ShaderMan::UseShaderDisplayGaussian, _sub_view);
616  break;
617  case 3:
618  DisplayLevel(ShaderMan::UseShaderDisplayGaussian, _sub_view);
619  break;
620  case 4:
622  break;
623  case 5:
625  break;
626  case 6:
629  }
630 }
631 
632 
633 void SiftGPUEX::SetView(int view, int sub_view, char *title)
634 {
635  const char* view_titles[] =
636  {
637  "Original Image",
638  "Gaussian Pyramid",
639  "Octave Images",
640  "Level Image",
641  "Difference of Gaussian",
642  "Gradient",
643  "Keypoints"
644  };
645  const int view_num = 7;
646  _view = view % view_num;
647  if(_view <0) _view +=view_num;
648  _sub_view = sub_view;
649 
650  if(_view_debug)
651  strcpy(title, "Debug...");
652  else
653  strcpy(title, view_titles[_view]);
654 
655 }
656 
657 
659 {
660  std::cout
661  <<"SiftGPU Usage:\n"
662  <<"-h -help : Parameter information\n"
663  <<"-i <strings> : Filename(s) of the input image(s)\n"
664  <<"-il <string> : Filename of an image list file\n"
665  <<"-o <string> : Where to save SIFT features\n"
666  <<"-f <float> : Filter width factor; Width will be 2*factor+1 (default : 4.0)\n"
667  <<"-w <float> : Orientation sample window factor (default: 2.0)\n"
668  <<"-dw <float> * : Descriptor grid size factor (default : 3.0)\n"
669  <<"-fo <int> * : First octave to detect DOG keypoints(default : 0)\n"
670  <<"-no <int> : Maximum number of Octaves (default : no limit)\n"
671  <<"-d <int> : Number of DOG levels in an octave (default : 3)\n"
672  <<"-t <float> : DOG threshold (default : 0.02/3)\n"
673  <<"-e <float> : Edge Threshold (default : 10.0)\n"
674  <<"-m <int=2> : Multi Feature Orientations (default : 1)\n"
675  <<"-m2p : 2 Orientations packed as one float\n"
676  <<"-s <int=1> : Sub-Pixel, Sub-Scale Localization, Multi-Refinement(num)\n"
677  <<"-lcpu -lc <int> : CPU/GPU mixed Feature List Generation (default: 6)\n"
678  <<" Use GPU first, and use CPU when reduction size <= pow(2,num)\n"
679  <<" When <num> is missing or equals -1, no GPU will be used\n"
680  <<"-noprep : Upload raw data to GPU (default: RGB->LUM and down-sample on CPU)\n"
681  <<"-sd : Skip descriptor computation if specified\n"
682  <<"-unn * : Write unnormalized descriptor if specified\n"
683  <<"-b * : Write binary sift file if specified\n"
684  <<"-fs <int> : Block Size for freature storage <default : 4>\n"
685  <<"-cuda <int=0> : Use CUDA SiftGPU, and specify the device index\n"
686  <<"-tight : Automatically resize pyramid to fit new images tightly\n"
687  <<"-p <W>x<H> : Inititialize the pyramids to contain image of WxH (eg -p 1024x768)\n"
688  <<"-tc[1|2|3] <int> *: Threshold for limiting the overall number of features (3 methods)\n"
689  <<"-v <int> : Level of timing details. Same as calling Setverbose() function\n"
690  <<"-loweo : (0, 0) at center of top-left pixel (default: corner)\n"
691  <<"-maxd <int> * : Max working dimension (default : 2560 (unpacked) / 3200 (packed))\n"
692  <<"-nomc : Disabling auto-downsamping that try to fit GPU memory cap\n"
693  <<"-exit : Exit program after processing the input image\n"
694  <<"-unpack : Use the old unpacked implementation\n"
695  <<"-di : Use dynamic array indexing if available (default : no)\n"
696  <<" It could make computation faster on cards like GTX 280\n"
697  <<"-ofix * : use 0 as feature orientations.\n"
698  <<"-ofix-not * : disable -ofix.\n"
699  <<"-winpos <X>x<Y> * : Screen coordinate used in Win32 to select monitor/GPU.\n"
700  <<"-display <string>*: Display name used in Linux/Mac to select monitor/GPU.\n"
701  <<"\n"
702  <<"NOTE: parameters marked with * can be changed after initialization\n"
703  <<"\n";
704 }
705 
706 void SiftGPU::ParseParam(const int argc, const char **argv)
707 {
708  #define CHAR1_TO_INT(x) ((x >= 'A' && x <= 'Z') ? x + 32 : x)
709  #define CHAR2_TO_INT(str, i) (str[i] ? CHAR1_TO_INT(str[i]) + (CHAR1_TO_INT(str[i+1]) << 8) : 0)
710  #define CHAR3_TO_INT(str, i) (str[i] ? CHAR1_TO_INT(str[i]) + (CHAR2_TO_INT(str, i + 1) << 8) : 0)
711  #define STRING_TO_INT(str) (CHAR1_TO_INT(str[0]) + (CHAR3_TO_INT(str, 1) << 8))
712 
713 #ifdef _MSC_VER
714  //charizing is microsoft only
715  #define MAKEINT1(a) (#@a )
716 #else
717  #define mychar0 '0'
718  #define mychar1 '1'
719  #define mychar2 '2'
720  #define mychar3 '3'
721  #define mychara 'a'
722  #define mycharb 'b'
723  #define mycharc 'c'
724  #define mychard 'd'
725  #define mychare 'e'
726  #define mycharf 'f'
727  #define mycharg 'g'
728  #define mycharh 'h'
729  #define mychari 'i'
730  #define mycharj 'j'
731  #define mychark 'k'
732  #define mycharl 'l'
733  #define mycharm 'm'
734  #define mycharn 'n'
735  #define mycharo 'o'
736  #define mycharp 'p'
737  #define mycharq 'q'
738  #define mycharr 'r'
739  #define mychars 's'
740  #define mychart 't'
741  #define mycharu 'u'
742  #define mycharv 'v'
743  #define mycharw 'w'
744  #define mycharx 'x'
745  #define mychary 'y'
746  #define mycharz 'z'
747  #define MAKEINT1(a) (mychar##a )
748 #endif
749  #define MAKEINT2(a, b) (MAKEINT1(a) + (MAKEINT1(b) << 8))
750  #define MAKEINT3(a, b, c) (MAKEINT1(a) + (MAKEINT2(b, c) << 8))
751  #define MAKEINT4(a, b, c, d) (MAKEINT1(a) + (MAKEINT3(b, c, d) << 8))
752 
753 
754  const char* arg, *param, * opt;
755  int setMaxD = 0, opti;
756  for(int i = 0; i< argc; i++)
757  {
758  arg = argv[i];
759  if(arg == NULL || arg[0] != '-' || !arg[1])continue;
760  opt = arg+1;
761  opti = STRING_TO_INT(opt);
762  param = argv[i+1];
763 
765  switch(opti)
766  {
767  case MAKEINT1(h):
768  case MAKEINT4(h, e, l, p):
769  PrintUsage();
770  break;
771  case MAKEINT4(c, u, d, a):
772 #if defined(SIFTGPU_CUDA_ENABLED)
773 
774  if(!_initialized)
775  {
777  int device = -1;
778  if(i+1 <argc && sscanf(param, "%d", &device) && device >=0)
779  {
780  GlobalUtil::_DeviceIndex = device;
781  i++;
782  }
783  }
784 #else
785  std::cerr << "---------------------------------------------------------------------------\n"
786  << "CUDA not supported in this binary! To enable it, please use SiftGPU_CUDA_Enable\n"
787  << "solution for VS2005+ or set siftgpu_enable_cuda to 1 in makefile\n"
788  << "----------------------------------------------------------------------------\n";
789 #endif
790  break;
791  case MAKEINT2(c, l):
792 #if defined(CL_SIFTGPU_ENABLED)
793  if(!_initialized) GlobalUtil::_UseOpenCL = 1;
794 #else
795  std::cerr << "---------------------------------------------------------------------------\n"
796  << "OpenCL not supported in this binary! Define CL_SIFTGPU_CUDA_ENABLED to..\n"
797  << "----------------------------------------------------------------------------\n";
798 #endif
799  break;
800 
801  case MAKEINT4(p, a, c, k):
802  if(!_initialized) GlobalUtil::_usePackedTex = 1;
803  break;
804  case MAKEINT4(u, n, p, a): //unpack
805  if(!_initialized)
806  {
808  if(!setMaxD) GlobalUtil::_texMaxDim = 2560;
809  }
810  break;
811  case MAKEINT4(l, c, p, u):
812  case MAKEINT2(l, c):
813  if(!_initialized)
814  {
815  int gskip = -1;
816  if(i+1 <argc) sscanf(param, "%d", &gskip);
817  if(gskip >= 0)
818  {
820  }else
821  {
823  }
824  }
825  break;
826  case MAKEINT4(p, r, e, p):
828  break;
829  case MAKEINT4(n, o, p, r): //noprep
831  break;
832  case MAKEINT4(f, b, o, 1):
834  break;
835  case MAKEINT4(f, b, o, s):
837  break;
838  case MAKEINT2(s, d):
839  if(!_initialized) GlobalUtil::_DescriptorPPT =0;
840  break;
841  case MAKEINT3(u, n, n):
843  break;
844  case MAKEINT4(n, d, e, s):
846  break;
847  case MAKEINT1(b):
849  break;
850  case MAKEINT4(t, i, g, h): //tight
852  break;
853  case MAKEINT4(e, x, i, t):
855  break;
856  case MAKEINT2(d, i):
858  break;
859  case MAKEINT4(s, i, g, n):
860  if(!_initialized || GlobalUtil::_UseCUDA) GlobalUtil::_KeepExtremumSign = 1;
861  break;
862  case MAKEINT1(m):
863  case MAKEINT2(m, o):
864  if(!_initialized)
865  {
866  int mo = 2; //default multi-orientation
867  if(i+1 <argc) sscanf(param, "%d", &mo);
868  //at least two orientation
869  GlobalUtil::_MaxOrientation = min(max(1, mo), 4);
870  }
871  break;
872  case MAKEINT3(m, 2, p):
873  if(!_initialized)
874  {
877  }
878  break;
879  case MAKEINT1(s):
880  if(!_initialized)
881  {
882  int sp = 1; //default refinement
883  if(i+1 <argc) sscanf(param, "%d", &sp);
884  //at least two orientation
886  }
887  break;
888  case MAKEINT4(o, f, i, x):
889  GlobalUtil::_FixedOrientation = (_stricmp(opt, "ofix")==0);
890  break;
891  case MAKEINT4(l, o, w, e): // loweo
893  break;
894  case MAKEINT4(n, a, r, r): // narrow
896  break;
897  case MAKEINT4(d, e, b, u): // debug
898  GlobalUtil::_debug = 1;
899  break;
900  case MAKEINT2(k, 0):
902  break;
903  case MAKEINT2(k, x):
905  break;
906  case MAKEINT2(d, a):
908  break;
909  case MAKEINT3(f, m, c):
911  break;
912  case MAKEINT4(n, o, m, c):
914  break;
915  default:
916  if(i + 1 >= argc) break;
917  switch(opti)
918  {
919  case MAKEINT1(i):
920  strcpy(_imgpath, param);
921  i++;
922  //get the file list..
923  _list->push_back(param);
924  while( i+1 < argc && argv[i+1][0] !='-')
925  {
926  _list->push_back(argv[++i]);
927  }
928  break;
929  case MAKEINT2(i, l):
930  LoadImageList(param);
931  i++;
932  break;
933  case MAKEINT1(o):
934  strcpy(_outpath, param);
935  i++;
936  break;
937  case MAKEINT1(f):
938  {
939  float factor = 0.0f;
940  if(sscanf(param, "%f", &factor) && factor > 0 )
941  {
943  i++;
944  }
945  }
946  break;
947  case MAKEINT2(o, t):
948  {
949  float factor = 0.0f;
950  if(sscanf(param, "%f", &factor) && factor>0 )
951  {
953  i++;
954  }
955  break;
956  }
957  case MAKEINT1(w):
958  {
959  float factor = 0.0f;
960  if(sscanf(param, "%f", &factor) && factor>0 )
961  {
963  i++;
964  }
965  break;
966  }
967  case MAKEINT2(d, w):
968  {
969  float factor = 0.0f;
970  if(sscanf(param, "%f", &factor) && factor > 0 )
971  {
973  i++;
974  }
975  break;
976  }
977  case MAKEINT2(f, o):
978  {
979  int first_octave = -3;
980  if(sscanf(param, "%d", &first_octave) && first_octave >=-2 )
981  {
982  GlobalUtil::_octave_min_default = first_octave;
983  i++;
984  }
985  break;
986  }
987  case MAKEINT2(n, o):
988  if(!_initialized)
989  {
990  int octave_num=-1;
991  if(sscanf(param, "%d", &octave_num))
992  {
993  octave_num = max(-1, octave_num);
994  if(octave_num ==-1 || octave_num >=1)
995  {
996  GlobalUtil::_octave_num_default = octave_num;
997  i++;
998  }
999  }
1000  }
1001  break;
1002  case MAKEINT1(t):
1003  {
1004  float threshold = 0.0f;
1005  if(sscanf(param, "%f", &threshold) && threshold >0 && threshold < 0.5f)
1006  {
1007  SiftParam::_dog_threshold = threshold;
1008  i++;
1009  }
1010  break;
1011  }
1012  case MAKEINT1(e):
1013  {
1014  float threshold = 0.0f;
1015  if(sscanf(param, "%f", &threshold) && threshold >0 )
1016  {
1017  SiftParam::_edge_threshold = threshold;
1018  i++;
1019  }
1020  break;
1021  }
1022  case MAKEINT1(d):
1023  {
1024  int num = 0;
1025  if(sscanf(param, "%d", &num) && num >=1 && num <=10)
1026  {
1028  i++;
1029  }
1030  break;
1031  }
1032  case MAKEINT2(f, s):
1033  {
1034  int num = 0;
1035  if(sscanf(param, "%d", &num) && num >=1)
1036  {
1038  i++;
1039  }
1040  break;
1041  }
1042  case MAKEINT1(p):
1043  {
1044  int w =0, h=0;
1045  if(sscanf(param, "%dx%d", &w, &h) == 2 && w >0 && h>0)
1046  {
1049  i++;
1050  }
1051  break;
1052  }
1053  case MAKEINT4(w, i, n, p): //winpos
1054  {
1055  int x =0, y=0;
1056  if(sscanf(param, "%dx%d", &x, &y) == 2)
1057  {
1060  i++;
1061  }
1062  break;
1063  }
1064  case MAKEINT4(d, i, s, p): //display
1065  {
1067  i++;
1068  break;
1069  }
1070  case MAKEINT2(l, m):
1071  {
1072  int num = 0;
1073  if(sscanf(param, "%d", &num) && num >=1000)
1074  {
1076  i++;
1077  }
1078  break;
1079  }
1080  case MAKEINT3(l, m, p):
1081  {
1082  float num = 0.0f;
1083  if(sscanf(param, "%f", &num) && num >=0.001)
1084  {
1086  i++;
1087  }
1088  break;
1089  }
1090  case MAKEINT3(t, c, 2): //downward
1091  case MAKEINT3(t, c, 3):
1092  case MAKEINT2(t, c): //tc
1093  case MAKEINT3(t, c, 1): //
1094  {
1095  switch (opti)
1096  {
1097  case MAKEINT3(t, c, 2): GlobalUtil::_TruncateMethod = 1; break;
1098  case MAKEINT3(t, c, 3): GlobalUtil::_TruncateMethod = 2; break;
1099  default: GlobalUtil::_TruncateMethod = 0; break;
1100  }
1101  int num = -1;
1102  if(sscanf(param, "%d", &num) && num > 0)
1103  {
1105  i++;
1106  }
1107  break;
1108  }
1109  case MAKEINT1(v):
1110  {
1111  int num = 0;
1112  if(sscanf(param, "%d", &num) && num >=0 && num <= 4)
1113  {
1114  SetVerbose(num);
1115  }
1116  break;
1117  }
1118  case MAKEINT4(m, a, x, d):
1119  {
1120  int num = 0;
1121  if(sscanf(param, "%d", &num) && num > 0)
1122  {
1123  GlobalUtil::_texMaxDim = num;
1124  setMaxD = 1;
1125  }
1126  break;
1127  }
1128  case MAKEINT4(m, i, n, d):
1129  {
1130  int num = 0;
1131  if(sscanf(param, "%d", &num) && num >= 8)
1132  {
1133  GlobalUtil::_texMinDim = num;
1134  }
1135  break;
1136  }
1137  default:
1138  break;
1139  }
1140  break;
1141  }
1142  }
1143 
1146 
1147 
1148  //do not write result if there are more than one input images
1149  if(_outpath[0] && _list->size()>1) _outpath[0] = 0;
1150 
1151 }
1152 
1153 void SiftGPU::SetImageList(int nimage, const char** filelist)
1154 {
1155  _list->resize(0);
1156  for(int i = 0; i < nimage; i++)
1157  {
1158  _list->push_back(filelist[i]);
1159  }
1160  _current = 0;
1161 
1162 }
1163 void SiftGPU:: LoadImageList(const char *imlist)
1164 {
1165  char filename[_MAX_PATH];
1166  ifstream in(imlist);
1167  while(in>>filename)
1168  {
1169  _list->push_back(filename);
1170  }
1171  in.close();
1172 
1173 
1174  if(_list->size()>0)
1175  {
1176  strcpy(_imgpath, _list->at(0).data());
1177  strcpy(filename, imlist);
1178  char * slash = strrchr(filename, '\\');
1179  if(slash == 0) slash = strrchr(filename, '/');
1180  if(slash )
1181  {
1182  slash[1] = 0;
1183  chdir(filename);
1184  }
1185  }
1186  _image_loaded = 0;
1187 
1188 
1189 }
1191 {
1192  return _sigma0 * powf( 2.0f, float(lev) / float(_dog_level_num )); //bug fix 9/12/2007
1193 }
1194 
1195 
1196 
1197 void SiftGPUEX::DisplayFeatureBox(int view )
1198 {
1199  view = view%3;
1200  if(view<0)view+=3;
1201  if(view ==2) return;
1202  int idx = 0;
1203  const int *fnum = _pyramid->GetLevelFeatureNum();
1204  const GLuint *vbo = _pyramid->GetFeatureDipslayVBO();
1205  const GLuint *vbop = _pyramid->GetPointDisplayVBO();
1206  if(vbo == NULL || vbop == NULL) return;
1207  //int nvbo = _dog_level_num * _pyramid->_octave_num;
1208  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1209  glEnableClientState(GL_VERTEX_ARRAY);
1210  glPushMatrix();
1211 // glTranslatef(0.0f, 0.0f, -1.0f);
1212  glPointSize(2.0f);
1213 
1214  float scale = 1.0f;
1215  if(_pyramid->_octave_min >0) scale *= (1<<_pyramid->_octave_min);
1216  else if(_pyramid->_octave_min < 0) scale /= (1<<(-_pyramid->_octave_min));
1217  glScalef(scale, scale, 1.0f);
1218 
1219 
1220  for(int i = 0; i < _pyramid->_octave_num; i++)
1221  {
1222 
1223  for(int j = 0; j < _dog_level_num; j++, idx++)
1224  {
1225  if(fnum[idx]>0)
1226  {
1227  if(view ==0)
1228  {
1229  glColor3f(0.2f, 1.0f, 0.2f);
1230  glBindBuffer(GL_ARRAY_BUFFER_ARB, vbop[idx]);
1231  glVertexPointer( 4, GL_FLOAT,4*sizeof(float), (char *) 0);
1232  glDrawArrays( GL_POINTS, 0, fnum[idx]);
1233  glFlush();
1234  }else
1235  {
1236 
1237  //glColor3f(1.0f, 0.0f, 0.0f);
1238  glColor3fv(_colors+ (idx%COLOR_NUM)*3);
1239  glBindBuffer(GL_ARRAY_BUFFER_ARB, vbo[idx]);
1240  glVertexPointer( 4, GL_FLOAT,4*sizeof(float), (char *) 0);
1241  glDrawArrays( GL_LINES, 0, fnum[idx]*10 );
1242  glFlush();
1243  }
1244 
1245  }
1246 
1247  }
1248  glTranslatef(-.5f, -.5f, 0.0f);
1249  glScalef(2.0f, 2.0f, 1.0f);
1250 
1251  }
1252  glPopMatrix();
1253  glDisableClientState(GL_VERTEX_ARRAY);
1254  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1255  glPointSize(1.0f);
1256 
1257 }
1258 
1260 {
1261  _view_debug = !_view_debug;
1262 }
1263 
1264 void SiftGPUEX::DisplayDebug()
1265 {
1266  glPointSize(1.0f);
1267  glColor3f(1.0f, 0.0f, 0.0f);
1269  glBegin(GL_POINTS);
1270  for(int i = 0; i < 100; i++)
1271  {
1272  glVertex2f(i*4.0f+0.5f, i*4.0f+0.5f);
1273  }
1274  glEnd();
1276 }
1277 
1279 {
1281  {
1282  //do nothing
1283  }
1284  else if(!GlobalUtil::CreateWindowEZ())
1285  {
1286 #if SIFTGPU_CUDA_ENABLED
1288 #else
1289  return 0;
1290 #endif
1291  }
1292 
1293  return VerifyContextGL();
1294 }
1295 
1297 {
1298  InitSiftGPU();
1300 }
1301 
1303 {
1305 }
1306 
1307 void SiftGPU::SaveSIFT(const char * szFileName)
1308 {
1309  _pyramid->SaveSIFT(szFileName);
1310 }
1311 
1313 {
1314  return _pyramid->GetFeatureNum();
1315 }
1316 
1318 {
1319 // keys.resize(_pyramid->GetFeatureNum());
1321  {
1322  // descriptors.resize(128*_pyramid->GetFeatureNum());
1323  _pyramid->CopyFeatureVector((float*) (&keys[0]), &descriptors[0]);
1324  }else
1325  {
1326  //descriptors.resize(0);
1327  _pyramid->CopyFeatureVector((float*) (&keys[0]), NULL);
1328  }
1329 }
1330 
1332 {
1334 }
1335 
1337 {
1338  _pyramid->_down_sample_factor = 0;
1339  _pyramid->_octave_min = GlobalUtil::_octave_min_default;
1341  {
1344  }else
1345  {
1348  }
1349  _pyramid->ResizePyramid(width, height);
1350  return _pyramid->_pyramid_height == height && width == _pyramid->_pyramid_width ;
1351 }
1352 
1354 {
1355  if(sz < GlobalUtil::_texMaxDimGL)
1356  {
1358  }
1359 }
1360 
1362 {
1364 }
1365 
1367 {
1369 }
1370 
1372 {
1373  return GlobalUtil::_texMaxDim;
1374 }
1375 
1377 {
1378  return _list->size();
1379 }
1380 
1381 void SiftGPUEX::HSVtoRGB(float hsv[3],float rgb[3] )
1382 {
1383 
1384  int i;
1385  float q, t, p;
1386  float hh,f, v = hsv[2];
1387  if(hsv[1]==0.0f)
1388  {
1389  rgb[0]=rgb[1]=rgb[2]=v;
1390  }
1391  else
1392  {
1394  hh =hsv[0]*6.0f ; // sector 0 to 5
1395  i =(int)hh ;
1396  f = hh- i; // factorial part of h
1398  p= v * ( 1 - hsv[1] );
1399  q = v * ( 1 - hsv[1] * f );
1400  t = v * ( 1 - hsv[1] * ( 1 - f ) );
1401  switch( i ) {
1402  case 0:rgb[0] = v;rgb[1] = t;rgb[2] = p;break;
1403  case 1:rgb[0] = q;rgb[1] = v;rgb[2] = p;break;
1404  case 2:rgb[0] = p;rgb[1] = v;rgb[2] = t;break;
1405  case 3:rgb[0] = p;rgb[1] = q;rgb[2] = v;break;
1406  case 4:rgb[0] = t;rgb[1] = p;rgb[2] = v;break;
1407  case 5:rgb[0] = v;rgb[1] = p;rgb[2] = q;break;
1408  default:rgb[0]= 0;rgb[1] = 0;rgb[2] = 0;
1409  }
1410  }
1411 }
1412 
1413 void SiftGPUEX::GetImageDimension( int &w, int &h)
1414 {
1415  w = _texImage->GetImgWidth();
1416  h = _texImage->GetImgHeight();
1417 
1418 }
1419 
1421 {
1424 }
1425 
1427 {
1428  return new SiftGPU(np);
1429 }
1430 
1432 
1434 {
1435  return new ComboSiftGPU();
1436 }
1437 
std::string filename
int width
int height
#define MAKEINT1(a)
#define _stricmp
Definition: SiftGPU.cpp:64
#define MAKEINT4(a, b, c, d)
SiftGPU * CreateNewSiftGPU(int np)
Definition: SiftGPU.cpp:1426
#define STRING_TO_INT(str)
#define _MAX_PATH
Definition: SiftGPU.cpp:74
#define MAKEINT3(a, b, c)
#define MAKEINT2(a, b)
ComboSiftGPU * CreateComboSiftGPU()
Definition: SiftGPU.cpp:1433
#define NULL
static void InitHighResolution()
Definition: GlobalUtil.cpp:292
int GetImgHeight()
Definition: GLTexImage.h:80
virtual void DrawImage()
Definition: GLTexImage.cpp:346
void BindTex()
Definition: GLTexImage.cpp:159
static void UnbindTex()
Definition: GLTexImage.cpp:164
int GetImgWidth()
Definition: GLTexImage.h:79
static float _FilterWidthFactor
Definition: GlobalUtil.h:56
static int _TruncateMethod
Definition: GlobalUtil.h:74
static int _octave_num_default
Definition: GlobalUtil.h:79
static int _UseSiftGPUEX
Definition: GlobalUtil.h:76
static int _DeviceIndex
Definition: GlobalUtil.h:103
static int _BinarySIFT
Definition: GlobalUtil.h:88
static int _SubpixelLocalization
Definition: GlobalUtil.h:72
static int _octave_min_default
Definition: GlobalUtil.h:78
static float _DescriptorWindowFactor
Definition: GlobalUtil.h:58
static int _timingL
Definition: GlobalUtil.h:47
static int _OrientationPack2
Definition: GlobalUtil.h:60
static int _InitPyramidHeight
Definition: GlobalUtil.h:81
static int _verbose
Definition: GlobalUtil.h:44
static int _WindowInitX
Definition: GlobalUtil.h:100
static int _FixedOrientation
Definition: GlobalUtil.h:84
static float _MulitiOrientationThreshold
Definition: GlobalUtil.h:97
static float _OrientationWindowFactor
Definition: GlobalUtil.h:57
static int _FeatureCountThreshold
Definition: GlobalUtil.h:90
static int _LoweOrigin
Definition: GlobalUtil.h:85
static int _NarrowFeatureTex
Definition: GlobalUtil.h:71
static int _ForceTightPyramid
Definition: GlobalUtil.h:77
static int _texMinDim
Definition: GlobalUtil.h:41
static int _texMaxDim
Definition: GlobalUtil.h:39
static int _UseDynamicIndexing
Definition: GlobalUtil.h:53
static int _KeepExtremumSign
Definition: GlobalUtil.h:89
static GLuint _texTarget
Definition: GlobalUtil.h:37
static int _ExitAfterSIFT
Definition: GlobalUtil.h:86
static int _timingS
Definition: GlobalUtil.h:45
static float _MaxFeaturePercent
Definition: GlobalUtil.h:66
static int _DarknessAdaption
Definition: GlobalUtil.h:92
static int _FitMemoryCap
Definition: GlobalUtil.h:43
static int _MaxLevelFeatureNum
Definition: GlobalUtil.h:67
static int _debug
Definition: GlobalUtil.h:54
static int _WindowInitY
Definition: GlobalUtil.h:101
static int _NormalizedSIFT
Definition: GlobalUtil.h:87
static int _ListGenGPU
Definition: GlobalUtil.h:61
static int _FeatureTexBlock
Definition: GlobalUtil.h:70
static int _usePackedTex
Definition: GlobalUtil.h:48
static int _UseCUDA
Definition: GlobalUtil.h:51
static int _UseOpenCL
Definition: GlobalUtil.h:52
static int _texMaxDimGL
Definition: GlobalUtil.h:40
static int _DescriptorPPT
Definition: GlobalUtil.h:69
static int _KeyPointListForceLevel0
Definition: GlobalUtil.h:91
static int _InitPyramidWidth
Definition: GlobalUtil.h:80
static int _ListGenSkipGPU
Definition: GlobalUtil.h:62
static int _MaxOrientation
Definition: GlobalUtil.h:59
static int _FullSupported
Definition: GlobalUtil.h:65
static int _PreProcessOnCPU
Definition: GlobalUtil.h:82
static int _timingO
Definition: GlobalUtil.h:46
static const char * _WindowDisplay
Definition: GlobalUtil.h:102
static int _GoodOpenGL
Definition: GlobalUtil.h:83
static void SelectDisplay()
Definition: GlobalUtil.cpp:417
static void FitViewPort(int width, int height)
Definition: GlobalUtil.cpp:234
static float GetElapsedTime()
Definition: GlobalUtil.h:129
static void StopTimer()
Definition: GlobalUtil.h:127
static void StartTimer(const char *event)
Definition: GlobalUtil.h:128
static void SetGLParam()
Definition: GlobalUtil.cpp:311
static int CreateWindowEZ()
Definition: GlobalUtil.cpp:458
static void UseShaderDisplayGrad()
Definition: ShaderMan.cpp:224
static void UseShaderDisplayDOG()
Definition: ShaderMan.cpp:211
static void UseShaderDisplayGaussian()
Definition: ShaderMan.cpp:206
static void UnloadProgram()
Definition: ShaderMan.cpp:71
static void UseShaderDisplayKeypoints()
Definition: ShaderMan.cpp:230
static void UseShaderDebug()
Definition: ShaderMan.cpp:293
void GetInitWindowPotition(int &x, int &y)
Definition: SiftGPU.cpp:1420
void RandomizeColor()
Definition: SiftGPU.cpp:109
void DisplaySIFT()
Definition: SiftGPU.cpp:601
void SetView(int view, int sub_view, char *title)
Definition: SiftGPU.cpp:633
SiftGPUEX()
Definition: SiftGPU.cpp:99
void ToggleDisplayDebug()
Definition: SiftGPU.cpp:1259
void GetImageDimension(int &w, int &h)
Definition: SiftGPU.cpp:1413
virtual void ParseParam(int argc, const char **argv)
Definition: SiftGPU.cpp:706
virtual void GetFeatureVector(SiftKeypoint *keys, float *descriptors)
Definition: SiftGPU.cpp:1317
virtual void SetKeypointList(int num, const SiftKeypoint *keys, int keys_have_orientation=1)
Definition: SiftGPU.cpp:355
int GetMaxDimension()
Definition: SiftGPU.cpp:1371
virtual int VerifyContextGL()
Definition: SiftGPU.cpp:1296
SiftGPU(int np=1)
Definition: SiftGPU.cpp:84
virtual void SaveSIFT(const char *szFileName)
Definition: SiftGPU.cpp:1307
virtual void SetTightPyramid(int tight=1)
Definition: SiftGPU.cpp:1331
virtual int RunSIFT()
Definition: SiftGPU.cpp:273
static void PrintUsage()
Definition: SiftGPU.cpp:658
virtual int AllocatePyramid(int width, int height)
Definition: SiftGPU.cpp:1336
virtual void SetImageList(int nimage, const char **filelist)
Definition: SiftGPU.cpp:1153
virtual void SetVerbose(int verbose=4)
Definition: SiftGPU.cpp:370
void InitSiftGPU()
Definition: SiftGPU.cpp:129
int GetMaxOrientation()
Definition: SiftGPU.cpp:1366
virtual void SetMaxDimension(int sz)
Definition: SiftGPU.cpp:1353
virtual int IsFullSupported()
Definition: SiftGPU.cpp:1302
virtual int GetImageCount()
Definition: SiftGPU.cpp:1376
virtual int CreateContextGL()
Definition: SiftGPU.cpp:1278
void LoadImageList(const char *imlist)
Definition: SiftGPU.cpp:1163
virtual ~SiftGPU()
Definition: SiftGPU.cpp:119
int GetFeatureCountThreshold()
Definition: SiftGPU.cpp:1361
virtual int GetFeatureNum()
Definition: SiftGPU.cpp:1312
float GetInitialSmoothSigma(int octave_min)
Definition: SiftGPU.cpp:415
int _dog_level_num
Definition: SiftGPU.h:85
void ParseSiftParam()
Definition: SiftGPU.cpp:423
float _dog_threshold
Definition: SiftGPU.h:93
float GetLevelSigma(int lev)
Definition: SiftGPU.cpp:1190
float _edge_threshold
Definition: SiftGPU.h:95
int min(int a, int b)
Definition: cutil_math.h:53
int max(int a, int b)
Definition: cutil_math.h:48
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
Definition: Eigen.h:85
CorePointDescSet * descriptors
double timer
Definition: struct.h:215