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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With