filename specified by arg
This commit is contained in:
parent
24ce1a2339
commit
0d67802ba0
1 changed files with 13 additions and 1 deletions
14
lines.cpp
14
lines.cpp
|
@ -2,7 +2,19 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
cv::Mat img=cv::imread("files/masckera.png",CV_LOAD_IMAGE_GRAYSCALE);
|
||||
char const *fname = "files/masckera.png";
|
||||
if( 1<argc )
|
||||
fname = argv[1];
|
||||
if( 2<argc) {
|
||||
std::cerr << "Too many arguments" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
cv::Mat img;
|
||||
img=cv::imread(fname,CV_LOAD_IMAGE_GRAYSCALE);
|
||||
if( img.empty() ) {
|
||||
std::cerr << "Error opening image, aborting" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::vector< std::vector<cv::Point> > contours;
|
||||
std::vector<cv::Vec4i> hierarchy;
|
||||
|
|
Loading…
Reference in a new issue