Several of the Syntro Demo applications use OpenCV the Open Source Computer Vision Library.
We’ve had some mixed luck using the pre-built binaries included in the OpenCV download, particularly when using the MinGW compiler that comes with QtCreator.
These instructions avoid conflicts by building the OpenCV binaries using the same compiler used with the Syntro apps.
If you have a working OpenCV installation on your machine with a Qt capable compiler, you do not have to follow these instructions.
For the SyntroDemo apps, the build files want an environment variable
so the following paths can be used in the projects
Download the following files
OpenCV-2.3.1-win-superpack.exe from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3.1/
cmake-2.8.7-win32-x86.exe from http://www.cmake.org/cmake/resources/software.html
CMake is required to configure the OpenCV build files.
Run cmake-2.8.7-win32-x86.exe and do a default install.
This will add CMake to the Start menu.
This will extract the OpenCV source code and prebuilt binaries. The default location
is a folder opencv where you placed the download.
For this example
Run CMake (cmake-gui) from the Start menu.
In the CMake GUI window set the following
Where is the source code: C:/Users/scott/Downloads/opencv
Where to build the binaries: C:/Users/scott/Downloads/opencv-build
Then click the Configure button.
In the first dialog that appears, click Yes to create the opencv-build directory.
In the next dialog, your response depends on the compiler you are using.
Visual Studio users should select Visual Studio 10 or Visual Studio 10 Win64
depending on your platform.
MinGW users should select MinGW Makefiles
If you have only one compiler installed, you can leave Use default native compilers selected.
If you have more then one compiler, you may have to specify the correct one.
After CMake works for a little while, you will get a Configuring done message in the
output window at the bottom.
In the center of the window is an area where you can customize the OpenCV build.
We are only going to make one change to the CMAKE_INSTALL_PREFIX.
CMAKE_INSTALL_PREFIX = C:/OpenCV2.3.1
Now click the Configure button once again so the change is included.
When this second configuration is done, the Generate button should become active.
Click the Generate button and CMake should show a Generate done message in the lower window.
You can now close CMake.
Option 1 – Building OpenCV with Visual Studio
Start Visual Studio and open the OpenCV.sln in the opencv-build directory.
Using the menu select Build|Batch Build….
In the Batch Build dialog check the INSTALL Debug and INSTALL Release builds and click the Rebuild button.
The build will take a little while.
Option 2 – Building OpenCV with MinGW
These instructions assume the MinGW compiler tools are installed and that the MinGW bin directory is in the
Instructions for this setup are here – Qt with QtCreator and MinGW
Open up a Cmd window and change to the opencv-build directory.
Once there run the following command
This will force a build and then an install.
Eventually you should finish with a screen like this.
When the build is complete with either of the compiler options, you should have a C:\OpenCV2.3.1 directory that looks like this
Create the following environment variable
and add %OPENCVDIR%\bin to your PATH.
You can get access to the ‘Environment Variables’ dialog this way
-- System and Security
------ Advanced system settings
-------- Environment Variables
You can add the new values to the ‘User variables’ section.
OpenCV is now ready for use in Syntro projects.
Checkout the following SyntroDemo projects for examples of how to incorporate OpenCV into a Syntro app.