Project that sharpen images using cuda and c++
Ensure that you have c++, nvcc and cuda libraries installed.
Requirement :
- opencv 4.8.0
- microsoft visual studio 2022
- CMake 3.26.6
- CUDA Toolkit 12.1
Installation :
- First check the Requirements and make sure vscode has been installed all the estensions involving c/c++, cmake, code runner,..
- Delete build folder
- Press Ctrl, shift + p and select cmake INIT project, do the typing.
- In CMakeLists.txt, make sure the correct folder name is being filled.
- In CMakeLists.txt, in add_executable,you can change which one to run, just make sure do not let GPU and CPU uncomment at the same time.
- Press Launch and enjoy.
File (make sure you change the input and output path):
- Run code by GPU grayscale--> gpu.cu
- Run code by CPU grayscale--> cpu.cpp
- Run code by GPU color--> color/gpuColor.cu
- Run code by CPU color--> color/cpuColor.cpp
- Run images comparison --> mainCompare.cpp
CMake the project using Cmake accorfing to your c/c++ version and CUDA_ARCHITECTURES
set_property(TARGET my_target PROPERTY "${CUDA_ARCH_LIST}")
The code is based on https://www.researchgate.net/publication/307695773_Optimizing_Image_Sharpening_Algorithm_on_GPU
this code is based on RTX 2060 so i set default block size = 32. You can change accordingly based on this Wiki