diff --git a/openbr/plugins/cuda/cudapca.cpp b/openbr/plugins/cuda/cudapca.cpp index 2d3038c..9341c24 100644 --- a/openbr/plugins/cuda/cudapca.cpp +++ b/openbr/plugins/cuda/cudapca.cpp @@ -33,6 +33,7 @@ using namespace cv; // definitions from the CUDA source file namespace br { namespace cuda { namespace pca { void initializeWrapper(float* evPtr, int evRows, int evCols, float* meanPtr, int meanElems); + void trainWrapper(void* cudaSrc, float* dst, int rows, int cols); void wrapper(void* src, void** dst); }}} @@ -94,6 +95,7 @@ private: int type = *((int*)srcDataPtr[3]); Mat mat = Mat(rows, cols, type); + br::cuda::pca::trainWrapper(cudaMemPtr, mat.ptr(), rows, cols); trainingQlist.append(Template(mat)); } diff --git a/openbr/plugins/cuda/cudapca.cu b/openbr/plugins/cuda/cudapca.cu index dbc2877..1a2861f 100644 --- a/openbr/plugins/cuda/cudapca.cu +++ b/openbr/plugins/cuda/cudapca.cu @@ -111,6 +111,11 @@ namespace br { namespace cuda { namespace pca { CUDA_SAFE_MALLOC(&intermediaryBuffer, _numSteps*_evCols*sizeof(float), &err); } + void trainWrapper(void* cudaSrc, float* data, int rows, int cols) { + cudaError_t err; + CUDA_SAFE_MEMCPY(data, cudaSrc, rows*cols*sizeof(float), cudaMemcpyDeviceToHost, &err); + } + void wrapper(void* src, void** dst) { cudaError_t err; CUDA_SAFE_MALLOC(dst, _evCols*sizeof(float), &err);