1. A method for determining an optimal image orientation, the method comprising: a. obtaining an input image; b. extracting image features for the input image; c. generating rotated image features corresponding to alternate orientation of the image; d. analyzing the extracted and generated features using a plurality search trees constructed from large sets of images of known orientation, the plurality of search trees comprising candidate nearest neighbors; e. combining orientations of the candidate nearest neighbors using a weighted vote; and f. determining the optimal image orientation of the input image using a result of e.