Skip to content

Commit

Permalink
Add vendored
Browse files Browse the repository at this point in the history
  • Loading branch information
andyblarblar committed Nov 9, 2023
1 parent 5256704 commit cc814e1
Show file tree
Hide file tree
Showing 3 changed files with 400 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ find_package(phnx_msgs REQUIRED)
find_package(OpenCV 4.2.0 REQUIRED)

# Add source for node executable (link non-ros dependencies here)
add_executable(obj_tracker src/ObjTrackerNode.cpp src/ObjTrackerNode_node.cpp)
add_executable(obj_tracker src/ObjTrackerNode.cpp src/ObjTrackerNode_node.cpp src/Hungarian.cpp)
target_include_directories(obj_tracker PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Expand Down
39 changes: 39 additions & 0 deletions include/obj_tracker/Hungarian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////
// Hungarian.h: Header file for Class HungarianAlgorithm.
//
// This is a C++ wrapper with slight modification of a hungarian algorithm implementation by Markus Buehren.
// The original implementation is a few mex-functions for use in MATLAB, found here:
// http://www.mathworks.com/matlabcentral/fileexchange/6543-functions-for-the-rectangular-assignment-problem
//
// Both this code and the orignal code are published under the BSD license.
// by Cong Ma, 2016
//

#ifndef HUNGARIAN_H
#define HUNGARIAN_H

#include <vector>

class HungarianAlgorithm {
public:
HungarianAlgorithm();
~HungarianAlgorithm();
double Solve(std::vector<std::vector<double> >& DistMatrix, std::vector<int>& Assignment);

private:
void assignmentoptimal(int* assignment, double* cost, double* distMatrix, int nOfRows, int nOfColumns);
void buildassignmentvector(int* assignment, bool* starMatrix, int nOfRows, int nOfColumns);
void computeassignmentcost(int* assignment, double* cost, double* distMatrix, int nOfRows);
void step2a(int* assignment, double* distMatrix, bool* starMatrix, bool* newStarMatrix, bool* primeMatrix,
bool* coveredColumns, bool* coveredRows, int nOfRows, int nOfColumns, int minDim);
void step2b(int* assignment, double* distMatrix, bool* starMatrix, bool* newStarMatrix, bool* primeMatrix,
bool* coveredColumns, bool* coveredRows, int nOfRows, int nOfColumns, int minDim);
void step3(int* assignment, double* distMatrix, bool* starMatrix, bool* newStarMatrix, bool* primeMatrix,
bool* coveredColumns, bool* coveredRows, int nOfRows, int nOfColumns, int minDim);
void step4(int* assignment, double* distMatrix, bool* starMatrix, bool* newStarMatrix, bool* primeMatrix,
bool* coveredColumns, bool* coveredRows, int nOfRows, int nOfColumns, int minDim, int row, int col);
void step5(int* assignment, double* distMatrix, bool* starMatrix, bool* newStarMatrix, bool* primeMatrix,
bool* coveredColumns, bool* coveredRows, int nOfRows, int nOfColumns, int minDim);
};

#endif
Loading

0 comments on commit cc814e1

Please sign in to comment.