Commit 4417e084a3a9e3e743af183013ac3cf6d80c8881

Authored by boolli
1 parent 699ab0b0

Functional now

openbr/plugins/cuda/cudacvt.cpp
... ... @@ -70,7 +70,7 @@ private:
70 70 std::cout << "rows: " << rows << std::endl;
71 71 std::cout << "cols: " << cols << std::endl;
72 72  
73   - Mat dstMat = Mat(src.m().rows, src.m().cols, CV_8UC1);
  73 + Mat dstMat = Mat(src.m().rows, src.m().cols, src.m().type());
74 74 void** dstDataPtr = dstMat.ptr<void*>();
75 75 dstDataPtr[1] = srcDataPtr[1];
76 76 dstDataPtr[2] = srcDataPtr[2];
... ...
openbr/plugins/cuda/cudacvt.cu
... ... @@ -27,7 +27,7 @@ namespace br{ namespace cuda {
27 27 }
28 28 }
29 29  
30   - dstPtr[index] = 0;
  30 + dstPtr[index] = 0.299f * srcPtr[3*index] + 0.587f * srcPtr[3*index+1] + 0.114f * srcPtr[3*index+2];
31 31 return;
32 32 }
33 33  
... ... @@ -41,7 +41,7 @@ namespace br{ namespace cuda {
41 41 CUDA_SAFE_MALLOC(dstPtr, rows*cols*sizeof(uint8_t), &err);
42 42 std::cout << "After malloc" << std::endl;
43 43  
44   - //cudacvt_kernel<<<numBlocks, threadsPerBlock>>>((uint8_t*)srcPtr, (uint8_t*) (*dstPtr), rows, cols);
  44 + cudacvt_kernel<<<numBlocks, threadsPerBlock>>>((uint8_t*)srcPtr, (uint8_t*) (*dstPtr), rows, cols);
45 45 CUDA_KERNEL_ERR_CHK(&err);
46 46 CUDA_SAFE_FREE(srcPtr, &err);
47 47 }
... ...