Ask Your Question

Millinia's profile - activity

2019-02-07 12:33:18 -0600 received badge  Famous Question (source)
2016-09-02 13:19:51 -0600 received badge  Notable Question (source)
2015-12-02 09:08:13 -0600 received badge  Popular Question (source)
2014-03-03 10:54:42 -0600 commented question Error in function imread() - cannot read image

when i attempted to use the function getBuildInformation() it said that the function is not a part of the library :-/ Any ideas?

2014-02-24 23:00:05 -0600 commented answer Error in function imread() - cannot read image

Sorry about the code typos, my code is correct in comparing the two, I had just transcribed it wrong. It compiles without any errors. I am working on a the beagleboard xm microprocessor and didn't port over the code to my laptop to paste the code. Which probably doesn't help in getting my problem resolved. Again sorry for the confusion.

2014-02-24 15:15:34 -0600 asked a question Error in function imread() - cannot read image

I am just starting to work in the OpenCV library coding in C++. I am using CMake v2.8.3(which I have never used before) to build and compile my project on an ubuntu 11.04 distribution.

I have the source code LearnImgProcess1.cpp and the CMakeLists.txt in "/home/ubuntu/ImgProcessing/Example1"

CMakeLists.txt


cmake_minimum_required(VERSION 2.8)
Project(Example1)
find_package( OpenCV REQUIRED)
add_executable(Example1 LearnImgProcess1.cpp)
target_link_libaries(Example1 ${OpenCV_LIBS})

LearnImgProcess.cpp


#include < iostream >
#include < opencv2/core/core.hpp >
#include < opencv2/highgui/highgui.hpp >

using namespace std;
using namespace cv;

int main(int argc, char** argv)
{
Mat img = imread(argv[1], -1);

if(img.empty())
{
cout<<"image not found or read!<<endl; <="" br=""> return -1;
}

namedWindow("Picture Displayer", WINDOW_AUTOSIZE);
imshow("Picture Displayer", img);
waitkey(0);
destroyWindow("Picture Displayer");

return 0;

}


I compile in the terminal, in the same directory as before, by entering "cmake ." followed by "make"
In the terminal, in the current "/home/ubuntu/ImgProcessing/Example1" directory
I then type in " ./Example1 sample.jpg "

I then recieve my "image not found or read!" error.

The image is located in the same directory as the source code :
"/home/ubuntu/ImgProcessing/Example1"

I have tried running with " ./Example1 "/home/ubuntu/ImgProcessing/Example1/sample.jpg" "
and "/.Example1 "..sample.jpg" "

I have tried different file formats.

I have placed copy images in "/home/ubuntu/ImgProcessing/Example1/CMakeFiles/Example1.dir/sample.jpg" thinking that maybe it was trying to get an image from that directory.

I have been looking on forums for the past couple of days trying to figure it out, but have had no luck. Any help would be appreciated.

It is entirely possible that this might be a CMake issue, as I don't fully understand how to use it. I have also tried approaching the problem from that end. However if that is the case, if anyone knows how to fix it from that end and wouldn't mind giving some insight, that would also be appreciated.