Restrict cage estimation rectangle to the actual frame
Added new parameter determining the margin of the estimate of the bottom
of the cage from the image border