google-research / football

Check out the new game server:
https://research-football.dev
Apache License 2.0
3.31k stars 1.28k forks source link

Reprojecting 3D field points onto the image plane #298

Open fspinola opened 2 years ago

fspinola commented 2 years ago

Hello,

Following the suggestion of issue #297, I used this fork to retrieve the camera intrinsics and extrinsics. I generated image frames from the simulation and using the camera parameters, I reprojected 3D soccer field coordinates onto the image plane. I used a field size of 110m x 72m as specified in here and a radius of 9.17m for the arcs and centre circle, which is the usual standard for football pitches. The result I get is shown in the image below: the reprojected points (in black) seem to match the white field lines on the image, except for the two arcs. output_pose_25_cam0_00000

Is there a place where you specify the radius of the arcs, so that I could use this value to have more accurate reprojections? Or is there a way to specify different field sizes in the simulation and render custom fields?

Thank you in advance for you help.

vi3itor commented 2 years ago

Hi!

A quick search of the original engine code written by Bastiaan shows that at some point the lines were drawn during the pitch generation phase. In particular, these lines were responsible for the arcs. But later it was replaced by loading a pitch overlay with the lines already drawn. In GRF the overlay is loaded here.

So you need to update overlay.bmp with the one that has a properly drawn lines. If you do so, please consider sending a pull request.