Skip to content

Instantly share code, notes, and snippets.

@kid1412-net
Last active August 29, 2015 14:13
Show Gist options
  • Save kid1412-net/74ae4f3c07a589386976 to your computer and use it in GitHub Desktop.
Save kid1412-net/74ae4f3c07a589386976 to your computer and use it in GitHub Desktop.
Using Cmake with Edge Based Temlate Matching

1. Download source code from this site

http://www.codeproject.com/Articles/99457/Edge-Based-Template-Matching

2. Copy all .h and .cpp files to a new folder named src

3. Copy CMakeLists.txt to src folder

4. Generate Visual Studio project using CMake

# Setup build environment for OpenCV
setx -m OPENCV_DIR C:\opencv\build
setx -m PATH "%PATH%;C:\opencv\build\x86\vc10\bin"

# Run cmake
cd src
mkdir build
cd build
cmake ..\

5. Open Visual Studio Command Prompt to build the project

cd src\build
devenv geomatch.sln /Build

6. Run the example

cd src\build\Debug
run.bat

Notes

  • For Windows 8, 8.1, use CMake 3.x to generate a VS project solution
  • For Windows 7, Windows Vista, Windows XP, use CMake 2.x to generate a VS project solution
cmake_minimum_required(VERSION 2.3)
project( geomatch )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
SET(SRC
main.cpp
GeoMatch.h
GeoMatch.cpp
CommandParser.h
CommandParser.cpp
stdafx.h
stdafx.cpp
targetver.h
)
add_executable( geomatch ${SRC} )
target_link_libraries( geomatch ${OpenCV_LIBS} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment