Matching features points of rotate image using SURF I'm trying to match SURF points between 2 images using SURF with opencv. One is the rotation of the other.
The problem is that the few matching it can found are wrong. 

image of matching points

I mainly took my code from opencv http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html#feature-flann-matcher 

Here is the code:

string imageName1="test_right_rotate.jpg";
string imageName2="test_right.jpg";
Mat image1 = imread( imageName1, 1 );
Mat image2 = imread( imageName2, 1 );
int minHessian = 500;
SurfFeatureDetector detector( minHessian );
std::vector&lt;KeyPoint&gt; keypoints_1, keypoints_2;

detector-&gt;detect( image1, keypoints_1 );
detector-&gt;detect( image2, keypoints_2 );

SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;

extractor.compute( image1, keypoints_1, descriptors_1 );
extractor.compute( image2, keypoints_2, descriptors_2 );

FlannBasedMatcher matcher;
std::vector&lt;vector&lt;DMatch &gt; &gt; matches;
matcher.knnMatch(descriptors_1,descriptors_2, matches, 2);
std::vector&lt; DMatch &gt; good_matches;
for(int i = 0; i &lt; min(descriptors_1.rows-1,(int) matches.size()); i++) //THIS LOOP IS SENSITIVE TO SEGFAULTS
{
    if((matches[i][0].distance &lt; 0.6*(matches[i][1].distance)) &amp;&amp; ((int) matches[i].size()&lt;=2 &amp;&amp; (int) matches[i].size()&gt;0))
    {
        good_matches.push_back(matches[i][0]);
    }
}
Mat img_matches;
drawMatches( image1, keypoints_1, image2, keypoints_2, good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), vector&lt;char&gt;(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );


It works well for scaled images and translated images but fails for rotated images.

EDIT: 

I don't know what is wrong but instead of using SURF, I used ORB as detector and FREAK as extractor and it works a lot better. 
You can find the code on this SO : https://stackoverflow.com/questions/12491022/opencv-freak-fast-retina-keypoint-descriptor
SURF Features are not completely rotation invariant. 

In the paper, they try to make SURF more robust to rotations by following the following methodology.

In order to improve the performance for rotation, the descriptors are based on multi-orientations. The many-to-many tentative correspondences are determined with a maximum distance. Hough transform is used to reject the mismatches and the affine parameters are computed with a least-squares solution.

The image matching algorithm shows a better performance for image rotation than the standard SURF and it succeeds in matching the image including repetitive patterns which will deteriorate the distinctiveness of feature descriptors.