OpenCL examples refactoring
This commit is contained in:
@@ -96,10 +96,9 @@ int main(int argc, const char* argv[])
|
||||
cout << "Usage: pyrlk_optical_flow [options]" << endl;
|
||||
cout << "Available options:" << endl;
|
||||
cmd.printParams();
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
bool defaultPicturesFail = false;
|
||||
string fname0 = cmd.get<string>("l");
|
||||
string fname1 = cmd.get<string>("r");
|
||||
string vdofile = cmd.get<string>("v");
|
||||
@@ -113,22 +112,10 @@ int main(int argc, const char* argv[])
|
||||
cv::Ptr<cv::DenseOpticalFlow> alg = cv::createOptFlow_DualTVL1();
|
||||
cv::ocl::OpticalFlowDual_TVL1_OCL d_alg;
|
||||
|
||||
|
||||
Mat flow, show_flow;
|
||||
Mat flow_vec[2];
|
||||
if (frame0.empty() || frame1.empty())
|
||||
{
|
||||
useCamera = true;
|
||||
defaultPicturesFail = true;
|
||||
CvCapture* capture = 0;
|
||||
capture = cvCaptureFromCAM( inputName );
|
||||
if (!capture)
|
||||
{
|
||||
cout << "Can't load input images" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (useCamera)
|
||||
{
|
||||
@@ -137,22 +124,17 @@ int main(int argc, const char* argv[])
|
||||
Mat frame0Gray, frame1Gray;
|
||||
Mat ptr0, ptr1;
|
||||
|
||||
if(vdofile == "")
|
||||
if(vdofile.empty())
|
||||
capture = cvCaptureFromCAM( inputName );
|
||||
else
|
||||
capture = cvCreateFileCapture(vdofile.c_str());
|
||||
|
||||
int c = inputName ;
|
||||
if(!capture)
|
||||
{
|
||||
if(vdofile == "")
|
||||
cout << "Capture from CAM " << c << " didn't work" << endl;
|
||||
if(vdofile.empty())
|
||||
cout << "Capture from CAM " << inputName << " didn't work" << endl;
|
||||
else
|
||||
cout << "Capture from file " << vdofile << " failed" <<endl;
|
||||
if (defaultPicturesFail)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
goto nocamera;
|
||||
}
|
||||
|
||||
@@ -206,12 +188,9 @@ int main(int argc, const char* argv[])
|
||||
}
|
||||
|
||||
if( waitKey( 10 ) >= 0 )
|
||||
goto _cleanup_;
|
||||
break;
|
||||
}
|
||||
|
||||
waitKey(0);
|
||||
|
||||
_cleanup_:
|
||||
cvReleaseCapture( &capture );
|
||||
}
|
||||
else
|
||||
@@ -254,5 +233,5 @@ nocamera:
|
||||
|
||||
waitKey();
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user