A method for training a feature detector of an image processing device, including the steps of detecting features in the image to generate a score map, computing a center of mass on the score map to generate a location, extracting a patch from the image at the location by a first spatial transformer, estimating an orientation of the patch, rotating the patch in accordance with the patch orientation with a second spatial transformer, and describing the rotated patch to create a description vector.