void pyrUp(const cv::ocl::oclMat &src, cv::ocl::oclMat &dst) { dst.create(src.rows * 2, src.cols * 2, src.type()); Context *clCxt = src.clCxt; const String kernelName = "pyrUp"; std::vector< std::pair<size_t, const void *> > args; args.push_back( std::make_pair( sizeof(cl_mem), (void *)&src.data)); args.push_back( std::make_pair( sizeof(cl_mem), (void *)&dst.data)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src.rows)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.rows)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src.cols)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.cols)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src.offset)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.offset)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&src.step)); args.push_back( std::make_pair( sizeof(cl_int), (void *)&dst.step)); size_t globalThreads[3] = {dst.cols, dst.rows, 1}; size_t localThreads[3] = {16, 16, 1}; openCLExecuteKernel(clCxt, &pyr_up, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth()); }
inline void argus_depth::refresh_frame(){ if(input_module->getFrame(mat_left,mat_right)){ remap(mat_left, rect_mat_left, rmap[0][0], rmap[0][1], CV_INTER_LINEAR); remap(mat_right, rect_mat_right, rmap[1][0], rmap[1][1], CV_INTER_LINEAR); }else{ input_module = new module_eye("left.mpg","right.mpg"); } cvtColor(rect_mat_left,BW_rect_mat_left,CV_BGR2GRAY); cvtColor(rect_mat_right,BW_rect_mat_right,CV_BGR2GRAY); frame_counter++; #if USE_GPU cv::Mat local; cv::cvtColor(rect_mat_left,local,CV_BGR2GRAY); frame_ocl.upload(local); #endif }
void cv::ocl::MOG::operator()(const cv::ocl::oclMat& frame, cv::ocl::oclMat& fgmask, float learningRate) { using namespace cv::ocl::device::mog; CV_Assert(frame.depth() == CV_8U); int ch = frame.oclchannels(); int work_ch = ch; if (nframes_ == 0 || learningRate >= 1.0 || frame.size() != frameSize_ || work_ch != mean_.oclchannels()) initialize(frame.size(), frame.type()); fgmask.create(frameSize_, CV_8UC1); ++nframes_; learningRate = learningRate >= 0.0f && nframes_ > 1 ? learningRate : 1.0f / std::min(nframes_, history); CV_Assert(learningRate >= 0.0f); mog_ocl(frame, ch, fgmask, weight_, sortKey_, mean_, var_, nmixtures_, varThreshold, learningRate, backgroundRatio, noiseSigma); }