Opencv3.1.0 findHomography returns empty matrix
<p>I am now working on an image registration problem.</p>

<p>I am using the findHomography function of opencv3.1.0 to get homography. The problem is that I always get an empty matrix even if with different images. 
I tried different feature descriptors, like ORB, BRISK. This happens only for ORB. But I have to use ORB. </p>

<p>So... why do I get an empty matrix? And how can I get a good homography matrix? Thank you:)</p>

<pre><code>Ptr&lt;ORB&gt; ptrORB = ORB::create(2000);
ptrORB-&gt;detect(img1, kpts1);           //use ORB as detector
ptrORB2-&gt;detect(img2, kpts2);

Ptr&lt;BRISK&gt; ptrBrisk = BRISK::create(); //use BRISK as descriptor
ptrBrisk-&gt;compute(img1, kpts1, desp1);
ptrBrisk-&gt;compute(img2, kpts2, desp2);

//Nearest neighbour ratio matching
double ratio = 0.8;
vector&lt;vector&lt;DMatch&gt;&gt; nnMatches;
vector&lt;DMatch&gt; matches;
BFMatcher matcher;
matcher.knnMatch(desp1, desp2, nnMatches, 2);
for (int k = 0; k &lt; nnMatches.size(); k++) {
    if (nnMatches[k][0].distance / nnMatches[k][1].distance &lt; ratio) {
        matches.push_back(nnMatches[k][0]);
    }
} 

//Homography
std::vector&lt;Point2f&gt; points1;
std::vector&lt;Point2f&gt; points2;

for (int i = 0; i &lt; matches.size(); i++) {
    points1.push_back(kpts1[matches[i].queryIdx].pt);
    points2.push_back(kpts2[matches[i].trainIdx].pt);
}

Mat H = findHomography(points1, points2, RANSAC);
</code></pre>