This is the CPU and GPU(based on Opencl) implementation of canny edge detection for High Performance Computing with Graphic Cards praktikum.
Canny edge detection consists of 5 steps.
- Gaussian Filter
- Sobel Filter
- Non-Max Suppression
- Double Threshold
- Hysteresis edge tracking
Here is how you can use this code to determine edges in the images and the intermediate results.
Instructions to run this code in Visual Studio
- Download NVIDIA CUDA Toolkit from https://developer.nvidia.com/cuda-downloads
- Download Boost library from https://sourceforge.net/projects/boost/files/boost-binaries/1.76.0_b1/boost_1_76_0_b1-msvc-14.2-64.exe
- Download the Canny_edge_detection_opencl project from the github.
- In the CMakeLists.txt change the boost include directory and boost library directory to system include folder.
- set(BOOST_INC "C:/local/boost_1_76_0_b1_rc2")
- set(BOOST_LIB "C:/local/boost_1_76_0_b1_rc2/lib64-msvc-14.2")
- Open Visual Studio-> Choose "Open a local folder" -> and select "Canny_edge_detection_opencl" folder.
- CMake generation will automatically start.
- Build the project (Ctrl + Shift + B)
- In the solution explorer Choose "Switch between solutions and the available views" Choose "CMake Targets View" Expand "CannyEdgeDetection Project" Configure the "CannyEdgeDetection (executable)" as a startup item.
- Execution is started by clicking "CannyEdgeDetection.exe" play button.
- For each of these steps, a CPU and GPU output image will be generated and saved in out/build/x64-Debug.
- Different sample examples are placed in the images directory (src/InputImages).
- To run different example set we have to change the image name in the CannyEdgeDetection.cpp source file.
- Rebuid the project and execute.