C++ median filter for images using OpenCV, with CUDA for GPU acceleration
sudo apt update
sudo apt install libopencv-dev
compile and run the run_test.cu to check the speed up and functionality test
nvcc -O3 -o out/run_test source/run_test.cu `pkg-config --cflags --libs opencv4` --disable-warnings && ./out/run_test
openCV version: 4.6.0
generating a small random gray image:
87 59 43 180
74 151 112 137
110 187 82 85
78 163 58 160
filter size: 5
applying gray median filter on the image:
87 87 87 137
87 87 110 137
78 87 112 151
78 85 137 160
generating a large random gray image
median filter on cpu: 35102 ms
median filter on cuda: 189 ms
matching pictures test? [TRUE]
speed up: 185x
## run all the commands on the main directory
compile the code
nvcc -O3 -o out/main source/main_cuda.cu `pkg-config --cflags --libs opencv4` --disable-warnings
./out/main ./doc/image.png ./doc/gray3.png 3
./out/main ./doc/image.png ./doc/gray5.png 5
./out/main ./doc/image.png ./doc/colorful3.png 3 true
./out/main ./doc/image.png ./doc/colorful5.png 5 true