set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
endif(NOT CMAKE_TOOLCHAIN_FILE)
-# --------------------------------------------------------------
-# Top level OpenCV project
-# --------------------------------------------------------------
-if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3)
- cmake_minimum_required(VERSION 2.8.8)
-elseif(IOS)
- cmake_minimum_required(VERSION 2.8.0)
-else()
- cmake_minimum_required(VERSION 2.6.3)
-endif()
+ if(POLICY CMP0022)
+ cmake_policy(SET CMP0022 OLD)
+ endif()
+
# must go before the project command
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
-if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
+if(DEFINED CMAKE_BUILD_TYPE)
set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
endif()
if( objectPoints->rows != 1 || imagePoints->rows != 1 )
CV_Error( CV_StsBadSize, "object points and image points must be a single-row matrices" );
- matA = cvCreateMat( 2*nimages, 2, CV_64F );
- _b = cvCreateMat( 2*nimages, 1, CV_64F );
+ matA.reset(cvCreateMat( 2*nimages, 2, CV_64F ));
+ _b.reset(cvCreateMat( 2*nimages, 1, CV_64F ));
- a[2] = (imageSize.width - 1)*0.5;
- a[5] = (imageSize.height - 1)*0.5;
+ a[2] = (!imageSize.width) ? 0.5 : (imageSize.width - 1)*0.5;
+ a[5] = (!imageSize.height) ? 0.5 : (imageSize.height - 1)*0.5;
- _allH = cvCreateMat( nimages, 9, CV_64F );
+ _allH.reset(cvCreateMat( nimages, 9, CV_64F ));
// extract vanishing points in order to obtain initial value for the focal length
for( i = 0, pos = 0; i < nimages; i++, pos += ni )
add_library(${the_module} SHARED ${handwrittren_h_sources} ${handwrittren_cpp_sources} ${generated_cpp_sources}
${copied_files}
"${JAR_FILE}" "${JAR_FILE}.dephelper")
+set_target_properties(${the_module} PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL)
+
if(BUILD_FAT_JAVA_LIB)
set(__deps ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULES_BUILD})
- list(REMOVE_ITEM __deps ${the_module} opencv_ts)
+ foreach(m ${OPENCV_MODULES_BUILD}) # filterout INTERNAL (like opencv_ts) and BINDINGS (like opencv_python) modules
+ ocv_assert(DEFINED OPENCV_MODULE_${m}_CLASS)
+ if(NOT OPENCV_MODULE_${m}_CLASS STREQUAL "PUBLIC")
+ list(REMOVE_ITEM __deps ${m})
+ endif()
+ endforeach()
ocv_list_unique(__deps)
set(__extradeps ${__deps})
ocv_list_filterout(__extradeps "^opencv_")
ProgramCache::~ProgramCache()
{
releaseProgram();
+ if (this == _programCache)
+ {
+ cv::AutoLock lock(getInitializationMutex());
+ if (this == _programCache)
+ _programCache = NULL;
+ }
}
-cl_program ProgramCache::progLookup(const string& srcsign)
+cl_program ProgramCache::progLookup(const String& srcsign)
{
- map<string, cl_program>::iterator iter;
+ std::map<String, cl_program>::iterator iter;
iter = codeCache.find(srcsign);
if(iter != codeCache.end())
return iter->second;
{
if(status == CL_BUILD_PROGRAM_FAILURE)
{
- cl_int logStatus;
- char *buildLog = NULL;
size_t buildLogSize = 0;
- logStatus = clGetProgramBuildInfo(program,
- getClDeviceID(ctx), CL_PROGRAM_BUILD_LOG, buildLogSize,
- buildLog, &buildLogSize);
- if(logStatus != CL_SUCCESS)
- std::cout << "Failed to build the program and get the build info." << std::endl;
- buildLog = new char[buildLogSize];
- CV_DbgAssert(!!buildLog);
- memset(buildLog, 0, buildLogSize);
openCLSafeCall(clGetProgramBuildInfo(program, getClDeviceID(ctx),
- CL_PROGRAM_BUILD_LOG, buildLogSize, buildLog, NULL));
- std::cout << "\nBUILD LOG: " << options << "\n";
- std::cout << buildLog << std::endl;
- delete [] buildLog;
+ CL_PROGRAM_BUILD_LOG, 0, NULL, &buildLogSize));
+ std::vector<char> buildLog; buildLog.resize(buildLogSize);
+ memset(&buildLog[0], 0, buildLogSize);
+ openCLSafeCall(clGetProgramBuildInfo(program, getClDeviceID(ctx),
+ CL_PROGRAM_BUILD_LOG, buildLogSize, &buildLog[0], NULL));
+ std::cout << std::endl << "BUILD LOG: "
+ << (source->name ? source->name : "dynamic program") << ": "
+ << options << "\n";
- std::cout << &buildLog[0] << endl;
++ std::cout << &buildLog[0] << std::endl;
}
openCLVerifyCall(status);
}
break;
}
}
- else
- {
- globalThreads[0] = (dst.cols + localThreads[0] - 1) / localThreads[0] * localThreads[0];
- }
- //sanity checks
- CV_Assert(clCxt == dst.clCxt);
- CV_Assert(src.cols == dst.cols);
- CV_Assert(src.oclchannels() == dst.oclchannels());
- CV_Assert(ksize == (anchor << 1) + 1);
- int src_pix_per_row, dst_pix_per_row;
- int src_offset_x, src_offset_y;//, dst_offset_in_pixel;
- src_pix_per_row = src.step / src.elemSize();
- src_offset_x = (src.offset % src.step) / src.elemSize();
- src_offset_y = src.offset / src.step;
- dst_pix_per_row = dst.step / dst.elemSize();
- //dst_offset_in_pixel = dst.offset / dst.elemSize();
+ int src_pix_per_row = src.step / src.elemSize();
+ int src_offset_x = (src.offset % src.step) / src.elemSize();
+ int src_offset_y = src.offset / src.step;
+ int dst_pix_per_row = dst.step / dst.elemSize();
int ridusy = (dst.rows - src.rows) >> 1;
- vector<pair<size_t , const void *> > args;
- args.push_back(make_pair(sizeof(cl_mem), &src.data));
- args.push_back(make_pair(sizeof(cl_mem), &dst.data));
- args.push_back(make_pair(sizeof(cl_int), (void *)&dst.cols));
- args.push_back(make_pair(sizeof(cl_int), (void *)&dst.rows));
- args.push_back(make_pair(sizeof(cl_int), (void *)&src.wholecols));
- args.push_back(make_pair(sizeof(cl_int), (void *)&src.wholerows));
- args.push_back(make_pair(sizeof(cl_int), (void *)&src_pix_per_row));
- args.push_back(make_pair(sizeof(cl_int), (void *)&src_offset_x));
- args.push_back(make_pair(sizeof(cl_int), (void *)&src_offset_y));
- args.push_back(make_pair(sizeof(cl_int), (void *)&dst_pix_per_row));
- args.push_back(make_pair(sizeof(cl_int), (void *)&ridusy));
- args.push_back(make_pair(sizeof(cl_mem), (void *)&mat_kernel.data));
+
+ std::vector<std::pair<size_t , const void *> > args;
+ args.push_back(std::make_pair(sizeof(cl_mem), &src.data));
+ args.push_back(std::make_pair(sizeof(cl_mem), &dst.data));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&dst.cols));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&dst.rows));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&src.wholecols));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&src.wholerows));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&src_pix_per_row));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&src_offset_x));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&src_offset_y));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&dst_pix_per_row));
+ args.push_back(std::make_pair(sizeof(cl_int), (void *)&ridusy));
+ args.push_back(std::make_pair(sizeof(cl_mem), (void *)&mat_kernel.data));
- openCLExecuteKernel(clCxt, &filter_sep_row, kernelName, globalThreads, localThreads, args, channels, src.depth(), compile_option);
+ openCLExecuteKernel(src.clCxt, &filter_sep_row, "row_filter", globalThreads, localThreads,
+ args, channels, src.depth(), buildOptions.c_str());
}
Ptr<BaseRowFilter_GPU> cv::ocl::getLinearRowFilter_GPU(int srcType, int /*bufType*/, const Mat &rowKernel, int anchor, int bordertype)
int srcOffset = _src.offset / _src.elemSize(), dstOffset = dst.offset / dst.elemSize();
int depth = _src.depth(), ochannels = _src.oclchannels();
- int __bordertype[] = {cv::BORDER_CONSTANT, cv::BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101};
- const char *borderstr[] = {"BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101"};
- size_t bordertype_index;
+ int __bordertype[] = { BORDER_CONSTANT, BORDER_REPLICATE, BORDER_REFLECT, BORDER_WRAP, BORDER_REFLECT_101 };
+ const char *borderstr[] = { "BORDER_CONSTANT", "BORDER_REPLICATE", "BORDER_REFLECT", "BORDER_WRAP", "BORDER_REFLECT_101" };
- for(bordertype_index = 0; bordertype_index < sizeof(__bordertype) / sizeof(int); bordertype_index++)
- if (__bordertype[bordertype_index] == bordertype)
+ int bordertype_index = -1;
+ for (int i = 0, end = sizeof(__bordertype) / sizeof(int); i < end; i++)
+ if (__bordertype[i] == bordertype)
+ {
+ bordertype_index = i;
break;
-
- if (bordertype_index == sizeof(__bordertype) / sizeof(int))
+ }
+ if (bordertype_index < 0)
- CV_Error(CV_StsBadArg, "Unsupported border type");
+ CV_Error(Error::StsBadArg, "Unsupported border type");
- String kernelName = "copymakeborder";
- size_t localThreads[3] = {16, 16, 1};
+ size_t localThreads[3] = { 16, 16, 1 };
size_t globalThreads[3] = { dst.cols, dst.rows, 1 };
- vector< pair<size_t, const void *> > args;
- args.push_back( make_pair( sizeof(cl_mem), (void *)&_src.data));
- args.push_back( make_pair( sizeof(cl_mem), (void *)&dst.data));
- args.push_back( make_pair( sizeof(cl_int), (void *)&dst.cols));
- args.push_back( make_pair( sizeof(cl_int), (void *)&dst.rows));
- args.push_back( make_pair( sizeof(cl_int), (void *)&_src.cols));
- args.push_back( make_pair( sizeof(cl_int), (void *)&_src.rows));
- args.push_back( make_pair( sizeof(cl_int), (void *)&srcStep));
- args.push_back( make_pair( sizeof(cl_int), (void *)&srcOffset));
- args.push_back( make_pair( sizeof(cl_int), (void *)&dstStep));
- args.push_back( make_pair( sizeof(cl_int), (void *)&dstOffset));
- args.push_back( make_pair( sizeof(cl_int), (void *)&top));
- args.push_back( make_pair( sizeof(cl_int), (void *)&left));
+ 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 *)&dst.cols));
+ 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 *)&_src.rows));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&srcStep));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&srcOffset));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&dstStep));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&dstOffset));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&top));
+ args.push_back( std::make_pair( sizeof(cl_int), (void *)&left));
const char * const typeMap[] = { "uchar", "char", "ushort", "short", "int", "float", "double" };
const char * const channelMap[] = { "", "", "2", "4", "4" };
scalarToRawData(scalar, buf, dst.type());
memset(buf + src.elemSize1() * cn, 0, (ocn - cn) * src.elemSize1());
- args.push_back( make_pair( bufSize , (void *)buf ));
+ args.push_back( std::make_pair( bufSize , (void *)buf ));
- openCLExecuteKernel(src.clCxt, &imgproc_copymakeboder, kernelName, globalThreads,
+ openCLExecuteKernel(src.clCxt, &imgproc_copymakeboder, "copymakeborder", globalThreads,
localThreads, args, -1, -1, buildOptions.c_str());
}
int main( int argc, const char** argv )
{
const char* keys =
- "{ i | input | | specify input image }"
- "{ k | ksize | 5 | specify kernel size }"
- "{ h | help | false | print help message }";
+ "{ i input | | specify input image }"
- "{ k ksize | 5 | specify kernel size }";
++ "{ k ksize | 5 | specify kernel size }"
++ "{ h help | false | print help message }";
+
CommandLineParser cmd(argc, argv, keys);
- if (cmd.get<bool>("help"))
++ if (cmd.has("help"))
+ {
+ cout << "Usage : adaptive_bilateral_filter [options]" << endl;
+ cout << "Available options:" << endl;
- cmd.printParams();
++ cmd.printMessage();
+ return EXIT_SUCCESS;
+ }
+
string src_path = cmd.get<string>("i");
int ks = cmd.get<int>("k");
const char * winName[] = {"input", "adaptive bilateral CPU", "adaptive bilateral OpenCL", "bilateralFilter OpenCL"};
int main(int argc, const char** argv)
{
-
cv::CommandLineParser cmd(argc, argv,
- "{ c | camera | false | use camera }"
- "{ f | file | 768x576.avi | input video file }"
- "{ m | method | mog | method (mog, mog2) }"
- "{ h | help | false | print help message }");
+ "{ c camera | false | use camera }"
+ "{ f file | 768x576.avi | input video file }"
+ "{ m method | mog | method (mog, mog2) }"
+ "{ h help | false | print help message }");
-- if (cmd.get<bool>("help"))
++ if (cmd.has("help"))
{
cout << "Usage : bgfg_segm [options]" << endl;
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
bool useCamera = cmd.get<bool>("camera");
int main(int argc, char** argv)
{
const char* keys =
- "{ i | input | | specify input image }"
- "{ c | camera | 0 | specify camera id }"
- "{ s | use_cpu | false | use cpu algorithm }"
- "{ o | output | clahe_output.jpg | specify output save path}"
- "{ h | help | false | print help message }";
+ "{ i input | | specify input image }"
+ "{ c camera | 0 | specify camera id }"
+ "{ s use_cpu | false | use cpu algorithm }"
- "{ o output | clahe_output.jpg | specify output save path}";
++ "{ o output | clahe_output.jpg | specify output save path}"
++ "{ h help | false | print help message }";
+
+ cv::CommandLineParser cmd(argc, argv, keys);
- if (cmd.get<bool>("help"))
++ if (cmd.has("help"))
+ {
+ cout << "Usage : clahe [options]" << endl;
+ cout << "Available options:" << endl;
- cmd.printParams();
++ cmd.printMessage();
+ return EXIT_SUCCESS;
+ }
- CommandLineParser cmd(argc, argv, keys);
- string infile = cmd.get<string>("i");
- outfile = cmd.get<string>("o");
+ string infile = cmd.get<string>("i"), outfile = cmd.get<string>("o");
int camid = cmd.get<int>("c");
bool use_cpu = cmd.get<bool>("s");
- CvCapture* capture = 0;
+ VideoCapture capture;
- bool running = true;
namedWindow("CLAHE");
createTrackbar("Tile Size", "CLAHE", &tilesize, 32, (TrackbarCallback)TSize_Callback);
}
}
else
- {
- capture = cvCaptureFromCAM(camid);
+ capture.open(camid);
- }
+
cout << "\nControls:\n"
<< "\to - save output image\n"
<< "\tESC - exit\n";
- while(running)
+
+ for (;;)
{
- if(capture)
- frame = cvQueryFrame(capture);
+ if(capture.isOpened())
+ capture.read(frame);
else
frame = imread(infile);
if(frame.empty())
pFilter->apply(d_outframe, d_outframe);
d_outframe.download(outframe);
}
+
imshow("CLAHE", outframe);
- char key = (char)cvWaitKey(3);
+
- if(key == 'o') imwrite(outfile, outframe);
- else if(key == 27) running = false;
+ char key = (char)waitKey(3);
+ if(key == 'o')
+ imwrite(outfile, outframe);
+ else if(key == 27)
+ break;
}
- return 0;
+ return EXIT_SUCCESS;
}
return work_end /((double)cvGetTickFrequency() * 1000.);
}
- void detect( Mat& img, vector<Rect>& faces,
+
+ static void detect( Mat& img, vector<Rect>& faces,
- ocl::OclCascadeClassifierBuf& cascade,
+ ocl::OclCascadeClassifier& cascade,
double scale, bool calTime);
CascadeClassifier& cascade,
double scale, bool calTime);
- void Draw(Mat& img, vector<Rect>& faces, double scale);
-
+ static void Draw(Mat& img, vector<Rect>& faces, double scale);
// This function test if gpu_rst matches cpu_rst.
CommandLineParser cmd(argc, argv, keys);
if (cmd.get<bool>("help"))
{
+ cout << "Usage : facedetect [options]" << endl;
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
+
CvCapture* capture = 0;
Mat frame, frameCopy, image;
"{ l |larger_win| false | use 64x128 window}"
"{ o | output | | specify output path when input is images}";
CommandLineParser cmd(argc, argv, keys);
- if (cmd.get<bool>("help"))
++ if (cmd.has("help"))
+ {
+ cout << "Usage : hog [options]" << endl;
+ cout << "Available options:" << endl;
- cmd.printParams();
++ cmd.printMessage();
+ return EXIT_SUCCESS;
+ }
+
App app(cmd);
try
{
{
cout << "Usage: pyrlk_optical_flow [options]" << endl;
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
bool defaultPicturesFail = false;
Mat frame0Gray, frame1Gray;
Mat ptr0, ptr1;
- if(vdofile == "")
+ if(vdofile.empty())
- capture = cvCaptureFromCAM( inputName );
+ capture.open( inputName );
else
- capture = cvCreateFileCapture(vdofile.c_str());
+ capture.open(vdofile.c_str());
int c = inputName ;
- if(!capture)
+ if(!capture.isOpened())
{
- if(vdofile == "")
+ if(vdofile.empty())
cout << "Capture from CAM " << c << " didn't work" << endl;
else
cout << "Capture from file " << vdofile << " failed" <<endl;
}
if( waitKey( 10 ) >= 0 )
- goto _cleanup_;
+ break;
}
- waitKey(0);
-
- _cleanup_:
- cvReleaseCapture( &capture );
+ capture.release();
}
else
{
CommandLineParser cmd(argc, argv, keys);
string inputName = cmd.get<string>("i");
string outfile = cmd.get<string>("o");
- if(inputName.empty())
+
+ if(cmd.get<bool>("help"))
{
+ cout << "Usage : squares [options]" << endl;
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
int iterations = 10;
- namedWindow( wndname, 1 );
- namedWindow( wndname, CV_LOAD_IMAGE_COLOR );
++ namedWindow( wndname, WINDOW_AUTOSIZE );
vector<vector<Point> > squares_cpu, squares_ocl;
Mat image = imread(inputName, 1);
Mat result = drawSquaresBoth(image, squares_cpu, squares_ocl);
imshow(wndname, result);
imwrite(outfile, result);
- cvWaitKey(0);
+ waitKey(0);
- return 0;
+ return EXIT_SUCCESS;
}
if (cmd.get<bool>("help"))
{
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
return 0;
}
+
try
{
App app(cmd);
{
work_end = getTickCount() - work_begin;
}
- double getTime()
+
+ static double getTime()
{
- return work_end /((double)cvGetTickFrequency() * 1000.);
+ return work_end /((double)getTickFrequency() * 1000.);
}
template<class KPDetector>
}
};
- Mat drawGoodMatches(
+ static Mat drawGoodMatches(
const Mat& cpu_img1,
const Mat& cpu_img2,
- const vector<KeyPoint>& keypoints1,
- const vector<KeyPoint>& keypoints2,
- vector<DMatch>& matches,
- vector<Point2f>& scene_corners_
-)
+ const std::vector<KeyPoint>& keypoints1,
+ const std::vector<KeyPoint>& keypoints2,
+ std::vector<DMatch>& matches,
+ std::vector<Point2f>& scene_corners_
+ )
{
//-- Sort matches and preserve top 10% matches
std::sort(matches.begin(), matches.end());
int main(int argc, char* argv[])
{
const char* keys =
- "{ h | help | false | print help message }"
- "{ l | left | | specify left image }"
- "{ r | right | | specify right image }"
- "{ o | output | SURF_output.jpg | specify output save path (only works in CPU or GPU only mode) }"
- "{ c | use_cpu | false | use CPU algorithms }"
- "{ a | use_all | false | use both CPU and GPU algorithms}";
+ "{ help h | false | print help message }"
+ "{ left l | | specify left image }"
+ "{ right r | | specify right image }"
+ "{ output o | SURF_output.jpg | specify output save path (only works in CPU or GPU only mode) }"
+ "{ use_cpu c | false | use CPU algorithms }"
+ "{ use_all a | false | use both CPU and GPU algorithms}";
+
CommandLineParser cmd(argc, argv, keys);
if (cmd.get<bool>("help"))
{
+ std::cout << "Usage: surf_matcher [options]" << std::endl;
std::cout << "Available options:" << std::endl;
- cmd.printParams();
+ cmd.printMessage();
- return 0;
+ return EXIT_SUCCESS;
}
Mat cpu_img1, cpu_img2, cpu_img1_grey, cpu_img2_grey;
cpu_img2 = imread(cmd.get<std::string>("r"));
CV_Assert(!cpu_img2.empty());
- cvtColor(cpu_img2, cpu_img2_grey, CV_BGR2GRAY);
+ cvtColor(cpu_img2, cpu_img2_grey, COLOR_BGR2GRAY);
img2 = cpu_img2_grey;
- if(useALL)
- {
- useCPU = false;
- useGPU = false;
- }
- else if(useCPU==false && useALL==false)
- {
+ if (useALL)
+ useCPU = useGPU = false;
+ else if(!useCPU && !useALL)
useGPU = true;
- }
if(!useCPU)
- {
std::cout
<< "Device name:"
<< cv::ocl::Context::getContext()->getDeviceInfo().deviceName
{
cout << "Usage: pyrlk_optical_flow [options]" << endl;
cout << "Available options:" << endl;
- cmd.printParams();
+ cmd.printMessage();
- 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");
Mat frame0Gray, frame1Gray;
Mat ptr0, ptr1;
- if(vdofile == "")
+ if(vdofile.empty())
- capture = cvCaptureFromCAM( inputName );
+ capture.open( inputName );
else
- capture = cvCreateFileCapture(vdofile.c_str());
+ capture.open(vdofile.c_str());
- int c = inputName ;
- if(!capture)
+ if(!capture.isOpened())
{
- 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;
}
}
if( waitKey( 10 ) >= 0 )
- goto _cleanup_;
+ break;
}
- waitKey(0);
-
- _cleanup_:
- cvReleaseCapture( &capture );
+ capture.release();
}
else
{