Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

But my question now is how do I translate the coordinates of the centroids to the soccerfield image.

DO NOT translate the rectangle centroids! The position in the field of each player is determined by the position of their feet, not their hip. So the position of a player in the field should be (centerX, centerY+bheight/2).

Then just multiply this vector* with the homography matrix** and voilĂ ! You have projected the player to the 2D field.

  • oh, btw, you need to add a 1 as the third element to the vector (so it becomes X,Y,1)

** To get the homography matrix, you need at least 4 corresponding points from the two images (the more the better). Then call getPerspectiveTransformto compute the homography matrix