问题描述
我一直在遵循本教程()文件和如何为Linux(Ubuntu 11.04)构建它的描述。这里是我的问题,我无法构建mergevec代码。唯一的错误是致命错误:cvhaartraining.h:没有这样的文件或目录。我检查,以确保cvhaartraining.h与mergevec在同一目录,但发现一切正确的地方,我会期望它。
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.
推荐答案
对于建筑物来说,这是一个很好的解决方案。 mergevec我发现最简单的方法是编辑CMake配置文件。在OpenCV 2.3.1中, haartraining
目录在 modules / haartraining
中,而在2.4.5中它在 apps / haartraining。
无论哪种方式,您感兴趣编辑的文件称为 CMakeLists.txt
。
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
.
最简单的做法是为mergevec添加一个特殊部分,如下所示:
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")
$ b b
您可以在安装部分之前添加。然后将 mergevec.cpp
放入 haartraining
目录,正常构建OpenCV,您将有一个 opencv_mergevec
binary是 mergevec.cpp
可执行文件。
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.
这篇关于不能编译mergevec.cpp从Haartraining教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!