![](https://user-images.githubusercontent.com/91646805/154190573-53e361f6-7c60-4062-b56b-7cbd11d39fc4.jpg)
The most suitable method to track multiple moving objects simultaneously is to solve the assignment problem with the Hungarian method. An example of this problem is assigning three workers to three separate jobs, but each worker demands different pay for the various tasks. While the Hungarian algorithm creates a cost matrix to solve this problem in polynomial time, the result is finding the lowest cost way to assign the jobs. Illustrated in the figure below, the object detection pipeline with this Hungarian method describes the detailed workflow starting with a frame-by-frame analysis of the fluorescent cells flowing to the right in a microfluidic device. While there are a total of three cells in each frame, track 1, track 2, and track 3 are assigned to the top, middle, and bottom cell respectively. Therefore, in the second frame (the cells that the red arrows are pointing to) the three cells must be assigned to the three tracks that were instantiated in the first frame. A cost matrix is created based on the distances between the cells in the first and second frame, e.g., d_12 as the distance between the first cell in frame one and second cell in the frame two. Then, the Hungarian method assigns the cells with the shortest distances to the appropriate tracks, i.e., the cell that d_11 points to track 1. The bottom of the figure summarizes the object tracking pipeline in full and therefore includes both cell detection (top) and cell tracking (bottom). This object detector uses color detection with dilation and erosion to ultimately obtain contour centroids for the middle of each cell. Furthermore, the contour centroid is used to create and assign the trackID for input into SciPy’s linear sum assignment function that employs the Hungarian algorithm to assign the cell to the correct trackID [6]. Finally, unassigned tracks and detections are handled, and the x and y positions of the contour centroids are dumped to a csv file or other file type to use in a specific task.