This commit is contained in:
ValeryTyumen
2015-08-01 20:24:23 +05:00
committed by Maksim Shabunin
parent 5cdf0e3e89
commit 297808e6b9
57 changed files with 950 additions and 1052 deletions

View File

@@ -27,14 +27,19 @@ static void help()
int main( int argc, char** argv )
{
help();
const char* imagename = argc > 1 ? argv[1] : "../data/lena.jpg";
cv::CommandLineParser parser(argc, argv, "{help h | |}{@image|../data/lena.jpg|}");
if (parser.has("help"))
{
help();
return 0;
}
string imagename = parser.get<string>("@image");
#if DEMO_MIXED_API_USE
//! [iplimage]
Ptr<IplImage> iplimg(cvLoadImage(imagename)); // Ptr<T> is safe ref-counting pointer class
Ptr<IplImage> iplimg(cvLoadImage(imagename.c_str())); // Ptr<T> is safe ref-counting pointer class
if(!iplimg)
{
fprintf(stderr, "Can not load image %s\n", imagename);
fprintf(stderr, "Can not load image %s\n", imagename.c_str());
return -1;
}
Mat img = cv::cvarrToMat(iplimg); // cv::Mat replaces the CvMat and IplImage, but it's easy to convert
@@ -45,7 +50,7 @@ int main( int argc, char** argv )
Mat img = imread(imagename); // the newer cvLoadImage alternative, MATLAB-style function
if(img.empty())
{
fprintf(stderr, "Can not load image %s\n", imagename);
fprintf(stderr, "Can not load image %s\n", imagename.c_str());
return -1;
}
#endif