Introduction
In this post I am going to show you how to get started with the OpenCV CinderBlock. We are going to use the TinderBox
tool to create a skeleton Visual Studio 2019 project.
A CinderBlock is a prepackaged collection of code and libraries which implement a feature or exposes a library in Cinder. This includes bridges to libraries like OpenCV and FMOD, as well as standalone implementations of features like TUIO support. Cinder ships with several built-in CinderBlocks such as QuickTime and the LocationManager.
So let's dive in.
Get the sources
First we need the sources. We therefor need to clone cinder's master repository and also the OpenCV block.
git clone --recursive git://github.com/cinder/Cinder.git cinder_master
git clone https://github.com/cinder/Cinder-OpenCV3.git
Prepare the CinderBlock
Next we need to manually make some edits to the block. Otherwise TinderBox
will throw an error at us that it cant find some libs when trying to create a new project.
Edit Cinder-OpenCV3\cinderblock.xml
and replace every occurence of $(PlatformTarget)
with either x86
or x64
. Then copy/move the whole folder Cinder-OpenCV3
to cinder_master/blocks
.
To be honest, I don't think that this is the intended way to use this block. Though it makes it work... if you know how this is ment to work, drop me an e-mail!
Create an empty project
Now we should be able to start TinderBox.exe
from cinder_master/tools/TinderBox-Win
. On the first dialoque choose the following values:
Template : OpenCV: Basic
Project Name : CinderOpenCV
Location : C:\Temp\CinderOpenCV
Cinder Version: cinder_master
Environment : VC 2015
Make sure that the platform matches you substituted bitness from the preparation step above.
On the dialogue page, where you can select the CinderBlocks to include, OpenCV3 should show up and the Install-dropdown should have the value Copy
pre-set.
Adjust Project Properties
As a final step we need to modify the project so it uses the correct Plattform Toolset and Windows SDK version.
Right click on the project and under Configuration Properties => General
set the target platform toolset to Visual Studio 2017 (v141)
and windows SDK version to 10.0.18362.0
.
You now should be able to compile and run the provided sample, that shows a blured image of an airplane.
One more thing. If you are looking for further cool CinderBlocks
have a look a this curated list, which I find pretty amazing!