CS585 HW4
Shuzhe Luan
Long Guo
04/03/2020
In this assignment, we need to segement the image use track the objects. We assume that the velocity of objects don't change between frames and we use that assumption in our prediction.
Bats : First we use a greedy algorithm to find all bats from the processed image. Then we create the vector of bat object. Each bat have three values : id, state and mass. And state is a vector that is composed by {coordinate_x, coordinate_y, velocity_x, velocity_y}; After that, we use each bat's relative movement to predict their location on the next frame and compute the probability by prob = w1 * ratio of distance + w2 * ratio of weight Finally, we use KM algorithm to find a optimal match and update bats' states. Cells: First we compute the average mat of the first 50 frames to find the background Then we subtract the average mat from each frame to perform the background subtraction. After subtracting the background, we perform some morphological operations to remove the noise and fill the broken cells. And what's happening next is all the same.
Some code :
produceAveVector : Compute the average mat.
getBats : Find all objects.
compareTwoFramesBat : Do the prediction, compute the probability, find the match and update the state.
addTrajectories : Add trajectories that have been found.
Perform the KM algorithm and find an optimal match.
Below are the results on Bat dataset. We experimented on different distance functions. The one below featured , with weights greater than tuned to positive infinity.
We also tried on simple distance functions, i.e. calculating the distance between nodes and "predicted location".
It clearly showed that the first one featured with less zigzagging, therefore a more stable tracking.
Below is the results on Cell dataset.
We spent most effort on improving the segmentation, as the main reason for unstable lines is the unstable centroid obtained from segmentation.
We improved the tracking results by replace the ad-hoc distance function to another simple yet effective function that preserves distance, direction and scaling in one equation.