Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to compile old OpenCV code using 2.4.9

I'm trying to compile some old code of OpenCV that I found here.

However, the code seems quite old. I was able to compile it by adding the new headers

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

using namespace cv;

to the files global.h and IntImage.h, with addition of

#include <opencv/cv.h>

to the IntImage.h.

Note that I don't want to port all the code to OpenCV 2.4.9 right now, but rather to make it work. Thus, once that compile I still obtain the error:

UIUCscene.o: In function IntImage<double>::Load(std::string const&)': UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x20): undefined reference tocvLoadImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x53): undefined reference to cvCreateImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x6b): undefined reference tocvCvtColor' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x78): undefined reference to cvReleaseImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x73c): undefined reference to cvReleaseImage' collect2: error: ld returned 1 exit status make: * [place] Error 1

It seems to me that the problem is linking. However, I'm not sure where the problem is. In the Makefile the flags are set using pkg-config --cflags opencv, and the same for retrieving the libraries.

What am I missing? Any help or pointers are appreciated.

click to hide/show revision 2
added result of running pkg-config

How to compile old OpenCV code using 2.4.9

I'm trying to compile some old code of OpenCV that I found here.

However, the code seems quite old. I was able to compile it by adding the new headers

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

using namespace cv;

to the files global.h and IntImage.h, with addition of

#include <opencv/cv.h>

to the IntImage.h.

Note that I don't want to port all the code to OpenCV 2.4.9 right now, but rather to make it work. Thus, once that compile I still obtain the error:

UIUCscene.o: In function IntImage<double>::Load(std::string const&)': UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x20): undefined reference tocvLoadImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x53): undefined reference to cvCreateImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x6b): undefined reference tocvCvtColor' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x78): undefined reference to cvReleaseImage' UIUCscene.cpp:(.text._ZN8IntImageIdE4LoadERKSs[_ZN8IntImageIdE4LoadERKSs]+0x73c): undefined reference to cvReleaseImage' collect2: error: ld returned 1 exit status make: * [place] Error 1

It seems to me that the problem is linking. However, I'm not sure where the problem is. In the Makefile the flags are set using pkg-config --cflags opencv, and the same for retrieving the libraries.libraries. The result of running pkg-config --libs opencv is

/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_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl

as you can see, the legacy library is there.

What am I missing? Any help or pointers are appreciated.