Skip to content

Commit

Permalink
Refactoring: split project to share library and example (Smorodov#104)
Browse files Browse the repository at this point in the history
* Added hough3d sources

* Calculate 3D hough trajectory lines

* Added fps

* Some warnings removing

* Fixed warning

* Added small crops in DNN detector for High resolution videos and small objects

* Small refactoring

* Some fix for single tracking

* Added openmp flags to the compiler

* Draw trajectory option

* Update Readme

* Fixed link

* Hough3D disabled now in CMake

* Added Yolo (and Tiny Yolo) detector

* Update Readme

* Remove unused Hybrid face detector

* Extract Capture+Detection into the separate thread

* Fixed potential deadlock

* Points visualization

* Control out the frame moving

* Remove hough3d from master

* Fixed NMS for object with different types

* Fix in Readme and TODO

* OpenCV 4.0 ready

* Added YOLO v3 tiny

* Added compute target for DNN examples (default is OpenCL_FP16)

* Fixed compatible bug with OpenCV version < 4.0

* Fixed project name in CMake

* Simple implementation of the Abandoned detection

* Increased timeout

* Fixed help message

* Added Abandoned to the Readme

* Fixed Readme

* Switch travis to the latest OpenCV 3.4.1 version

* Set timeouts to 60 sec

* Fixed travis script for OpenCV 3.4.1

* Fixed travis for gcc6

* Fixed linker error

* Fixed compiler in travis

* Fixed travis and CMakeLists for C++14 support

* Capture for webcams

* Fix bug with ROI for local tracking

* Automatic inertia correction in linear Kalman filter

* Update TODO

* Yolo eample refactoring

* Refactoring: split project to share library and example

* Added cars counting example

* Fix for OpenCV 4.0
  • Loading branch information
Nuzhny007 authored and Smorodov committed Sep 28, 2018
1 parent 37832df commit 5e0b213
Show file tree
Hide file tree
Showing 153 changed files with 895 additions and 240 deletions.
230 changes: 6 additions & 224 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# ----------------------------------------------------------------------------
# минимальная версия CMake, способная переварить этот файл
# ----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
project(MultitargetTracker)

project(MultitargetTracking)

unset(CMAKE_CXX_FLAGS CACHE)

Expand All @@ -25,225 +23,9 @@ set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})

# ----------------------------------------------------------------------------
# Предполагаем, что FindOpenCV.cmake расположен по адресу CMAKE_MODULE_PATH.
# ----------------------------------------------------------------------------
FIND_PACKAGE(OpenCV)
# ----------------------------------------------------------------------------
# ищем все .cpp и .h файлы и добавляем их в наш проект
# ----------------------------------------------------------------------------
set(folder_source
main.cpp
VideoExample.cpp

Detector/BaseDetector.cpp
Detector/MotionDetector.cpp
Detector/BackgroundSubtract.cpp
Detector/vibe_src/vibe.cpp
Detector/Subsense/BackgroundSubtractorLBSP.cpp
Detector/Subsense/BackgroundSubtractorLOBSTER.cpp
Detector/Subsense/BackgroundSubtractorSuBSENSE.cpp
Detector/Subsense/LBSP.cpp
Detector/FaceDetector.cpp
Detector/PedestrianDetector.cpp
Detector/pedestrians/c4-pedestrian-detector.cpp
Detector/SSDMobileNetDetector.cpp
Detector/YoloDetector.cpp

Tracker/Ctracker.cpp
Tracker/track.cpp
Tracker/HungarianAlg/HungarianAlg.cpp
Tracker/LocalTracker.cpp
Tracker/Kalman.cpp
)

set(folder_headers
MouseExample.h
VideoExample.h
nms.h
defines.h

Detector/BaseDetector.h
Detector/MotionDetector.h
Detector/BackgroundSubtract.h
Detector/vibe_src/vibe.hpp
Detector/Subsense/BackgroundSubtractorLBSP.h
Detector/Subsense/BackgroundSubtractorLOBSTER.h
Detector/Subsense/BackgroundSubtractorSuBSENSE.h
Detector/Subsense/DistanceUtils.h
Detector/Subsense/LBSP.h
Detector/Subsense/RandUtils.h
Detector/FaceDetector.h
Detector/PedestrianDetector.h
Detector/pedestrians/c4-pedestrian-detector.h
Detector/SSDMobileNetDetector.h
Detector/YoloDetector.h

Tracker/Ctracker.h
Tracker/track.h
Tracker/HungarianAlg/HungarianAlg.h
Tracker/LocalTracker.h
Tracker/Kalman.h
)

