I copy this code from openCV2 book and this code have argc
and argv
as arguments that I don't know what they are and why assign to 1 (argc=1
) and terminate debugging ...my problem that why argc=1
? And how I can fix it? because my argc
should be 2 (argc==2
)...
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
if ( argc ! = 2 )
{
printf( " usage: DisplayImage.out <Image_Path>\n" );
return - 1;
}
Mat image;
image = imread( argv[ 1], 1 );
if ( ! image.data )
{
printf( " No image data \n" );
return - 1;
}
namedWindow( " Display Image" , WINDOW_AUTOSIZE );
imshow( " Display Image" , image);
waitKey( 0);
return 0;
}
I try to wrote this code without argc
and argv
but the debugger has a runtime error that i think its cause be argc
.