It should be possible with a combination of object detection, monocular depth estimation (for example Monodepth, Godard et al.) and some math. Here is an example of how this could look like:
- Apply object detection/segmentation model to your image to find bounding boxes
- Determine the position of the center of the bounding box in the camera FOV, you could calculate a relative position here via: $\frac{\text{bbox}_x}{\text{img-width}} = p_x$
- Apply monocular depth estimation to generate a depth map from your camera image
- Take the bounding boxes to cut out regions in the depth maps and compute the average distance of the object to the camera lens.
Now you have: relative x-position in FOV $p_x$ and distance $d$, which gives you a vector in radial coordinates from your camera lens $\mathbf{\hat{p}} = (p_x, d)$ that directly translates to a position in the first image you showed.