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()
|
void help()
|
||||||
{
|
{
|
||||||
cout << "\nThis program demonstrates the use of calcHist() -- histogram creation.\n"
|
printf("\nThis program demonstrates the use of calcHist() -- histogram creation.\n"
|
||||||
"Call:\n"
|
"Usage: \n"
|
||||||
"demhist [image_name -- Defaults to baboon.jpg]\n" << endl;
|
"demhist [image_name -- Defaults to baboon.jpg]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char** argv )
|
const char* keys =
|
||||||
{
|
{
|
||||||
// Load the source image. HighGUI use.
|
"{1| |baboon.jpg|input image file}"
|
||||||
image = imread( argc == 2 ? argv[1] : "baboon.jpg", 0 );
|
};
|
||||||
|
|
||||||
if( image.empty() )
|
int main( int argc, const char** argv )
|
||||||
{
|
{
|
||||||
help();
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
help();
|
|
||||||
namedWindow("image", 0);
|
namedWindow("image", 0);
|
||||||
namedWindow("histogram", 0);
|
namedWindow("histogram", 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user