set(graph_source
Tracker/graph/tokenise.cpp
# Tracker/graph/script.cpp
# Tracker/graph/rings.cpp
Tracker/graph/mytree.cpp
Tracker/graph/mygraph.cpp
Tracker/graph/mwbmatching.cpp
Tracker/graph/mincut.cpp
Tracker/graph/gport.cpp
# Tracker/graph/gml2nestedsql.cpp
# Tracker/graph/gml2dot.cpp
# Tracker/graph/components.cpp
Tracker/graph/fheap.c
)

set(graph_header
Tracker/graph/tokenise.h
Tracker/graph/mytree.h
Tracker/graph/mygraph.h
Tracker/graph/mwbmatching.h
Tracker/graph/mincut.h
Tracker/graph/gport.h
Tracker/graph/gdefs.h
Tracker/graph/fheap.h
)

set(gtl_source
Tracker/graph/GTL/src/bellman_ford.cpp
Tracker/graph/GTL/src/bfs.cpp
Tracker/graph/GTL/src/biconnectivity.cpp
Tracker/graph/GTL/src/bid_dijkstra.cpp
Tracker/graph/GTL/src/components.cpp
Tracker/graph/GTL/src/debug.cpp
Tracker/graph/GTL/src/dfs.cpp
Tracker/graph/GTL/src/dijkstra.cpp
Tracker/graph/GTL/src/edge.cpp
Tracker/graph/GTL/src/embedding.cpp
Tracker/graph/GTL/src/fm_partition.cpp
Tracker/graph/GTL/src/gml_parser.cpp
Tracker/graph/GTL/src/gml_scanner.cpp
Tracker/graph/GTL/src/graph.cpp
Tracker/graph/GTL/src/maxflow_ff.cpp
Tracker/graph/GTL/src/maxflow_pp.cpp
Tracker/graph/GTL/src/maxflow_sap.cpp
Tracker/graph/GTL/src/min_tree.cpp
Tracker/graph/GTL/src/node.cpp
Tracker/graph/GTL/src/planarity.cpp
Tracker/graph/GTL/src/pq_node.cpp
Tracker/graph/GTL/src/pq_tree.cpp
Tracker/graph/GTL/src/ratio_cut_partition.cpp
Tracker/graph/GTL/src/st_number.cpp
Tracker/graph/GTL/src/topsort.cpp
)

set(gtl_header
Tracker/graph/GTL/include/GTL/algorithm.h
Tracker/graph/GTL/include/GTL/bellman_ford.h
Tracker/graph/GTL/include/GTL/bfs.h
Tracker/graph/GTL/include/GTL/biconnectivity.h
Tracker/graph/GTL/include/GTL/bid_dijkstra.h
Tracker/graph/GTL/include/GTL/bin_heap.h
Tracker/graph/GTL/include/GTL/components.h
Tracker/graph/GTL/include/GTL/debug.h
Tracker/graph/GTL/include/GTL/dfs.h
Tracker/graph/GTL/include/GTL/dijkstra.h
Tracker/graph/GTL/include/GTL/edge.h
Tracker/graph/GTL/include/GTL/edge_data.h
Tracker/graph/GTL/include/GTL/edge_map.h
Tracker/graph/GTL/include/GTL/embedding.h
Tracker/graph/GTL/include/GTL/fm_partition.h
Tracker/graph/GTL/include/GTL/gml_parser.h
Tracker/graph/GTL/include/GTL/gml_scanner.h
Tracker/graph/GTL/include/GTL/graph.h
Tracker/graph/GTL/include/GTL/maxflow_ff.h
Tracker/graph/GTL/include/GTL/maxflow_pp.h
Tracker/graph/GTL/include/GTL/maxflow_sap.h
Tracker/graph/GTL/include/GTL/min_tree.h
Tracker/graph/GTL/include/GTL/ne_map.h
Tracker/graph/GTL/include/GTL/node.h
Tracker/graph/GTL/include/GTL/node_data.h
Tracker/graph/GTL/include/GTL/node_map.h
Tracker/graph/GTL/include/GTL/planarity.h
Tracker/graph/GTL/include/GTL/pq_node.h
Tracker/graph/GTL/include/GTL/pq_tree.h
Tracker/graph/GTL/include/GTL/ratio_cut_partition.h
Tracker/graph/GTL/include/GTL/st_number.h
Tracker/graph/GTL/include/GTL/symlist.h
Tracker/graph/GTL/include/GTL/topsort.h
Tracker/graph/GTL/include/GTL/version.h
Tracker/graph/GTL/include/GTL/GTL.h
)

SOURCE_GROUP("Source Files" FILES ${folder_source})
SOURCE_GROUP("Header Files" FILES ${folder_headers})

