SiftGPU

点击打开链接

SiftGPU: A GPU Implementation of Scale Invariant Feature Transform (SIFT)

Changchang Wu

University of North Carolina at Chapel Hill

VisualSFM with integration of SiftGPU and Multicore Bundle Adjustment
Multicore Bundle Adjustment for GPU and CPU is now available
* Last update on 2/7/2012 (Bugfix: update maximum texture dimension for CUDA-based SiftMatchGPU). 
* 4/30/2012, Mac OSX patch 
to ProgramGLSL.cpp provided by Roy Shilkrot: ProgramGLSL.cpp.patch 

SIFT Implementation

SiftGPU is an implementation of SIFT [1] for GPU. SiftGPU processes pixels parallely to build Gaussian pyramids and detect DoG Keypoints. Based on GPU list generation[3], SiftGPU then uses a GPU/CPU mixed method to efficiently build compact keypoint lists. Finally keypoints are processed parallely to get their orientations and descriptors.

SiftGPU is inspired by Andrea Vedaldi's sift++[2] and Sudipta N Sinha et al's GPU-SIFT[4. Many parameters of sift++ ( for example, number of octaves, number of DOG levels, edge threshold, etc) are also available in SiftGPU. The shader programs are dynamically generated according to the parameters that user specified.

SiftGPU also includes a GPU exhaustive/guided sift matcher SiftMatchGPU. It basically multiplies the descriptor matrix on GPU and finds the closest feature matches on GPU. Both GLSL and CUDA implementations are provided. 

Requirements

SiftGPU requires a decent GPU that has a large graphic memory and supports dynamic branching. GLSL is used by default, and CUDA is provided as an alternative for nVidia graphic cards.

SiftGPU uses GLEW 1.51, DevIL1.77 (can be disabled), GLUT(only by the viewer), and CUDA(optional). You'll need to make sure that your system has all the depending libraries of corresponding versions. To update the libraries, you'll need to replace the header files in SiftGPU\Include\, and the corresponding binaries.

NOTE FOR CUDA : 1. The thread block setting is currently tuned on nVidia GTX 8800. It may not be optimized for other GPUs. 2. The CUDA version is not compiled by default. You need to define CUDA_SIFTGPU_ENABLED to the compiler and recompile the package. For VS2010 users, you can just use SiftGPU_CUDA_Enabled solution. 

Download

SiftGPU-V382 (5.0MB; Including code, manual , windows binary and some test images) Want to cite SiftGPU? 
VisualSFM: an integrated SFM system based on SiftGPU and Multicore Bundle Adjustment
Mac OSX patch to ProgramGLSL.cpp provided by Roy Shilkrot: ProgramGLSL.cpp.patch 
You might be interested in the Matlab Versions mex'd by Adam Chapman and by Parag. K. Mital 
* For commercial licensing, please contact Trude Amick (trude_amick@unc.edu, 919-843-7415)

SimpleSIFT.cpp gives some examples of using SiftGPU and SiftMatchGPU. 

NOTICE: download V382 or do the follow to fix a minor bug (2/7/2012)
please add "GlobalUtil::_texMaxDimGL = 32768;" after L1373 of ProgramCU.cu 
In V370-V381, the maximum texture dimension is not properly updated from hardware. 

List of recent changes (complete listprevious versions
  * Really fixed the bug in CUDA-version Fundamental-matrix guided SIFT matching (12/04/2011)
  * Automatic reduction of working dimension according to GPU memory cap (8/2011)
  * Fixed the orientation GLSL function that may have problem with new nVidia driver (7/2011)
  * Modified some GLSL code for ATI and tested on a real ATI card (7/2011)
  * Converted the MSVC Solution to Visual Studio V2010 and tested CUDA4 (6/2011)
  * Automatic switching from OpenGL to CUDA when OpenGL is not supported (1/2011)
  * Dropped the indirect data transfer path CPU->GL->CUDA (1/2011) 

Some previous changes  
  6. Added device selection for Multi-threading (Check the example atMultiThreadSIFT.cpp). 
  5. Used SSE to speedup the descriptor normalization step for the OpenGL implementation.  
  4. Added CUDA-based SiftGPU/SiftMatchGPU implementation. See Figure below for the speed.  
  3. Added OpenGL-based sift matching implementation, check example #7 in manual. (Thanks to Zach) 
  2. Added function to compute descriptors for user-specified keypoints, check example #6 in manual
  1. Improved speed by %50 compared with V293. Look here for experiment details andexplanations


Evaluation

Below is the evaluation of the speed of V340 on different image sizes. "-fo -1" means using upsampled image. "-glsl" uses GLSL and "-cuda" uses CUDA (The experiment images are all resized from this image) .  

 System : nVidia 8800GTX, 768MB, Driver 182.08, Windows XP, Intel 3G P4 CPU, 3.5G RAM. (V311 Speed

Below is the comparision with Lowe's SIFT on box.pgm using the comparison code fromVedaldi's SIFT .

References

[1]   D. G. Lowe. Distinctive image features from scale-invariant keypoints . International Journal of Computer Vision, November 2004. 
[2]   A. Vedaldi. sift++, http://vision.ucla.edu/~vedaldi/code/siftpp/siftpp.html.
[3]   G. Ziegler, et al. GPU point list generation through histogram pyramids. In Technical Report, June 2006. 
[4]   Sudipta N Sinha, Jan-Michael Frahm, Marc Pollefeys and Yakup Genc, "GPU-Based Video Feature Tracking and Matching ", 
        EDGE 2006, workshop on Edge Computing Using New Commodity Architectures, Chapel Hill, May 2006


SIFTGPU是一个用于实现尺度不变特征变换(Scale-Invariant Feature Transform,SIFT)的GPU加速库。下面是一些基本的使用教程: 1. 安装SIFTGPU:你可以从 https://github.com/pitzer/SIFTGPU 下载SIFTGPU的源代码。根据该项目中的安装说明,编译并安装SIFTGPU库。 2. 导入SIFTGPU库:在你的项目中,导入SIFTGPU库的头文件,并链接SIFTGPU的库文件。 3. 初始化SIFTGPU:在你的代码中,使用以下代码初始化SIFTGPU: ```cpp #include <GL/glew.h> #include <GL/glut.h> #include <SiftGPU.h> SiftGPU sift; int width = 640, height = 480; int main(int argc, char *argv[]) { // 初始化OpenGL上下文 glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(width, height); glutCreateWindow("SIFTGPU"); // 初始化SIFTGPU if (sift.CreateContextGL() != SiftGPU::SIFTGPU_FULL_SUPPORTED) { printf("SIFTGPU is not supported!\n"); return 1; } // 设置SIFTGPU参数 sift.SetVerbose(true); sift.SetOuputFormat(SiftGPU::SIFTGPU_SIFT); sift.VerifyContextGL(); // ...其他操作 return 0; } ``` 4. 加载图像数据:使用以下代码将图像数据传递给SIFTGPU进行处理: ```cpp // 设置图像尺寸 sift.SetImageSize(width, height); // 加载图像数据 unsigned char* imageData = new unsigned char[width * height * 3]; // ...从文件或其他方式获取图像数据并存储到imageData中 // 传递图像数据给SIFTGPU sift.RunSIFT(width, height, imageData, GL_RGB, GL_UNSIGNED_BYTE); ``` 5. 提取特征点:使用以下代码提取图像中的特征点: ```cpp int numFeatures = sift.GetFeatureNum(); // 为特征点分配内存 float* featureData = new float[numFeatures * 128]; // 提取特征点 sift.GetFeatureVector(featureData); // 遍历特征点并进行处理 for (int i = 0; i < numFeatures; ++i) { // 获取特征点的关键信息(位置、尺度、方向等) SiftGPU::SiftKeypoint& keypoint = sift.GetFeature(i); // ...在这里可以对每个特征点进行处理 } // 释放内存 delete[] featureData; ``` 这只是一个简单的SIFTGPU使用教程,更详细的用法可以参考SIFTGPU的文档和示例代码。希望对你有帮助!如果你有更多问题,可以继续问我。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值