I a开发者_开发技巧m 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
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.
精彩评论