Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caffe: opencv error

I've built opencv 3.0 from source and can run a few sample apps, build against the headers ok so I presume it's installed successfully.

I'm also using python3 and I now go to install and build caffe. I set a few variables in Makefile.config as I'm using the CPU due to having an AMD GPU and also Anaconda.

When I run make all I get this error:

$ make all
CXX/LD -o .build_release/examples/cpp_classification/classification.bin
/usr/bin/ld: .build_release/examples/cpp_classification/classification.o: undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi'
//usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:565: recipe for target '.build_release/examples/cpp_classification/classification.bin' failed
make: *** [.build_release/examples/cpp_classification/classification.bin] Error 1

from searching I think this is something to do with using openCV 3 but I'm not sure where to start looking for a solution. Any help?

And yes I'm one of the horde of inexperienced users looking to fiddle with the Google Inception learning technique.

like image 310
user1561108 Avatar asked Jul 06 '15 19:07

user1561108


3 Answers

You can also add the opencv_imgcodecs to the MakeFile in line 187, see this pull.

like image 108
Jon Avatar answered Oct 20 '22 23:10

Jon


It could be that you are using OpenCV version 3. If yes just uncomment the following line in your Makefile.config:

# OPENCV_VERSION := 3

So it will look like

OPENCV_VERSION := 3

You could verify the version currently in use by doing:

$ python
>>> import cv2
>>> cv2.__version__
'3.1.0-dev'
like image 43
MZHm Avatar answered Oct 20 '22 23:10

MZHm


The problem report is very clear. There is a problem with linking library libraries.The reason may be the difference between 3.0 and 2.x. You need to add

opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

into LIBRARIES +=.

like image 45
慕容曜 Avatar answered Oct 20 '22 23:10

慕容曜