如何在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.
I want to learn and use haarcascade classifier using OpenCV for detection of object of my choice. I searched the internet and found that createsamples
utility helps in creating dataset for positive and negative images. I know how to install OpenCV in python (pip install opencv-python
works perfectly) but since I need to use that utility I need to build the OpenCV for my windows system.
尝试 1:使用 MinGW 和 cmake
cloned latest OpenCV using git at
"C:\OpenCV"
from https://github.com/opencv/opencv
安装 cmake
它在"C:\OpenCV\build\install"
但令我惊讶的是 opencv_createsamples.exe
不存在
but to my surprise opencv_createsamples.exe
was not present there
opencv_visualisation.exe
、opencv_annotation.exe
、opencv_version.exe
等存在
很明显BUILD_opencv_apps
默认为true
,并且除了这个应用程序之外还创建了其他应用程序
It is clear BUILD_opencv_apps
is true
by default and other apps were created except this one
仍在源文件夹中:createsamples.cpp
存在于 "C:\OpenCV\apps\"
以及 opencv_visualisation.cpp
和其他
still in source folder : createsamples.cpp
is present in "C:\OpenCV\apps\"
along with opencv_visualisation.cpp
and others
尝试 2:从官方网站构建 Visual Studio 14_15
从 https://github.com/opencv/opencv/releases/download/4.0.1/opencv-4.0.1-vc14_vc15.exe 来自 https://github.com/opencv/opencv/releases 网页
在 "C:\OpenCV401\"
仍然令我惊讶的是 "C:\OpenCV401\build\x64\vc14\bin"
没有 opencv_createsamples.exe
同样存在其他文件
still to my surprise at "C:\OpenCV401\build\x64\vc14\bin"
no opencv_createsamples.exe
likewise other files are present
尝试 3
- 这次我从这个 github 页面下载了 Visual Studio 10 版本:https://github.com/abreheret/opencv3.2.0_build
- 在
<OpenCV_DIR>/x64/vc10/bin/
中,所有惊人的文件都存在
- This time I downloaded visual studio 10 build from this github page : https://github.com/abreheret/opencv3.2.0_build
- here at
<OpenCV_DIR>/x64/vc10/bin/
all the amazing files are present
所以,我的问题是:
- 为什么我第一次尝试时没有使用 MinGW 和 cmake 从源代码构建该实用程序
- 为什么他们没有包含在正式版本中
- 如何使用 MinGW 和 cmake 构建以正确获取该实用程序(可能需要一些构建配置?)
推荐答案
Createsamples 在最新的 OpenCV(4.0 及更高版本)中被禁用:这里.
Createsamples was disabled in latest OpenCV (4.0 and greater): here.
这篇关于如何在windows中正确构建opencv获取“opencv_createsamples.exe"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!