search

Home  >  Q&A  >  body text

c++ - VS2013 debug mode opencv cannot open local images

Problem: VS2013community+opencv2.4.13.x86 cannot open local images in debug mode, prompting error:

But you can run the generated exe file directly by entering the debugging directory

code:



#include "stdafx.h"
#include "opencv2\highgui\highgui.hpp"

int main(int argc, char ** argv)
{
    IplImage* img = cvLoadImage("template.bmp");
    printf("%d", img->imageSize);
    cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE);
    cvShowImage("ExampleImage1", img);
    cvWaitKey(0);
    cvRelease((void **)(&img));
    cvDestroyWindow("Example1");
    return 0;
}
怪我咯怪我咯2820 days ago712

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:28:41

    The default running directory is not the compilation directory, but the root directory by default

    reply
    0
  • Cancelreply