A
A
Asya2016-05-24 14:06:35
C++ / C#
Asya, 2016-05-24 14:06:35

I installed OpenCV 2.4.13 but I can't run the code in Visual Studio, why???

Please, help!!!
I installed it like here
but, apparently, I messed it up somewhere, because nothing works for me (((
there is such a code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
#include <cv.h>
#include <highgui.h>

int main(int argc, char* argv[])
{
  int x;
  cin>>x;
if (argc < 2)
{
    printf("Usage: ./opencv_hello <file.png>\n");
    return -1;
}

    IplImage* img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED);
if (!img)
{
    return -1;
}

cvNamedWindow("display", CV_WINDOW_AUTOSIZE);
    cvShowImage("display", img );

    cvWaitKey(0);        
  
    return 0;
}

compiles without errors
when I run the project for the first time, then at first such a thing appears and then the console immediately closes:
16256a2915fc48108677383558efff35.jpgif I run it again, the console just crashes right away
WHY IS THE CONSOLE FLYING?!?!?!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fat Lorrie, 2016-05-24
@asyaevloeva

Did you set the arguments for the call? (This is from " Command line arguments with Visual Studio " at the very end of the article).

#
#algooptimize #bottize, 2016-05-24
@user004

Look for the text on the console in the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question