mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Updated using new cmd parser
This commit is contained in:
parent
5678464f7d
commit
d3f8b2eeb7
@ -56,22 +56,31 @@ void updateBrightnessContrast( int /*arg*/, void* )
|
||||
}
|
||||
void help()
|
||||
{
|
||||
cout << "\nThis program demonstrates the use of calcHist() -- histogram creation.\n"
|
||||
"Call:\n"
|
||||
"demhist [image_name -- Defaults to baboon.jpg]\n" << endl;
|
||||
printf("\nThis program demonstrates the use of calcHist() -- histogram creation.\n"
|
||||
"Usage: \n"
|
||||
"demhist [image_name -- Defaults to baboon.jpg]\n");
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
const char* keys =
|
||||
{
|
||||
// Load the source image. HighGUI use.
|
||||
image = imread( argc == 2 ? argv[1] : "baboon.jpg", 0 );
|
||||
"{1| |baboon.jpg|input image file}"
|
||||
};
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
string inputImage = parser.get<string>("1");
|
||||
|
||||
// Load the source image. HighGUI use.
|
||||
image = imread( inputImage, 0 );
|
||||
if(image.empty())
|
||||
{
|
||||
printf("Cannot read image file: %s\n", inputImage.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( image.empty() )
|
||||
{
|
||||
help();
|
||||
return -1;
|
||||
}
|
||||
help();
|
||||
namedWindow("image", 0);
|
||||
namedWindow("histogram", 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user