Add template matching

* Add fast template matching using NCC
* Add some support functions to imlib