Spatial and Spectral Morphological Template Matching