-1

I am using this code:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
#include <cxtypes.h>

int main(int argc, char* argv[])
{
 IplImage* img = cvLoadImage( "dow2oc8.png" );
 cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
 cvShowImage("Example1", img);
 cvWaitKey(0);
 cvReleaseImage( &img );
 cvDestroyWindow( "Example1" );
 return 0;
}

I took out the pound signs and carrets and I can't get it to read the image file, I have added the file to the project. What should I do next

kman99
  • 6,895
  • 4
  • 22
  • 20
  • Try using an absolute path like "c:\pics\dow2oc8.png" to see if it's a problem with your paths and not OpenCV – Jacob Oct 07 '09 at 19:18
  • Which version of OpenCV are you using?Could you upload the image someplace? What kind of error did you get? **More information!!** – Jacob Oct 07 '09 at 19:34
  • The var img can't get any info on the image as can't load image, using version 1.1 and tried absolute path still not working – kman99 Oct 07 '09 at 20:37
  • the value for all parts of img nSize CXX0030: Error: expression cannot be evaluated – kman99 Oct 08 '09 at 12:54

1 Answers1

2

My first guess would be that it's attempting to load the png file from a location other than where the png file actually is. It doesn't matter whether it's in the project or not - where is it on disk? Cause, with no path specified, it should probably be in the folder your executable is running from - which, if you added it to the project, it probably isn't.

neminem
  • 2,612
  • 5
  • 27
  • 36