0

I am very new in open cv. I want to display a picture. Here is my code:

#include "stdafx.h"
#include <cv.h>
#include <cvaux.h>
#include <highgui.h>

int main( int argc, char** argv ) {
    IplImage* img = cvLoadImage( "C:\Users\Cagin\Desktop\New.jpg" );
    cvNamedWindow( “Example1”, CV_WINDOW_AUTOSIZE );
    cvShowImage( “Example1”, img );
    cvWaitKey(0);
    cvReleaseImage( &img );
    cvDestroyWindow( “Example1” );
}

It's like doesn't recognize open cv lib. You can see below my solution window:

enter image description here

As I said before I am very new in open cv. Where is my mistake?

cagin
  • 5,772
  • 14
  • 74
  • 130

1 Answers1

0

you are dealing with some legacy C code here, are you doing this on purpose? Under the latest builds, this would work for you:

using namespace cv;
int main(int argc, char** argv) {
  Mat img = imread("C:\Users\Cagin\Desktop\New.jpg");
  namedWindow("Example1", CV_WINDOW_AUTOSIZE);
  imshow("Example1", img);
  waitKey(0);
}

If this doesn't work, that means you haven't configured visual studio properly. Try following the instructions here: http://jepsonsblog.blogspot.com/2012/07/installation-guide-opencv-24-with.html

Radford Parker
  • 731
  • 4
  • 14