I am working on Ubuntu 12.04,32 bit platform with OpenCV Version 2.4.1 on eclipse ide. The cvLoadImage() function is returning me a NULL value even after putting the image in the current Location of the project where I have the cpp file.
#include "highgui.h"
#include<iostream>
using namespace std;
int main( int argc, char** argv )
{
char image[80]="baboon.jpg";
IplImage* img = cvLoadImage(image,CV_LOAD_IMAGE_COLOR);
cout<<img<<endl;
}
Following are my include file directory:
-I/usr/local/include/opencv -I/usr/local/include
and
Following are the library files:
/usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so
/usr/local/lib/libopencv_features2d.so
/usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so
/usr/local/lib/libopencv_highgui.so
/usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so
/usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so
/usr/local/lib/libopencv_objdetect.so
/usr/local/lib/libopencv_photo.so
/usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so
/usr/local/lib/libopencv_video.so
/usr/local/lib/libopencv_videostab.so
My img value is always zero (NULL). I am not getting any compilation errors.I checked similar posts on the forum but none of them could solve my problem.I even tried with a PNG image but faced the same issue.Kindly let know if anyone faced a similar issue before.
Thanks in advance
Did you try to give a full path to your image file? If didn’t, make sure the image file is in the folder with an executable file ( some IDEs have a separate folder for debug and for release ).