AHmedRef
AHmedRef

Reputation: 2611

find homography matrix using openCV

i'm working on a project of image stitching using OpenCV 2.3.1 on Visual Studio 2012. For an unknown reason my programme don't work !!

#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; 
}

my problem : enter image description here any help plzzz

Upvotes: 0

Views: 1367

Answers (2)

AHmedRef
AHmedRef

Reputation: 2611

I solved my problem by changing from vs2012 to vs 2010 :D

Upvotes: 0

berak
berak

Reputation: 39796

you need at least 4 points in each vec. 2 just aren't enough

Upvotes: 2

Related Questions