Hausdorff distance for robust and adaptive template selection in visual target detection