c++ compile error when I try to learn opencv_train_features

E_Jovi

I'm jackaroo to learn how to train features of opencv, and I refer to these under url.

http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html


And above article author recommand to learn with his project, like here.

https://github.com/mrnugget/opencv-haar-classifier-training


And I study step by step, but in the same mould after I copy mergevec.cpp to my opencv apps's directory, like this

cp src/mergevec.cpp ~/opencv-2.4.9/apps/haartraining
cd ~/opencv-2.4.9/apps/haartraining

And then, I want to obtain executable file mergevec by using the following methods

g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp\
cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
cvhaartraining.cpp\
-lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

And I get error

/tmp/cc9GpmMW.o: In function `JpgDatasetGenerator::JpgDatasetGenerator(char const*)':
cvhaartraining.cpp:(.text+0xafd5): undefined reference to `IOutput::createOutput(char const*, IOutput::OutputType)'
/tmp/cc9GpmMW.o: In function `PngDatasetGenerator::PngDatasetGenerator(char const*)':
cvhaartraining.cpp:(.text+0xb24d): undefined reference to `IOutput::createOutput(char const*, IOutput::OutputType)'
cvhaartraining.cpp:(.text+0xb24d): undefined reference to `IOutput::createOutput(char const*, IOutput::OutputType)'


I try to sovle the problem by looking through opecv forum's articles and found almost nothing.

So, um, could anybody help me? thanks a lot..

Saulo Maciel

IOutput is an interface where their methods are declared at ioutput.h and must be implemented somewhere. I found out they were implemented at cvsamplesoutput.cpp so we just need ask gcc to compile that file. For that the correct command should be:

g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp\
cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
cvhaartraining.cpp cvsamplesoutput.cpp\
-lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why there is ambiguous methods error when try to compile code?

Why do I get an error for "__CrtGetFileInformationByHandleEx " when I try to compile

I get stray '#' in program error when I try to compile this program

Webpack will not compile when I try to import a mongoose model

Error package org.apache.spark.sql is not a value when I try to compile a SBT in Spark- Scala

Error when i try to opendir

When I try to compile OpenCv with inference engine enabled, I am getting an error

Compile error when try to create singleton using shared_ptr

Fails to compile, when I try to use include with EJS files. (Error: Child compilation failed.)

Whenever I try to compile javascript code I get a syntax error

Trying to set up the GNU C++ COMPILER, but I get an error I don't understand when I try to compile hello.cpp

New to c++ getting an error when I try to compile

Error occurred when I try to compile my code

When I compile in C I have an error of imports in header files

I get this error when I try to install

Why does my c++ code keep returning 'undefined reference to' one of my constructors when I try to compile?

error when I try to load a fixture

Errors when I try to compile old Android Native App

Error occurs when I try to call an inherited function in C++

Why do I get a linker error while I try to compile a C file?

Error when I try install a C kernel for jupyter

Gcc throws error when I try to compile the test folder in libburn

I'm getting an infinite true bool error when I try to compile this C code and I don't know why

Failed to compile values file' when i try to run my app

value.isEmpty is throwing error in when i try to compile the code

Error about operator overloading when I try to compile this code

"An annotation argument must be a compile-time constant" error when I try to add a yesterday date to GET parameters (NASA APOD API)

I get the error "fatal error: Tablero.h: No such file or directory" when trying to compile C++

when i try to run this cmd "npm run compile:sass" is show me this error