Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize CMake script #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Build folder
**/build

# Temporary user files
**/CMakeLists.txt.user
38 changes: 28 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
cmake_minimum_required(VERSION 2.8)
project(test)
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(KCF LANGUAGES CXX)

find_package(OpenCV REQUIRED)
## build settings:

set(CMAKE_CXX_STANDARD 11)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the build type" FORCE)
endif()

if(NOT WIN32)
ADD_DEFINITIONS("-std=c++0x -O3")
endif(NOT WIN32)
set(CMAKE_CXX_FLAGS_RELEASE -O3)

include_directories(src)
FILE(GLOB_RECURSE sourcefiles "src/*.cpp")
add_executable( KCF ${sourcefiles} )
target_link_libraries( KCF ${OpenCV_LIBS})
## 3rd-party dependencies:

find_package(OpenCV REQUIRED)

## executable:

set(sources
src/fhog.cpp
src/kcftracker.cpp
src/runtracker.cpp)

set(headers
src/ffttools.hpp
src/fhog.hpp
src/kcftracker.hpp
src/labdata.hpp
src/recttools.hpp
src/tracker.h)

add_executable(${PROJECT_NAME} ${sources} ${headers})
target_include_directories(${PROJECT_NAME} PUBLIC src)
target_link_libraries(${PROJECT_NAME} PUBLIC ${OpenCV_LIBS})
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ Description: KCF on HOG and Lab features, ported to C++ OpenCV. The Lab features
The CSK tracker [2] is also implemented as a bonus, simply by using raw grayscale as features (the filter becomes single-channel).

### Compilation instructions ###
There are no external dependencies other than OpenCV 3.0.0. Tested on a freshly installed Ubuntu 14.04.

1) cmake CMakeLists.txt
2) make
There are no external dependencies other than [OpenCV](https://opencv.org/) 3.0.0. Tested on a freshly installed Ubuntu 14.04. It is recommended to do an *out-of-source* build, as in:

```shh
KCFcpp$ mkdir build
KCFcpp$ cd build
KCFcpp/build$ cmake ..
KCFcpp/build$ cmake --build .
```

### Running instructions ###

Expand All @@ -45,7 +50,7 @@ fixed_window - Keep the window size fixed when in single-scale mode (multi-scale
show - Show the results in a window.

To include it in your project, without the VOT toolkit you just need to:

// Create the KCFTracker object with one of the available options
KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB);

Expand Down