computer vision – How to correct distortion from stitching dual camera to estimate homography

I am trying to distort the image obtained from two cameras that generate a stitching image. Unfortunately, I do not have access to the cameras and I would like to know what could be the best way to apply to correct the image and get the lines below to be straight.

enter image description here

The next step I am trying to do is to calculate the homography with respect to the field. And the only thing that I find is that: transformation between the image field and the template field plane has to be done through a linear transformation.