Kann nicht kompiliert OpenCV code (C++)

Okay, so habe ich die Suche für dieses problem für eine Weile, und ich bin immer noch ratlos, wie es zu lösen.

Ich versuche, führen Sie den Beispielcode finden Sie hier: http://docs.opencv.org/trunk/d1/dc5/tutorial_background_subtraction.html.
Ich verstehe den code. Ich kann einfach nicht bekommen, es zu kompilieren! Das problem ist mit Bibliothek umfasst. Hier ist meine Makefile:

CFLAGS = `pkg-config --cflags opencv`
LIBS = `pkg-config --libs opencv`

% : %.cpp
    g++ $(CFLAGS) $(LIBS) -o $@ $<

Hier ist die Fehler:

prakhar@inS4n3 ~/dev/gender recognition $ make bs
g++ `pkg-config --cflags opencv` `pkg-config --libs opencv` -o bs bs.cpp
bs.cpp:2:33: fatal error: opencv2/imgcodecs.hpp: No such file or directory
 #include "opencv2/imgcodecs.hpp"
                                 ^
compilation terminated.
Makefile:5: recipe for target 'bs' failed
make: *** [bs] Error 1

Wenn ich (vorerst) kommentieren Sie diese Datei, bekomme ich eine ähnliche Fehlermeldung mit imgproc.hpp. In einem anderen meiner OpenCV code, die folgenden kompiliert prefectly:

#include "opencv2/core/core.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/highgui/highgui.hpp"

Soweit ich das beurteilen kann, ersetzen opencv2/core.hpp mit opencv2/core/core.hpp oder ersetzen opencv2/imgproc.hpp mit opencv2/imgproc/imgproc.hpp macht den job.

Also schaute ich tiefer und hier ist meine opencv2 Ordner:

prakhar@inS4n3 /usr/include/opencv2 $ ll
total 84
drwxr-xr-x 2 root root 4096 Nov 14 19:42 calib3d
drwxr-xr-x 2 root root 4096 Nov 14 19:42 contrib
drwxr-xr-x 2 root root 4096 Nov 14 19:42 core
drwxr-xr-x 2 root root 4096 Nov 14 19:42 features2d
drwxr-xr-x 2 root root 4096 Nov 14 19:42 flann
drwxr-xr-x 3 root root 4096 Nov 14 19:42 gpu
drwxr-xr-x 2 root root 4096 Nov 14 19:42 highgui
drwxr-xr-x 2 root root 4096 Nov 14 19:42 imgproc
drwxr-xr-x 2 root root 4096 Nov 14 19:42 legacy
drwxr-xr-x 2 root root 4096 Nov 14 19:42 ml
drwxr-xr-x 2 root root 4096 Nov 14 19:42 nonfree
drwxr-xr-x 2 root root 4096 Nov 14 19:42 objdetect
drwxr-xr-x 2 root root 4096 Nov 14 19:42 ocl
-rw-r--r-- 1 root root 2751 Oct  1  2014 opencv.hpp
-rw-r--r-- 1 root root  672 Nov 12 00:02 opencv_modules.hpp
drwxr-xr-x 2 root root 4096 Nov 14 19:42 photo
drwxr-xr-x 3 root root 4096 Nov 14 19:42 stitching
drwxr-xr-x 2 root root 4096 Nov 14 19:42 superres
drwxr-xr-x 2 root root 4096 Nov 14 19:42 ts
drwxr-xr-x 2 root root 4096 Nov 14 19:42 video
drwxr-xr-x 2 root root 4096 Nov 14 19:42 videostab

Kann mir jemand sagen, warum dies geschieht, und wie bekomme ich die imgcodecs.hpp und videoio.hpp Module?
Ich bin mit OpenCV 2.4.10-2 auf Arch Linux.

  • einfach include "opencv2/opencv.hpp" ... alles andere ist enthalten in
  • Hallo, ich bekomme eine Fehlermeldung bs.cpp:52:44: error: ‘createBackgroundSubtractorMOG2’ was not declared in this scope also wahrscheinlich brauche ich noch etwas?
  • vergleichen Sie beantworten hier stackoverflow.com/questions/19221877/...
InformationsquelleAutor ps95 | 2015-05-12
Schreibe einen Kommentar