This is not really about OpenCV. This is a feature of the C language.
argv
and argc
are the parameters of the main()
function, which allow your program to take command line arguments. argv
is an array of c-style strings, and argc
is the number of strings in argv
. argv[0]
is the name of your executable, and argv[1]
through argv[argc-1]
are the command line arguments to your program. In your example, argv[1]
is the first command line argument, that contains the file name of the image to be loaded.
Let's say the name of your executable is myOpencvProgram
. If you invoke it from the command line like this:
> myOpencvProgram image1.jpg
then argv[0]
will contain the string "myOpencvProgram"
, argv[1]
will contain "image1.jpg"
, and argc
will be equal to 2.