SOURCE_GROUP("graph" FILES ${graph_source} ${graph_header})
SOURCE_GROUP("GTL" FILES ${gtl_source} ${gtl_header})
FIND_PACKAGE(OpenCV)

include(CheckIncludeFileCXX)
check_include_file_cxx(opencv2/bgsegm.hpp HAVE_OPENCV_CONTRIB)
if(HAVE_OPENCV_CONTRIB)
add_definitions(-DHAVE_OPENCV_CONTRIB)
add_subdirectory(src)
add_subdirectory(example)
add_subdirectory(cars_counting)

option(USE_OCV_BGFG "Should use the bgfg algorithms from opencv_contrib?" ON)
option(USE_OCV_KCF "Should use the KCF tracker from opencv_contrib for collisions resolving?" ON)
option(USE_OCV_UKF "Should use the Unscented Kalman Filterr from opencv_contrib?" ON)

else(HAVE_OPENCV_CONTRIB)

option(USE_OCV_BGFG "Should use the bgfg algorithms from opencv_contrib?" OFF)
option(USE_OCV_KCF "Should use the KCF tracker from opencv_contrib for collisions resolving?" OFF)
option(USE_OCV_UKF "Should use the Unscented Kalman Filterr from opencv_contrib?" OFF)
endif(HAVE_OPENCV_CONTRIB)

if(USE_OCV_UKF)
add_definitions(-DUSE_OCV_UKF)
endif(USE_OCV_UKF)

if(USE_OCV_KCF)
add_definitions(-DUSE_OCV_KCF)
endif(USE_OCV_KCF)

if(USE_OCV_BGFG)
add_definitions(-DUSE_OCV_BGFG)
endif(USE_OCV_BGFG)

# ----------------------------------------------------------------------------
# создаем проект
# ----------------------------------------------------------------------------
ADD_EXECUTABLE(MultitargetTracker ${folder_source} ${folder_headers} ${graph_source} ${graph_header} ${gtl_source} ${gtl_header})
# ----------------------------------------------------------------------------
# добавляем include директории
# ----------------------------------------------------------------------------
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/Detector
${PROJECT_SOURCE_DIR}/Detector/vibe_src
${PROJECT_SOURCE_DIR}/Detector/Subsense
${PROJECT_SOURCE_DIR}/Tracker
${PROJECT_SOURCE_DIR}/Tracker/HungarianAlg
${PROJECT_SOURCE_DIR}/Tracker/graph
${PROJECT_SOURCE_DIR}/Tracker/graph/GTL/include)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})

# ----------------------------------------------------------------------------
# и Lib-ы opencv
# ----------------------------------------------------------------------------


if (CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
# iconv
)
else(CMAKE_COMPILER_IS_GNUCXX)
set(LIBS
${OpenCV_LIBS}
)
endif()
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBS})
16 changes: 12 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
+ Integrate: https://github.com/nwojke/mcf
+ New Multitarget tracking algorithm based on Discrete-Continuous Energy Minimization: https://bitbucket.org/amilan/dctracking
+ Deep SORT: https://github.com/nwojke/deep_sort
+ Yolo v3 detector
Global data association for multi-object tracking using network flows:
1. https://github.com/nwojke/mcf
2. https://github.com/jutanke/cabbage
3. Tracking The Untrackable: Learning To Track Multiple Cues with Long-Term Dependencies
4. http://openaccess.thecvf.com/content_cvpr_2017/papers/Tang_Multiple_People_Tracking_CVPR_2017_paper.pdf
5. https://github.com/abhineet123/Deep-Learning-for-Tracking-and-Detection

Deep SORT:
1. https://github.com/nwojke/deep_sort
2. https://github.com/bitzy/DeepSort
3. https://github.com/oylz/DS

33 changes: 33 additions & 0 deletions cars_counting/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required (VERSION 2.8)

project(CarsCounting)

set(SOURCES
main.cpp
CarsCounting.cpp
)

set(HEADERS
CarsCounting.h
)

ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES} ${HEADERS})

# ----------------------------------------------------------------------------
# добавляем include директории
# ----------------------------------------------------------------------------
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}/../src
${PROJECT_SOURCE_DIR}/../src/Detector
${PROJECT_SOURCE_DIR}/../src/Detector/vibe_src
${PROJECT_SOURCE_DIR}/../src/Detector/Subsense
${PROJECT_SOURCE_DIR}/../src/Tracker
${PROJECT_SOURCE_DIR}/../src/Tracker/HungarianAlg
)

set(LIBS
${OpenCV_LIBS}
mtracking
)

TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBS})
Loading

0 comments on commit 5e0b213

Please sign in to comment.