c++ - OpenCV Tutorial: Load and Display an Image (codeblocks, fedora20) -
c++ - OpenCV Tutorial: Load and Display an Image (codeblocks, fedora20) -
i installed , linked , included opencv. (i know successful because compiled , ran opencv programme found on site)
so went opencv documentation , tutorials pages. copied from page exact code below.
#include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main(int argc, char** argv) { if( argc != 2) { cout <<" usage: display_image imagetoloadanddisplay" << endl; homecoming -1; } mat image; image = imread(argv[1], cv_load_image_color); // read file if(!image.data ) // check invalid input { cout << "could not open or find image" << std::endl ; homecoming -1; } namedwindow( "display window", window_autosize );// create window display. imshow( "display window", image ); // show our image within it. waitkey(0); // wait keystroke in window homecoming 0; } //this end (running codeblocks on fedora20) using project >> set programs' arguments fed in "/home/kennedy/pictures/enterprise.bmp" without quotes.
since i'm using bmp file (supported), , file path correct, can suggest why codeblocks spitting out
/home/kennedy/documents/workspace/opencvtest/main.cpp|21|error: ‘cv_load_image_color’ not declared in scope| instead of running lovely little first program?
for reference, i've read not found help on this, this, , other q&as on stackoverflow, codeblocks forum, , anywhere else think look. saw this, i'm not having problem window_autosize.
edit add together attempted solution: copied , pasted enterprise.bmp folder containing project, removed arguments, , replaced argv1 "enterprise.bmp". had no effect, still same error.
that means you're compiling against opencv 3.0. symbol "cv_load_image_color" has been replaced "cv::imread_color". edit file , should good. it's deprecated symbol used in caffe.
c++ opencv codeblocks
Comments
Post a Comment