Commit 69c2ef5e authored by Alexander Alekhin's avatar Alexander Alekhin

ocl: update ocl samples

parent 7f0680fc
......@@ -132,17 +132,9 @@ int main(int argc, const char* argv[])
}
#endif
#if defined(HAVE_OPENCV_OCL)
std::vector<cv::ocl::Info>info;
if(useCuda)
{
CV_Assert(!useOcl);
info.clear();
}
if(useOcl)
{
CV_Assert(!useCuda);
cv::ocl::getDevice(info);
}
#endif
Ptr<SuperResolution> superRes;
......
......@@ -25,9 +25,6 @@ int main( int argc, const char** argv )
return -1;
}
std::vector<ocl::Info> infos;
ocl::getDevice(infos);
ocl::oclMat dsrc(src), dABFilter, dBFilter;
Size ksize(ks, ks);
......@@ -48,4 +45,4 @@ int main( int argc, const char** argv )
waitKey();
return 0;
}
\ No newline at end of file
}
......@@ -24,7 +24,7 @@ int main(int argc, const char** argv)
if (cmd.get<bool>("help"))
{
cout << "Usage : bgfg_segm [options]" << endl;
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
......@@ -54,9 +54,6 @@ int main(int argc, const char** argv)
return -1;
}
std::vector<cv::ocl::Info>info;
cv::ocl::getDevice(info);
Mat frame;
cap >> frame;
......
......@@ -45,9 +45,6 @@ int main(int argc, char** argv)
createTrackbar("Tile Size", "CLAHE", &tilesize, 32, (TrackbarCallback)TSize_Callback);
createTrackbar("Clip Limit", "CLAHE", &cliplimit, 20, (TrackbarCallback)Clip_Callback);
vector<ocl::Info> info;
CV_Assert(ocl::getDevice(info));
Mat frame, outframe;
ocl::oclMat d_outframe;
......
......@@ -72,7 +72,7 @@ int main( int argc, const char** argv )
CommandLineParser cmd(argc, argv, keys);
if (cmd.get<bool>("help"))
{
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
......@@ -120,16 +120,6 @@ int main( int argc, const char** argv )
cvNamedWindow( "result", 1 );
vector<ocl::Info> oclinfo;
int devnums = ocl::getDevice(oclinfo);
if( devnums < 1 )
{
std::cout << "no device found\n";
return -1;
}
//if you want to use undefault device, set it here
//setDevice(oclinfo[0]);
ocl::setBinpath("./");
if( capture )
{
cout << "In capture ..." << endl;
......
......@@ -135,8 +135,6 @@ App::App(CommandLineParser& cmd)
void App::run()
{
vector<ocl::Info> oclinfo;
ocl::getDevice(oclinfo);
running = true;
VideoWriter video_writer;
......
......@@ -86,13 +86,6 @@ static void drawArrows(Mat& frame, const vector<Point2f>& prevPts, const vector<
int main(int argc, const char* argv[])
{
static std::vector<Info> ocl_info;
ocl::getDevice(ocl_info);
//if you want to use undefault device, set it here
setDevice(ocl_info[0]);
//set this to save kernel compile time from second time you run
ocl::setBinpath("./");
const char* keys =
"{ h | help | false | print help message }"
"{ l | left | | specify left image }"
......@@ -109,7 +102,7 @@ int main(int argc, const char* argv[])
if (cmd.get<bool>("help"))
{
cout << "Usage: pyrlk_optical_flow [options]" << endl;
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
......
......@@ -284,13 +284,11 @@ int main(int argc, char** argv)
string outfile = cmd.get<string>("o");
if(inputName.empty())
{
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
vector<ocl::Info> info;
CV_Assert(ocl::getDevice(info));
int iterations = 10;
namedWindow( wndname, 1 );
vector<vector<Point> > squares_cpu, squares_ocl;
......
......@@ -77,28 +77,18 @@ int main(int argc, char** argv)
"{ r | right | | specify right image }"
"{ m | method | BM | specify match method(BM/BP/CSBP) }"
"{ n | ndisp | 64 | specify number of disparity levels }"
"{ s | cpu_ocl | false | use cpu or gpu as ocl device to process the image }"
"{ o | output | stereo_match_output.jpg | specify output path when input is images}";
CommandLineParser cmd(argc, argv, keys);
if (cmd.get<bool>("help"))
{
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
try
{
App app(cmd);
int flag = CVCL_DEVICE_TYPE_GPU;
if(cmd.get<bool>("s") == true)
flag = CVCL_DEVICE_TYPE_CPU;
vector<Info> info;
if(getDevice(info, flag) == 0)
{
throw runtime_error("Error: Did not find a valid OpenCL device!");
}
cout << "Device name:" << info[0].DeviceName[0] << endl;
cout << "Device name:" << cv::ocl::Context::getContext()->getDeviceInfo().deviceName << endl;
app.run();
}
......
......@@ -145,19 +145,11 @@ int main(int argc, char* argv[])
CommandLineParser cmd(argc, argv, keys);
if (cmd.get<bool>("help"))
{
std::cout << "Avaible options:" << std::endl;
std::cout << "Available options:" << std::endl;
cmd.printParams();
return 0;
}
vector<cv::ocl::Info> info;
if(cv::ocl::getDevice(info) == 0)
{
std::cout << "Error: Did not find a valid OpenCL device!" << std::endl;
return -1;
}
ocl::setDevice(info[0]);
Mat cpu_img1, cpu_img2, cpu_img1_grey, cpu_img2_grey;
oclMat img1, img2;
bool useCPU = cmd.get<bool>("c");
......@@ -190,7 +182,7 @@ int main(int argc, char* argv[])
{
std::cout
<< "Device name:"
<< info[0].DeviceName[0]
<< cv::ocl::Context::getContext()->getDeviceInfo().deviceName
<< std::endl;
}
double surf_time = 0.;
......
......@@ -80,13 +80,6 @@ static void getFlowField(const Mat& u, const Mat& v, Mat& flowField)
int main(int argc, const char* argv[])
{
static std::vector<Info> ocl_info;
ocl::getDevice(ocl_info);
//if you want to use undefault device, set it here
setDevice(ocl_info[0]);
//set this to save kernel compile time from second time you run
ocl::setBinpath("./");
const char* keys =
"{ h | help | false | print help message }"
"{ l | left | | specify left image }"
......@@ -101,7 +94,7 @@ int main(int argc, const char* argv[])
if (cmd.get<bool>("help"))
{
cout << "Usage: pyrlk_optical_flow [options]" << endl;
cout << "Avaible options:" << endl;
cout << "Available options:" << endl;
cmd.printParams();
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment