#define FM7b5_BINARIZE_CUH
#include "binarize.h"
+#include "MDView.cuh"
namespace FM7b5
{
- __global__ void binarize(uint8_t* out, const size_t out_pitch, const uint8_t* in, const size_t in_pitch, const size_t width, const size_t height, const uint8_t thres = 128);
+ template <class T, class U>
+ __global__ void
+ binarize(const MDView<T, 2> out, const MDView<U, 2> in, const size_t width, const size_t height, const uint8_t thres)
+ {
+ const size_t w(blockDim.x * blockIdx.x + threadIdx.x);
+ const size_t h(blockDim.y * blockIdx.y + threadIdx.y);
+
+ if (w >= width || h >= height) {
+ return;
+ }
+
+ out[h][w] = (in[h][w] < thres) ? 0 : 255;
+ }
}
#endif /* FM7b5_BINARIZE_CUH */