cpp-boilerplate-minimal is a skeleton for writing image processing C++. It contains a solid working CMakeLists structure, some fundamental thirdparty libraries built from source, and an adapted OpenCV sample to get you up to speed quickly.
Why 'minimal'? Because there's a not-so-minimal version with useful infrastructure frameworks not yet open-sourced.
- Copy (probably not clone unless you know better) the contents of this repository
- Replace "CPPBP" and "cppbp" in the root CMakeLists.txt and files within cmake/ folder to some short codename of your project
- Set up prerequisite libraries Boost and OpenCV (see below)
- Build the sample
- build new stuff based on the sample
Assuming Visual Studio 9 2008 as your sole installed compiler. Then from the root of the copied & customized cpp-boilerplate, run this:
- mkdir build.vc9 && cd build.vc9
- cmake ..
- start .sln
- Build Solution (F7)
To run the sample, OpenCV dlls must be in the system path.
If you already have Boost installed or built, just set the BOOST_ROOT
environment variable, like this:
set BOOST_ROOT=c:\Users\ansgri\thirdparty-src\boost_1_54_0
Otherwise, build it first following this approximate procedure:
- you must have Visual Studio (or other compiler of choice) installed (obviously)
- download and unpack the source archive
- from the unpacked source dir execute
bootstrap.bat
- review the build options:
b2 --help
- build like this:
b2 link=shared variant=release threading=multi runtime-link=shared
TODO: instructions for the case when OpenCV is installed via binary installer
Building from source on Windows:
git clone git://github.com/Itseez/opencv.git
git checkout 2.4.6
(or other stable tag; to see all, executegit tag
)mkdir build.user && cd build.user
cmake .. && start OpenCV.sln
- build solution (F7) in both Release and Debug configurations
- build 'INSTALL' target in both Release and Debug configurations (in Solution Explorer, right-click and Build, it's in CMake Targets folder)
- you'll have
install
folder underbuild.user
. Its full path must be set toOpenCV_DIR
environment variable.