Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot compile mergevec.cpp from Haartraining tutorial

I have been following this tutorial ( http://note.sonots.com/SciSoftware/haartraining.html ) to do some Haar training. I am currently stuck on creating the training samples, specifically the combining of the .vec files. I am provided with this ( http://note.sonots.com/SciSoftware/haartraining/mergevec.cpp.html ) file and a description of how to build it for Linux (Ubuntu 11.04). Here lies my problem, I am unable to build the mergevec code. The only error is "fatal error: cvhaartraining.h: No such file or directory." I have checked to make sure that cvhaartraining.h is in the same directory as mergevec but have found everything to be right where I would expect it. At this point, I am at a loss of how to solve this, so any help would be greatly appreciated.

like image 655
Chris Crutchfield Avatar asked May 21 '11 03:05

Chris Crutchfield


1 Answers

For building mergevec I found that the easiest way was to edit CMake configuration files. In OpenCV 2.3.1, the haartraining directory is in modules/haartraining whereas in 2.4.5 it is in apps/haartraining. Either way, the file you are interested in editing is called CMakeLists.txt.

The easiest thing to do is to add a special section for mergevec, as follows:

# -----------------------------------------------------------
#  mergevec
# -----------------------------------------------------------
add_executable(opencv_mergevec mergevec.cpp)
set_target_properties(opencv_mergevec PROPERTIES
                      DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
                      OUTPUT_NAME "opencv_mergevec")

You can add this right before the installation section. Then place mergevec.cpp into the haartraining directory, build OpenCV normally, and you will have an opencv_mergevec binary which is the mergevec.cpp executable.

like image 179
angelatlarge Avatar answered Sep 18 '22 22:09

angelatlarge