Tracking, recognise the same players in two 'moving' pictures [closed]

This question is about tracking individual players. I made a series of high resolution pictures of a soccergame. The time-lapse between each picture is exactly 1 second. For each soccer player I can calculate his centroid. The same soccer players changes position. I can also calculate the centroid of the second picture of the same players. But how can I make a connection between the centroid's of the same soccerplayer? The problem is that there is not one soccerplayer on eache picture.

On 27 febr 2014 I posted the question:"How to calculate the position of a figure in an image?" Belisarius gave a excellent answer on this question. I will describe his answer again.

vbv7 = Import[
"E:\\mathematica\\voetbal\\2014-03-09 \
voetbal_8maart2014\\voetbal_8maart2014 032.jpg"];
vbv8 = ImageTake[vbv7, {300, 2100}, {1, 3456}]


getDist[img_, pixels_] :=  Module[{dist, edist, logPdf, rgb}, dist =
MultinormalDistribution[{mR, mG,mB}, {{sRR, sRG, sRB}, {sRG, sGG, SGB}, {sRB, sGB,
sBB}}];

edist = EstimatedDistribution[pixels, dist];
logPdf = PowerExpand@Log@PDF[edist, {r, g, b}];
rgb = ImageData /@ ColorSeparate[GaussianFilter[img, 3]];
logPdf /. {r -> rgb[[1]], g -> rgb[[2]], b -> rgb[[3]]}]

grassSample = ImageTake[vbv8, {340, 900}, ImageDimensions@vbv8];
grassPixels = Flatten[ImageData[grassSample], 1];
p = getDist[vbv8, grassPixels];
i1 = DeleteSmallComponents[Image[-p/20], 100]

mci1 = MorphologicalComponents@i1;
blue = PixelValuePositions[vbv8, {0.72, 0.090, 0.15}, 0.01];
{h, v} = ImageDimensions[vbv8];
imgD = ConstantArray[0, {h, v}];
Table[imgD[[Sequence @@ blue[[i]]]] = 1, {i, 1, Length[blue]}];
bluePeople = ImageRotate[Dilation[Image@imgD, 8], Pi/2];
centroids = Round@ComponentMeasurements[bluePeople, "Centroid"][[All, 2]];
TableForm[Transpose@{ss = {Last@ImageDimensions@i1 - #[[2]], #[[1]]} & /@
centroids, mci1[[Sequence @@ ##]] & /@ ss}, TableHeadings -> {None, {"Centroid",
"Cluster"}}]


In this picture I 'follow' the red soccer players. The output of this script is:

{"Centroid", "Cluster"}, {{ {16}, {1520} }, 1}, {{ {71}, {2701} }, 2}, {{ {299}, {1667} }, 10}, {{ {285}, {1702} }, 10}, {{ {362}, {3050} }, 18}, {{ {370}, {1649} }, 10}, {{ {377}, {1695} }, 10}, {{ {409}, {3048} }, 18}, {{ {411}, {3072} }, 18}, {{ {431}, {1640} }, 10}, {{ {467}, {926} }, 15}, {{ {562}, {1013} }, 15}, {{ {597}, {833} }, 15} }

I can do the same with a second picture.

vbv9 = Import["E:\\mathematica\\voetbal\\2014-03-09
\voetbal_8maart2014\\voetbal_8maart2014 033.jpg"];


If I use the same script, I will get: { {"Centroid", "Cluster"}, {{ {66}, {2668} }, 2}, {{ {230}, {1543} }, 7}, {{ {283}, {1646} }, 7}, {{ {311}, {1640} }, 7}, {{ {311}, {1678} }, 7}, {{ {409}, {1634} }, 7}, {{ {394}, {1676} }, 7}, {{ {388}, {3152} }, 11}, {{ {417}, {3147} }, 11}, {{ {474}, {1142} }, 10}, {{ {497}, {1189} }, 10}, {{ {604}, {1031} }, 10}, {{ {615}, {1207} }, 10} }

I know, there is a issue with the blue soccer player with the red number on his back. But for the solution at this moment, it is not a real problem.

For analyse purpose I would like to track the soccer-players during the match. The solution of Belisarius will help me to regognise the individual players. But now I would like to follow them. Any suggestions?

-

closed as off-topic by belisarius, rasher, bobthechemist, Pickett, Michael E2Mar 21 at 1:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "The question is out of scope for this site. The answer to this question requires either advice from Wolfram support or the services of a professional consultant." – belisarius, rasher, bobthechemist, Pickett, Michael E2
If this question can be reworded to fit the rules in the help center, please edit the question.

To do this robustly, you will need to implement a particle filter. You might be able to get by with a crude and ad hoc algorithm that just tracks the vector of centroids $\mathbf{c}$ and associates each entry in $\mathbf{c}_{t+1}$ with its nearest entry in $\mathbf{c}_t$. You can add additional constraints (such as speed, direction, etc.) to weed out mismatches but things become a lot more complex when the perspective changes. This is well beyond the scope of this site, IMO. –  rm -rf Mar 20 at 22:22
We have discussed this before. While I think this is a cool idea, it probably requires help from a specialist. –  bobthechemist Mar 20 at 23:26
I remember implementing a solution to the original question using ImageCorrespondingPoints and a video I found on Youtube. It actually performed quite well, but lost track of the players from time to time (in the same scene as they were just running). But if you now have a more robust way of identifying the players, you might be able to find them again and tell ImageCorrespondingPoints what points to track when it loses them. –  Pickett Mar 20 at 23:35