Which method is the best to compare two images and discard outliers points? In find_obj.cpp opencv example, they use FLANN, but don't discard outliers.
I have seen some methods like using Kmeans or graphs.
There is a fairly reliable and efficient way to both reject noisy points and determine the transformation between your points of interest. The algorithm that is usually used to reject outliers is known as RANSAC (http://en.wikipedia.org/wiki/RANSAC), and the algorithm used to determine the transformation can take several forms, but the most current state of the art is known as the five-point algorithm and can be found here -- a MATLAB implementation can be found here. Note that you do need to determine the transformation even if you don't care about the exact rotation between the two images -- this is how the outliers are identified.
Unfortunately I don't know of a mature implementation of both of those combined; you'll probably have to do some work of your own to implement RANSAC and integrate it with the five point algorithm.
OpenCV has an implementation that is overkill for your task (meaning it will work but will take more time than necessary) but is ready to work out of the box. The function of interest is called cv::findFundamentalMat (http://opencv.willowgarage.com/documentation/cpp/camera_calibration_and_3d_reconstruction.html#cv-findfundamentalmat)
来源:https://stackoverflow.com/questions/6994644/detecting-outliers-in-surf-or-sift-algorithm-with-opencv