Many examples exist for using ready-to-go CUDA implementations of algorithms in Open CV. But what if you want to start writing your own CUDA kernels in combination with already existing functionality in Open CV? This repository demonstrates several examples to do just that. Before doing so, it is recommended to at least go through the first half of the CUDA basics. More information is provided in the comments of the examples.
The examples start out simple with an empty kernel and gradually become more difficult until the point where we are able to manipulate vectors of Open CV Mat objects on the GPU. It is recommended to go through them in the order as presented below.
Basic Kernels:
- hello.cu: our first kernel.
- add.cu: basic kernel for parallel additions.
- ptp.cu: smart usage of pointers on the device.
Image Processing Kernels:
- bgrtogray.cu: our first image processing kernel.
- invert_1.cu: image invert using low-level operations.
- invert_2.cu: image invert using high-level Open CV objects.
Advanced Usage:
- diff_1.cu: image differencing using high-level Open CV objects.
- diff_2.cu: image differencing with smart usage of pointers.
- conversions.cpp: conversions between high-level Open CV objects.
- diff_proper.cu: including the kernel template and operation overloading.
- split.cu: image splitting by combining predefined and custom kernels.
These examples require Open CV and CUDA to be installed on your system. Additionally, CMake is required for building. The examples were tested with Open CV 3.2, CUDA 8.0 on Ubuntu 14.04 LTS.
To build the examples is done as follows.
cd build
cmake ..
make