Problems using HOGDescriptor

落花浮王杯 提交于 2019-12-11 00:42:52

问题


I'm fiddling with a bit of c++/opencv. I was looking some of the samples and haven't manage to compile/run peopledetect.cpp which uses HOGDescriptor.

I've setup a basic Qt Console Application to test and narrow down the problem and got to this basic code:

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

#include <stdio.h>
#include <string.h>
#include <ctype.h>

using namespace cv;
using namespace std;

int main(){
    Mat img = imread("../images/people1.jpg");

    HOGDescriptor hog;

    namedWindow("people detect test");
    imshow("TaDa!",img);
    waitKey(5000);
    return 1;
}

Which doesn't compile because of this line: HOGDescriptor hog;. Here's the compile output Qt gives:

Running build steps for project HoGTest...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/Users/george/Documents/Qt/HoGTest'
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o HoGTest main.o   -F/Users/george/QtSDK/Desktop/Qt/474/gcc/lib -L/Users/george/QtSDK/Desktop/Qt/474/gcc/lib /opt/local/lib/libopencv_core.2.3.1.dylib /opt/local/lib/libopencv_highgui.2.3.1.dylib -framework QtCore 
Undefined symbols:
  "vtable for cv::HOGDescriptor", referenced from:
      cv::HOGDescriptor::HOGDescriptor()in main.o
      cv::HOGDescriptor::~HOGDescriptor()in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [HoGTest] Error 1
make: Leaving directory `/Users/george/Documents/Qt/HoGTest'
The process "/usr/bin/make" exited with code 2.
Error while building project HoGTest (target: Desktop)
When executing build step 'Make'

Unfortunately I'm a n00b when it comes to c++/opencv, so not sure what the error means exactly and how to fix it. Tips/hints ?


回答1:


You need to link with libopencv-objdetect.2.3.1



来源:https://stackoverflow.com/questions/9955972/problems-using-hogdescriptor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!