CudaOtsu-master

所属分类:OpenCV
开发工具:C/C++
文件大小:233KB
下载次数:0
上传日期:2019-04-08 14:40:56
上 传 者frkntskn
说明:  otsu c++ opencv algorithm

文件列表:
Makefile (624, 2018-11-28)
assets (0, 2018-11-28)
assets\example_grey.png (144491, 2018-11-28)
src (0, 2018-11-28)
src\CudaOtsuBinarizer.cu (8692, 2018-11-28)
src\CudaOtsuBinarizer.cuh (816, 2018-11-28)
src\MonoCudaOtsuBinarizer.cu (7074, 2018-11-28)
src\MonoCudaOtsuBinarizer.cuh (477, 2018-11-28)
src\OtsuBinarizer.cpp (2850, 2018-11-28)
src\OtsuBinarizer.h (469, 2018-11-28)
src\OtsuOpenMPBinarizer.cpp (4109, 2018-11-28)
src\OtsuOpenMPBinarizer.h (545, 2018-11-28)
src\SMCudaOtsuBinarizer.cu (6809, 2018-11-28)
src\SMCudaOtsuBinarizer.cuh (426, 2018-11-28)
src\libs (0, 2018-11-28)
src\libs\lodepng.cpp (221122, 2018-11-28)
src\libs\lodepng.h (82859, 2018-11-28)
src\main.cpp (8320, 2018-11-28)
src\model (0, 2018-11-28)
src\model\ExecutionTimestamp.cpp (954, 2018-11-28)
src\model\ExecutionTimestamp.h (306, 2018-11-28)
src\model\PngImage.cpp (879, 2018-11-28)
src\model\PngImage.h (674, 2018-11-28)
src\utils (0, 2018-11-28)
src\utils\CudaUtil.cpp (2204, 2018-11-28)
src\utils\CudaUtil.h (327, 2018-11-28)
src\utils\ImageFileUtil.cpp (2742, 2018-11-28)
src\utils\ImageFileUtil.h (695, 2018-11-28)

# CudaOtsu Otsu's method thresholding and image binarization on GPU using CUDA in C++. ## Otsu's Method Simple and one of the most popular image thresholding method used in computer vision problems. Algorithm helps to find optimal threshold value for greyscale image to be then used in image binarization. As binarized images are main data type for problems such as OCR, Otsu's method is used as a part of pre-processing pipelines for computer vision problems. Otsu's main idea is to find threshold that minimzes the intra-class variance within 'foreground' and 'background' classes. Based on observation that minimazing intra-class variance is the same as maximizing inter-class variance, we can define algorithm as following steps: 1. Compute histogram and probabilities of each intensity level 2. Set up initial classes probability and classes mean 3. For every intensity level: - Update class probability and mean for current intensity level - Compute inter-class variance 4. Threshold will be at intenisty level with highest inter-class variance ### Otsu's Method Visualization ![Otsu's Method Visualization](https://upload.wikimedia.org/wikipedia/commons/3/34/Otsu%27s_Method_Visualization.gif) ## Project goal Project is focused on implementing Otsu's method as CUDA kernels to test how well GPU will handle this algorithm in terms of computation time (comparing to multithreaded CPU implementation). Also it's a kind of CUDA playground for me as I'm absolute beginner in GPU computations. ## Current features - C++ implementation of Otsu's method on CPU (single threaded) - Basic CUDA implementation of Otsu's method on GPU - Basic CUDA shared memory usage (no huge speed boost here, Otsu's algorithm gains very little from cache) - Makefile for more multiplatform approach - Extendable Binarizers architecture ## How to run project - Build project using makefile build target or visual studio project build ```bash $> make clean $> make build ``` - Run it using makefile ```bash $> make run file= threads= blocks= device_id= # default GPU indexed as 0, for more info use nvidia-smi tool ``` - or directly from executable (`.exe` in case of Windows OS) ```bash $> ./cudaOtsu -d [optional flags] # Flags: # -h (show histogram values for each binarizer run) # --cpu (run CPU implementation) # --gpu (run basic GPU implementation) # --gpu-sm (run shared memory optimized GPU implementation) # --gpu-mono (run GPU version with singlekernel architecture on single GPU block) # --run-all (run all implemented versions of Otsu algorithm both CPU and GPU) ``` ## To do - [ ] Concurrent CPU method implementation for benchmarking (openMP) - [ ] Memory optimization - [ ] Simple (cross-platform) GUI - [ ] Cuda GPU selection error handling - [ ] Research and compare different CUDA optimization mechanisms

近期下载者

相关文件


收藏者