提交 85c27e5a 编写于 作者: G Gary Bradski

revamped

上级 a161598c
......@@ -7,6 +7,20 @@
using namespace cv;
using namespace std;
void help()
{
cout << "\nThis program demonstrates the famous watershed segmentation algorithm in OpenCV: watershed()\n"
"Usage:\n"
"./watershed [image_name -- default is fruits.jpg]\n" << endl;
cout << "Hot keys: \n"
"\tESC - quit the program\n"
"\tr - restore the original image\n"
"\tw or SPACE - run watershed segmentation algorithm\n"
"\t\t(before running it, *roughly* mark the areas to segment on the image)\n"
"\t (before that, roughly outline several markers on the image)\n";
}
Mat markerMask, img;
Point prevPt(-1, -1);
......@@ -30,7 +44,6 @@ void onMouse( int event, int x, int y, int flags, void* )
}
}
int main( int argc, char** argv )
{
char* filename = argc >= 2 ? argv[1] : (char*)"fruits.jpg";
......@@ -38,17 +51,10 @@ int main( int argc, char** argv )
if( img0.empty() )
{
cout << "Usage: watershed <image_name>\n";
cout << "Couldn'g open image " << filename << ". Usage: watershed <image_name>\n";
return 0;
}
cout << "Hot keys: \n"
"\tESC - quit the program\n"
"\tr - restore the original image\n"
"\tw or SPACE - run watershed algorithm\n"
"\t\t(before running it, roughly mark the areas on the image)\n"
"\t (before that, roughly outline several markers on the image)\n";
help();
namedWindow( "image", 1 );
img0.copyTo(img);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册