What are the five arguments in the 'How to build applications with OpenCV inside the Microsoft Visual Studio' sample code?

asked 2013-10-10 05:46:27 -0500

dumbledad gravatar image

updated 2013-10-10 06:12:56 -0500

I'm following the instructions in How to build applications with OpenCV inside the Microsoft Visual Studio but I'm confused by the sample code.

When the author calls the built sample he or she uses the single argument exampleImage.jpg either supplied on the command line or set in the Property Pages, as I have done here

Setting Command Arguments in the property pages screenshot

But the first few lines of main in the sample code are:

if (argc != 5)
    cout << "Not enough parameters" << endl;
    return -1;

i.e. the application requires five arguments. If the function requires five arguments then what are they and why is only one supplied? If the function only requires one argument then what is this checking code for?

========== EDIT 1 ==========

Actually the more I look at it the more confused I am by the sample code. The tutorial sample code purports to be about loading and displaying an image, but looking at the code listing it is all about videos and Gaussian functions. This tutorial is supposed to be the introduction to getting started with Visual Studio, linked to from the primary OpenCV Quick Start page, I cannot be the first person to try the code. Why is it so different from what it purports to be?

========== EDIT 2 ==========

I've submitted this as a documentation bug.

edit retag flag offensive close merge delete


  • you'll need all 5 args (look at line 25 and 37 ff) [sidenote: the 1st two should be videofiles, not images]
  • this block is wrong, it should list all (5) required args indeed.

yea, bugreport. well done!

berak gravatar imageberak ( 2013-10-10 06:44:26 -0500 )edit

berak - sure it's not just a copy-and-paste issue and this was the intended sample code: https://github.com/Itseez/opencv/blob/master/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp

dumbledad gravatar imagedumbledad ( 2013-10-10 06:57:42 -0500 )edit