I'm new to openCV and to C/C++ in general. I'm working on this tutorial and using CMake to generate my makefiles. I have no problem building the first program (Read and Display), but when I run the executable, nothing happens and I must close out of my terminal because it just hangs. This happens even when I just use the following code:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, const char** argv )
{
cout << "start\n";
Mat img = imread("MyPic.jpg");
return 0;
}
When I delete Mat img
line, "start" is outputted, but when I include it even that does not happen. MyPic.jpg is definitely in the same directory as the ReadDisplay.cpp and CMakeLists.txt. I am running Ubuntu 14.04. Finally, here is CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project( ReadDisplay )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( ReadDisplay ReadDisplay.cpp )
target_link_libraries( ReadDisplay ${OpenCV_LIBS} )
Any insights as to why this is causing issues?
Edit
The above code was to explain how I was debugging and what was causing the problem; I've already tried catching the failure by checking image size and other methods to isolate it as a system/configuration issue. As per this post, I'm rebuilding openCV from source to see if that will fix anything.