Adaptive Template Update

* Based on bhattacharyya distance