2013-03-17 93 views
0

我正在使用Visual Studio 2012上的OpenCV 2.3.1進行圖像拼接項目。 由於某個未知原因,我的程序無法使用!使用openCV查找單應矩陣

#include "opencv2/highgui/highgui.hpp" 
#include "opencv/cv.h" 
#include <stdio.h> 
#include <iostream> 

     using namespace cv; 
     using namespace std; 
Mat getHomography() 
{ 

    vector<Point2f> points1; 
    vector<Point2f> points2; 

    points1.push_back(Point2f(10, 100)); 
    points1.push_back(Point2f(100, 10)); 
    points1.push_back(Point2f(200, 20)); 
    points1.push_back(Point2f(80, 30)); 

    points2.push_back(Point2f(220, 20)); 
    points2.push_back(Point2f(10, 220)); 
    points2.push_back(Point2f(90, 120)); 
    points2.push_back(Point2f(100, 20)); 

    Mat H = findHomography(Mat(points1), Mat(points2), 8, 3.0); 
    return H; 
} 

int main(){ 


    Mat HH = getHomography(); 
    cout<<HH; 
    system("pause"); 

     return 0; 
} 

我的問題: enter image description here 任何幫助plzzz

回答

2

您在每個VEC需要至少4分。 2只是沒有足夠的

+0

然後我就試試吧:d – 2013-03-17 15:27:55

+1

「getHompgraphy」,呵呵,我喜歡它,聽起來不錯:) – berak 2013-03-17 15:31:09

+0

hhhhhhhhhhh 10x:D – 2013-03-17 15:32:24

0

我從vs2012更改爲VS 2010解決我的問題:d