No description, website, or topics provided.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build readme and master cmake file Jan 26, 2016
cmake mex interface, VS settings Jun 12, 2017
doc import old svn repo + history, delete unused files Jul 30, 2016
src
tests use Anaconda environment for python if available. Feb 5, 2018
.gitignore improved ndarray_io -- saving shape too Apr 3, 2017
.gitlab-ci.yml Update .gitlab-ci.yml to reflect removal of christianR's pc from the … May 8, 2017
CMakeLists.txt collected arch=sm* settings into one file Jun 8, 2017
ImageUtilitiesConfig.cmake collected arch=sm* settings into one file Jun 8, 2017
LICENSE added licence Jul 27, 2016
README.md Update README.md May 9, 2017
iu_settings.cmake.txt collected arch=sm* settings into one file Jun 8, 2017

README.md

ImageUtilities - Bridge the gap between CPU and GPU

Installation

  • Set up environment variable COMPUTE_CAPABILITY with the compute capability of your CUDA-enabled GPU (https://en.wikipedia.org/wiki/CUDA)

  • Set up environment variable CUDA_SDK_ROOT_DIR to point to the NVidia CUDA examples

  • IMPORTANT: Set up environment variable IMAGEUTILITIES_ROOT to point to the path of this directory

  • To use the matlab wrapper, set up environment vaiable MATLAB_ROOT to point to matlab root directory

To build simply perform the following steps:

$ cd build
$ cmake ..
$ make
$ make install

The iugui module needs QT5 (>=5.6), the iuio module OpenCV 2.4 or 3.x.

Documentation

A pre-built documentation is available here. To build the documentation on your own (requires doxygen), additionally do

$ make apidoc

Usage

In your cmake-based project include the following lines

set(ImageUtilities_DIR $ENV{IMAGEUTILITIES_ROOT})
find_package(ImageUtilities REQUIRED COMPONENTS iucore)
include_directories(${IMAGEUTILITIES_INCLUDE_DIR})

and link your application with

target_link_libraries(your_application
  your_libraries
  ${IMAGEUTILITIES_LIBRARIES}
)

Example

Image Utilities take away the hassle of memory management when dealing with CUDA code. The follwing code snippet shows a simple example of image manipulation using CUDA:

// read two images from files
iu::ImageGpu_32f_C1 *I1 = iu::imread_cu32f_C1(DATA_PATH("army_1.png"));
iu::ImageGpu_32f_C1 *I2 = iu::imread_cu32f_C1(DATA_PATH("army_2.png"));
// allocate memory for the output
iu::ImageGpu_32f_C1 result(I1->size());

// Add 0.5 to the first image and save the result
iu::math::addC(*I1,0.5,result);
iu::imsave(&result,RESULTS_PATH("army_1_bright.png"));

// Subtract one image from the other and save the result
iu::math::addWeighted(*I1,1,*I2,-1,result);
iu::imsave(&result,RESULTS_PATH("army_1_minus_2.png"));

They also make it easy to use images in CUDA kernels by providing additional information about the image that can be easily passed to kernels. Host code:

iu::ImageGpu_32f_C1 img(320,240);

dim3 dimBlock(16, 16);
dim3 dimGrid(iu::divUp(img.width(), dimBlock.x), img.height(), dimBlock.y);

test_kernel <<< dimGrid, dimBlock >>> (img);

and the device code:

__global__ void test_kernel(iu::ImageGpu_32f_C1::KernelData img)
{
    int x = blockIdx.x*blockDim.x + threadIdx.x;
    int y = blockIdx.y*blockDim.y + threadIdx.y;

    if (x < img.width_ && y < img.height_)
    {
        img(x,y) = x+y;
    }
}