Skip to main content
Log in

MinGPU: a minimum GPU library for computer vision

  • Original Research Paper
  • Published:
Journal of Real-Time Image Processing Aims and scope Submit manuscript

Abstract

In the field of computer vision, it is becoming increasingly popular to implement algorithms, in sections or in their entirety, on a graphics processing unit (GPU). This is due to the superior speed GPUs offer compared to CPUs. In this paper, we present a GPU library, MinGPU, which contains all of the necessary functions to convert an existing CPU code to GPU. We have created GPU implementations of several well known computer vision algorithms, including the homography transformation between two 3D views. We provide timing charts and show that our MinGPU implementation of homography transformations performs approximately 600 times faster than its C++ CPU implementation.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2

Similar content being viewed by others

References

  1. Adelson, E.H., Anderson, C.H., Bergen, J.R., Burt, P.J., Ogden, J.M.: Pyramid methods in image processing. RCA Eng. 29(6), 33–41 (1984)

    Google Scholar 

  2. Buck, I., Foley, T., Horn, D., et al.: Brook for GPUs: stream computing on graphics hardware. ACM. Trans. Graph. 23(3), 777–786 (2004)

    Article  Google Scholar 

  3. BrookGPU source code: http://brook.sourceforge.net

  4. Colantoni, P., Boukala, N., Da Rugna, J.: Fast and accurate color image processing using 3D Graphics Cards. In: Vision, Modeling and Visualization Conference (VMV) (2003)

  5. Computer Vision on the GPU: http://openvidia.sourceforge.net/papers.shtml.

  6. Cg Toolkit User’s Manual. (2005)

  7. Cg Toolkit: http://developer.nvidia.com/object/cg_toolkit.html

  8. Fung, J.: GPU Gems 2, chapter Computer Vision on the GPU. Addison Wesley, pp. 649–666 (2005)

  9. Fung, J., Mann, S., Aimone, C.: OpenVidia: parallel GPU computer vision. Proceedings of ACM Multimedia, pp. 849–852 (2005)

  10. Göddeke, D.: Online tutorial on GPGPU. http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html

  11. Govindaraju, N.K., Manocha, D.: Cache-efficient numerical algorithms using graphics hardware. UNC Technical Report (2007)

  12. Govindaraju, N.K., Larsen, S., Gray, J., Manocha, D.: A memory model for scientific algorithms on graphics processors. UNC Technical Report (2006)

  13. Han, Y., Wagner, R.A.: An efficient and fast parallel-connected component algorithm. J. ACM. 37 (3), 626–642 (1990)

    Google Scholar 

  14. Heymann, S., Müller, K., Smolic, A., Fröhlich, B., Wiegand, T.: SIFT implementation and optimization for general-purpose GPU. In: International Conference on Computer Graphics, Visualization and Computer Vision (WSCG) (2007)

  15. Khan, S.M., Yan, P., Shah, M.: A homographic framework for the fusion of multi-view Silhouettes. In: International Conference on Computer Vision, Rio de Janeiro, Brazil (2007)

  16. Labatut, P., Keriven, R., Pons, J-P.: Fast level set multi-view stereo on graphics hardware. In: 3rd International Symposium on 3D Data Processing, Visualization and Transmission (3DPVT), pp. 774–781 (2006)

  17. MinGPU source and technical report (case-sensitive): www.cs.ucf.edu\~vision\MinGPU

  18. Moreland, K., Angel, E.: The FFT on GPU. SIGGRAPH, pp. 112–119 (2003)

  19. NVIDIA GeForce 8800 GPU Architecture Overview. nVidia Technical brief (2006). www.nvidia.com/object/IO_37100.html

  20. NVIDIA CUDA Programming Guide 1.1. http://www.nvidia.com/object/cuda_home.html.

  21. OpenVIDIA GPU computer vision library. http://openvidia.sourceforge.net

  22. Ohmer, J., Maire, F., Brown, R.: Implementation of Kernel methods on the GPU. In: Proceedings 8th International Conference on Digital Image Computing: Techniques and Applications (DICTA). pp. 543–550 (2005)

  23. RapidMind development platform and documentation, http://www.rapidmind.net/.

  24. Rumpf, M., Strzodka, R.: Level set segmentation in graphics hardware. In: Proc. IEEE Int. Conf. Image Process. 3, 1103–1106 (2001)

  25. Sh GPU metaprogramming library: http://www.libsh.org/

  26. Yang, R., Pollefeys, M.: Multi-resolution real-time stereo on commodity graphics hardware. IEEE Comp. Vis. Pattern Recog. 211–218 (2003)

  27. Yang, R., Welch, G.: Fast image segmentation and smoothing using commodity graphics hardware. J. Graph. Tools 7(4), 91–100 (2002)

    Google Scholar 

