Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imgcuda

Overview

This is a CUDA-accelerated image processing library that applies filters to P6 PPM files.

The program also produce timing report on average time for:

  • Host to Device Copy
  • Kernel Execution
  • Device to Host Copy

Verification mode compares the output of the GPU version against an CPU computed version for verification and reports the number of mismatched pixels, if any.

How To Compile

Included in this program is a make file.

To compile run

~$ make

running make will compile the programs object files into the folder /build and the executable imgtool will be in /bin

To clean run

~$ make clean

How to run

It is recommended that you run this program from the root of this repository

~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter <name> [options]

Note: If running from the root it is recommended to store images in the test folder.

Filters

  • drop_red
  • drop_green
  • drop_blue
  • sharpen
  • blur
  • sobel_x
  • sobel_y

Options

  • --runs {int}
    • runs takes an int as an options and specifies how many to run the filter for performance reporting
  • --radius {int}
    • This is an option for the blur filter that specifies the radius of the blur
  • --verify
    • This runs a verification mode the check the GPU output against a CPU version of the filter and reports any mismatched pixels

Run Examples

~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter blur --radius 4 --verify
~$ ./bin/imgtool ./tests/input.ppm output.ppm --filter sobel_x --runs 20

Boundary Strategy

The boundary strategy used is mirroring on the edges. If we are on a pixel on row0 and getting its neighbor row-1 this is an invalid pixel so instead both of those pixels will access row0.

int curRow = min(height-1, max(0, row + blurRow));
int curCol = min(width-1,  max(0, col + blurCol));          

The outputs are then clamped

outImage[trueRGBOffset] = (unsigned char)(min(255, max(0, greyscaleVal)));
outImage[trueRGBOffset + 1] = (unsigned char)(min(255, max(0, greyscaleVal)));
outImage[trueRGBOffset + 2] = (unsigned char)(min(255, max(0, greyscaleVal)));

Design Notes

The Program access pixels as a 1D array and then gets the RGB channels

This is AoS, Array of Structures as it is an array of Pixels(a structure)

This program does not use shared memory and opts to use manual memory copy to allow for timing memory copies.

Test Images

There are two test images supplied in this repository lenna.ppm and DJ.ppm

Both are portraits suited to testing of the filters

About

CUDA accelerated image processing library with CLI tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages