Ask Your Question
0

how to pass command line argument to excute this code in visual studio 2013

asked 2014-11-04 15:26:06 -0500

sabri1990 gravatar image

updated 2014-11-05 03:19:45 -0500

#include <opencv2/core/core.hpp>   
#include <opencv2/highgui/highgui.hpp>  
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
{
    if (argc != 2)
    {
        cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
        return -1;
    }

    Mat image;
    image = imread("D:\photo\sab.jpg", CV_LOAD_IMAGE_COLOR);   // Read the file

    if (!image.data)                              // Check for invalid input
    {
        cout << "Could not open or find the image" << std::endl;
        return -1;
    }

    namedWindow("Display window", CV_WINDOW_AUTOSIZE);// Create a window for display.
    imshow("Display window", image);                   // Show our image inside it.

    waitKey(0);                                          // Wait for a keystroke in the window
    return 0;
}
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-11-05 03:20:55 -0500

It's simply

image = imread(argv[1], CV_LOAD_IMAGE_COLOR);

but google would have helped you also...

edit flag offensive delete link more
0

answered 2014-11-05 09:35:49 -0500

updated 2014-11-05 09:37:48 -0500

I'm not sure I understand your question, but if you want to know how to pass command line argument in Visual studio 2013, watch this video!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-11-04 15:26:06 -0500

Seen: 613 times

Last updated: Nov 05 '14