windows中如何正确构建opencv得到"opencv_createsamples.exe"

How to build opencv correctly in windows to get "opencv_createsamples.exe"

我想学习和使用使用 OpenCV 的 haarcascade 分类器来检测我选择的对象。我在互联网上搜索,发现 createsamples 实用程序有助于为正面和负面图像创建数据集。我知道如何在 python 中安装 OpenCV(pip install opencv-python 完美运行)但是因为我需要使用该实用程序,所以我需要为我的 windows 系统构建 OpenCV。


我尝试在 windows

中安装 OpenCV

尝试 1:使用 MinGW 和 cmake

它在 "C:\OpenCV\build\install"

中创建了一个安装目录

但令我惊讶的是 opencv_createsamples.exe 不在那里

opencv_visualisation.exeopencv_annotation.exeopencv_version.exe

screenshot of install files generated

screenshot of build options selected in cmake by default

很明显 BUILD_opencv_apps 默认是 true 并且创建了除此之外的其他应用程序

仍在源文件夹中:createsamples.cppopencv_visualisation.cpp 和其他

一起出现在 "C:\OpenCV\apps\"

尝试 2:visual studio14_15 从官方网站构建

仍然令我惊讶 "C:\OpenCV401\build\x64\vc14\bin" 没有 opencv_createsamples.exe 同样存在其他文件

screenshot of files present in build

尝试 3

screenshot of files present in this build


那么,我的问题是:

Createsamples 在最新的 OpenCV(4.0 及更高版本)中被禁用:here