evlasblom / cuda-opencv-examples

Using custom CUDA kernels with Open CV Mat objects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CUDA & Open CV Examples

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.

Content

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:

  1. hello.cu: our first kernel.
  2. add.cu: basic kernel for parallel additions.
  3. ptp.cu: smart usage of pointers on the device.

Image Processing Kernels:

  1. bgrtogray.cu: our first image processing kernel.
  2. invert_1.cu: image invert using low-level operations.
  3. invert_2.cu: image invert using high-level Open CV objects.

Advanced Usage:

  1. diff_1.cu: image differencing using high-level Open CV objects.
  2. diff_2.cu: image differencing with smart usage of pointers.
  3. conversions.cpp: conversions between high-level Open CV objects.
  4. diff_proper.cu: including the kernel template and operation overloading.
  5. split.cu: image splitting by combining predefined and custom kernels.

Requirements

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.

Building

To build the examples is done as follows.

cd build
cmake ..
make

About

Using custom CUDA kernels with Open CV Mat objects.


Languages

Language:Cuda 89.2%Language:CMake 6.1%Language:C++ 4.6%