A footpath (pink) plane is laid over the background image to hide and replace the original path at the left side of the water.

Two shadow-shaped masks are then laid over that which cut through it to reveal the background image's shadows once more.

The masks are not fully transparent so they can be tinted pink. The shadows then appear to be on the added pathway when in fact, they're on grey concrete.

Because the masks are to be selective, in that they cut through the added path-plane but don't affect the background image-plane, we render in OpenGL. (See footnote)
If the masks do cut through the background, parent both to the background plane, then unparent them immediately. (use "keep transform" option in both cases)
See here - for more about this form of masking
-=============-
Footnotes -
An alternative would be to texture the masks with the background image and use the UV editor to scale and align the respective shadows.
-==============-
Another, is to use Blender's internal masking which will cut a hole through everything and require post processing.
Render the holed image (or lossless video) in .png format with an alpha layer. (the RGBA button at extreme right in the rendering properties' output tab)
Note that the output still includes the background image-plane.
Save the project and exit. Fire up Blender again and use the 'Video Sequence Editor' this time.
Lay the holed image/video over a COPY of the background image which is tinted pink to match the overlaid path.
The holed image will only allow the tinted shadows through.
-===========-
The post processing could also be performed using the Compositor.
All up, the easiest by far was to render in OpenGL and use it's masking, do it all in one go.
enter code here