Blender Camera Tracking - Mask / Layer - 3D object behind first layer in animation

Hi There,

I’m trying to do some simple Blender animation using camera tracking.
In most tutorial is easy because there is no object between camera and virtual reality in animation.
But what if we have some object in the middle like tree ? Example
Uploaded with

Is there any way in Blender to mask areas which should be before 3d object ?
So far I use Adobe After Effects mask to mix orignial and blender movie to mark first layer object like tree.
I suppose object tracking maybe can help ?

Any suggestion will be appreciated