This project is a CUDA-acclerated Harris Corner Detector based on Corner-Detector. We implemented the project using C/C++ with i7-7700 and RTX 2080Ti.
Here is the directory tree structure for the project.
├── input
│ └── image.ppm // input images(should be ppm format)
├── Makefile
├── output
│ └── ... // output images
├── README.md
└── source
├── CornerDetector.cu // main part of the project
├── GaussFilter.cuh // CUDA header file of gaussian filter
├── Gauss.h // header file of gaussian filter
├── Matrix.h // header file of class Matrix
├── PPM.h // header file to deal with portable pixmap format (PPM) image
├── SobelFilter.cuh // CUDA header file of sobel filter
├── Sobel.h // header file of sobel filter
├── utils.h // other utilities
└── VectorOperation.cuh // CUDA header file of vector operation
Put your images into the ./input
folder. Please note that the image must be .ppm
format. With linux you can convert the image format using
convert image.jpg image.ppm
here is an example to run the code.
you can just use make
command, or
nvcc CornerDetector.cu -o CornerDetector
There are four parameter to assign.
./CornerDetector <imagePath> <gaussMask=size> <tpb=threadsPerBlock> <sigma=doubleValue>
example
./CornerDetector ./input/IMG_0125.ppm
To compare the perfomance between CPU and GPU, we perform our Harris Corner Detector on a image of size 3648x5472, and the comparison results shown in Table 1. We could see that the GPU version is much faster the CPU version.
CPU | GPU-Shared-Memory | GPU-Dynamic-Shared-Memory | |
---|---|---|---|
Running Time | 17.378s | 0.246s | 0.247s |
Difference | - | 0 | 0 |
The output image shown below. The red spot are Harris Corner Response.
Result from IMG_0125.ppm |
Result from IMG_4486.ppm |
---|