Canny-GPU-CUDA-implementation

所属分类:GPU/显卡
开发工具:Cuda
文件大小:4561KB
下载次数:0
上传日期:2022-01-26 19:36:25
上 传 者sh-1993
说明:  Canny边缘检测器的CUDA实现。
(CUDA implementation of Canny edge detector in C C++.)

文件列表:
CMakeLists.txt (881, 2022-01-27)
CannyGPU.cu (13177, 2022-01-27)
CannyGPU.cuh (444, 2022-01-27)
CudaTimer.cu (462, 2022-01-27)
CudaTimer.cuh (506, 2022-01-27)
GaussianFilter.cu (4438, 2022-01-27)
GaussianFilter.cuh (333, 2022-01-27)
SM_Loader.cu (1689, 2022-01-27)
SM_Loader.cuh (312, 2022-01-27)
images (0, 2022-01-27)
images\butterfly.jpg (119546, 2022-01-27)
images\car.jpg (988142, 2022-01-27)
images\chessboard.jpg (447883, 2022-01-27)
images\circles.png (18917, 2022-01-27)
images\dog.jpg (161659, 2022-01-27)
images\f1.jpg (528569, 2022-01-27)
images\land.jpg (551537, 2022-01-27)
images\night.jpeg (52591, 2022-01-27)
images\oc.png (20779, 2022-01-27)
images\output_test (0, 2022-01-27)
images\output_test\chess_custom.jpg (260860, 2022-01-27)
images\output_test\chessboard.jpg (447883, 2022-01-27)
images\output_test\circles.png (18917, 2022-01-27)
images\output_test\circles_custom.jpg (17650, 2022-01-27)
images\output_test\oc.png (20779, 2022-01-27)
images\output_test\oc_imp_GPU_custom.jpg (20784, 2022-01-27)
images\people.jpeg (49409, 2022-01-27)
images\poke.png (81293, 2022-01-27)
images\quad.jpeg (25217, 2022-01-27)
images\test (0, 2022-01-27)
images\test\cpu_vs_gpu_high2.jpg (478423, 2022-01-27)
images\test\kernel_call_720_high.jpg (392695, 2022-01-27)
images\test\kernel_config_high.jpg (467496, 2022-01-27)
images\universe.jpg (100578, 2022-01-27)
main.cpp (3620, 2022-01-27)
utility.cpp (630, 2022-01-27)
utility.hpp (282, 2022-01-27)

# 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 | :-------------------------:|:-------------------------: | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/oc.png) | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/oc_imp_GPU_custom.jpg) | Original | Canny GPU Output | :-------------------------:|:-------------------------: | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/circles.png) | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/circles_custom.jpg) | Original | Canny GPU Output | :-------------------------:|:-------------------------: | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/chessboard.jpg) | ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/output_test/chess_custom.jpg) **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 | :-------------------------:| ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/test/kernel_config_high.jpg) ## 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 | :-------------------------:| ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/test/kernel_call_720_high.jpg) ## CPU v.s. GPU This is the comparison analysis between the OpenCV CPU version and my parallel version on GPU. | CPU v.s. GPU | :-------------------------:| ![](https://github.com/Dantekk/Canny-GPU-CUDA-implementation/blob/main/images/test/cpu_vs_gpu_high2.jpg) 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.

近期下载者

相关文件


收藏者