Hello All
I built opencv2.4.13 from source in RELEASE mode like so:
>> I created a directory named 'build' inside the folder and from inside the 'build' ran cmake :
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/ssomesh/usr/local/opencv -D WITH_CUDA=ON ..
This I followed with
>>>> make; sudo make install
When I run the sample code provided in the 'samples' folder by openCV, it is able to read and display images. However when I compile my program, the imread() function does not seem to work.
Here's the code that is throwing error:
#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) { printf(" Usage: display_image ImageToLoadAndDisplay\n"); return -1; } Mat image; image = imread(argv[1], CV_LOAD_IMAGE_UNCHANGED); // Read the file if( image.empty() ) // Check for invalid input { cout << "Could not open or find the image" << std::endl ; return -1; } namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display. imshow( "Display window", image ); // Show our image inside it. waitKey(0); // Wait for a keystroke in the window return 0; } I compile my code like this: >> g++ read-display-images.cpp -o read-display-images \`pkg-config opencv --cflags --libs\` The code compiles fine. But every time I run it, it exits and displays >> Could not open or find the image The image is in the same folder as the source and the executable. I want help in resolving the issue. Is there a problem with the configuration during the build, or else am I not setting some flags correctly? Any help is greatly appreciated. Thanks.