Download references

Acknowledgments

We wish to express our gratitude for all the help we received in writing of this paper. We would like to thank Andrew Miller for his useful advice and help on GPU programming. The dataset and method of homography transformations was provided courtesy of Saad M. Khan. UAV IR dataset was provided courtesy of VACE CLEAR evaluation.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pavel Babenko.

Appendices

Appendix 1: MinGPU library

1.1 1. MinGPU class structure

MinGPU class structure is intentionally made as straightforward and small as possible. MinGPU contains two classes, Array and Program. Class Array defines an array, a texture, in GPU memory, while class Program defines a program in GPU memory. The library also includes the MinGPUInit() function, which is implicitly called when first MinGPU class is instantiated.

1.2 2. MinGPU methods. Class array

Class Array has three methods: Create, CopyToGPU, and CopyFromGPU.

bool Array::Create(float *pData, unsigned int dwCols, unsigned int dwRows, BYTE bMode)

This method defines a new array in GPU memory. The Create method is supplied with a pointer to an array as well as the number of columns and rows in this array. pData must either point to an allocated space of dwCols by dwRows size, or be null if the array we define will never be copied to the GPU memory. If this array is copied from the GPU memory and pData is null, then an array is created. The last parameter, bMode, specifies whether the array will be created in luminance or color mode. Note that array data from pData is not transferred to GPU in this method; it is done later, if needed, by the use of CopyToGPU method.

bool Array::CopyToGPU()

This method copies array data from computer memory to GPU.

bool Array::CopyFromGPU()

This method copies array data from GPU to computer memory.

1.3 3. MinGPU methods. Class program

Class Program has three methods: Create, SetParameter, and Run.

bool Program::Create(char *szFilename, char *szEntryPoint)

This method creates and, if needed, compiles a new Cg program. The program is stored in the external file szFilename. szEntryPoint holds the name of the entry function in the program. Programs files must be located either in working directory or in the ‘scripts’ subfolder. Files with ‘asm’ extension are presumed to contain pre-compiled binary programs; otherwise the file contains a source code which needs to be compiled. This function searches the folder for a binary program corresponding to the source code. If it is found and it has a timestamp later than the source file, it is loaded instead. Otherwise, the source code is compiled and stored as binary code in a file with ‘asm’ extension in the same folder. This eliminates the need to recompile a program each time it is loaded, which eliminates a 300–600 ms delay.

bool Program::SetParameter(int nType, char *szName, void *pValue)

Most functions in Cg programs have input parameters. For instance, we have to specify the input parameters for the entry function before we execute a program. Parameters can be values, arrays, matrices, or textures. Enumerator nType specifies the type and number format of the input parameter, string szName contains its Cg program name and pValue holds the parameter value.

Besides the parameters we set with the SetParameter method, functions may have parameters which refer to pre-defined names [6]. For example, a parameter which refers to name TEXCOORD0 will automatically receive the row and column values for the currently processed pixel.

bool Program::Run(Array *output)

This method executes a Cg program on the GPU. Array output accepts the output of this program; it is filled as a result of program execution. The program is run separately for every cell in the array output. A new value is generated for every cell in this array.

All methods in classes Array and Program return true if successful and false otherwise.

1.4 4. Library structure, installation, and required libraries

The MinGPU library consists of four Visual Studio projects. The first project, MinGPU, contains the MinGPU library. Computer vision algorithms done on MinGPU reside in the Vision project. There is also a helper project, Math, which contains math functions used in the Vision project. These three projects generate C++ libraries on compilation. The fourth project, GPUTest, serves as a test bed for these three libraries. It generates executable code on compilation. GPUTest contains examples for all computer vision algorithms in the Vision project.

Before using MinGPU, three other libraries must be downloaded from internet and installed. These are Cg Toolkit [7], OpenGL Utility Toolkit (GLUT) and OpenGL Extensions (GLEW). A description of where to download those libraries and how they are useful in GPU computing can be found at [10]. OpenGL 2.0 drivers are supplied with Windows XP and it is important to install these also.

Appendix 2: Source listings

figure b
figure c
figure d

Rights and permissions

Reprints and permissions

About this article

Cite this article

Babenko, P., Shah, M. MinGPU: a minimum GPU library for computer vision. J Real-Time Image Proc 3, 255–268 (2008). https://doi.org/10.1007/s11554-008-0085-x

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11554-008-0085-x

Keywords

Navigation