GithubHelp home page GithubHelp logo

dantekk / canny-gpu-cuda-implementation Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 4.25 MB

CUDA implementation of Canny edge detector in C/C++.

CMake 3.29% Cuda 79.78% C++ 16.93%
canny-edge-detection cuda cuda-programming gpu-programming image-processing c-programming c-plus-plus

canny-gpu-cuda-implementation's Introduction

Canny-GPU

CUDA implementation of Canny edge detector in C/C++.
You can use cmake to compile the files. I have made a CMakeLists available for compilation.

Run the code

I have made available a main file that executes the code.
In particular, these are the parameters to be given on the command line:

./main argv[1] argv[2] argv[3] argv[4] argv[5] argv[6]

where :

  • argv[1] : input image path
  • argv[2] : kernel size of Sobel
  • argv[3] : low threshold for Hysteresis step
  • argv[4] : high threshold for Hysteresis step
  • argv[5] : L2 norm -> 0 activated 1 deactivated (uses approximation with abs)
  • argv[6] : modes -> [0] CPU , [1] GPU custom (my implementation) , [2] Runs all modes. With [0] run OpenCV Canny CPU while with [1] run Opencv GPU. At last, with [2] run both.

During the execution of the algorithm, the execution times are also calculated, expressed in ms.

Results example

Examples of image output of my Canny GPU version.

Original Canny GPU Output
Original Canny GPU Output
Original Canny GPU Output

N.B: obviously, the results may vary according to the value chosen for the thresholds in the hysteresis step.

Kernel config

I tried several kernel configurations but the one that gave the best results was the one where I used a thread block size of 16x16.

Kernel Configuration

Kernel time esecution

This is the pie chart showing the execution times of the various kernel device function and data transfer memcpy routines on 720p image resolution.

Kernel time esec

CPU v.s. GPU

This is the comparison analysis between the OpenCV CPU version and my parallel version on GPU.

CPU v.s. GPU

As you can see from the graph, with a low resolution image the results of the two versions are similar. As the image resolution increases, the parallel version gets significantly better results.

canny-gpu-cuda-implementation's People

Contributors

dantekk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

weixi234 sureiron

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.