From 4417e084a3a9e3e743af183013ac3cf6d80c8881 Mon Sep 17 00:00:00 2001 From: boolli Date: Fri, 19 Feb 2016 11:18:11 -0500 Subject: [PATCH] Functional now --- openbr/plugins/cuda/cudacvt.cpp | 2 +- openbr/plugins/cuda/cudacvt.cu | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openbr/plugins/cuda/cudacvt.cpp b/openbr/plugins/cuda/cudacvt.cpp index 28e4999..1f3297d 100644 --- a/openbr/plugins/cuda/cudacvt.cpp +++ b/openbr/plugins/cuda/cudacvt.cpp @@ -70,7 +70,7 @@ private: std::cout << "rows: " << rows << std::endl; std::cout << "cols: " << cols << std::endl; - Mat dstMat = Mat(src.m().rows, src.m().cols, CV_8UC1); + Mat dstMat = Mat(src.m().rows, src.m().cols, src.m().type()); void** dstDataPtr = dstMat.ptr(); dstDataPtr[1] = srcDataPtr[1]; dstDataPtr[2] = srcDataPtr[2]; diff --git a/openbr/plugins/cuda/cudacvt.cu b/openbr/plugins/cuda/cudacvt.cu index 372c36f..9c07c6b 100644 --- a/openbr/plugins/cuda/cudacvt.cu +++ b/openbr/plugins/cuda/cudacvt.cu @@ -27,7 +27,7 @@ namespace br{ namespace cuda { } } - dstPtr[index] = 0; + dstPtr[index] = 0.299f * srcPtr[3*index] + 0.587f * srcPtr[3*index+1] + 0.114f * srcPtr[3*index+2]; return; } @@ -41,7 +41,7 @@ namespace br{ namespace cuda { CUDA_SAFE_MALLOC(dstPtr, rows*cols*sizeof(uint8_t), &err); std::cout << "After malloc" << std::endl; - //cudacvt_kernel<<>>((uint8_t*)srcPtr, (uint8_t*) (*dstPtr), rows, cols); + cudacvt_kernel<<>>((uint8_t*)srcPtr, (uint8_t*) (*dstPtr), rows, cols); CUDA_KERNEL_ERR_CHK(&err); CUDA_SAFE_FREE(srcPtr, &err); } -- libgit2 0.21.4