can't use findhomography

asked 2015-06-23 07:43:15 -0600

updated 2015-06-23 08:07:00 -0600

thdrksdfthmn gravatar image

Hello, I'm have code use findhomography function. It can compile but when i run it have error my code:

and my error image description

Please help me. Sorry because my English not good The best is give me a video to use it, thanks.

#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include <iostream>
using namespace std;
using namespace cv;

int main()
{
  Mat I1,I2,I3;
  I1=imread("D:\detect\box.png");
  I2=imread("D:\detect\box_in_scene.png");
  I3=findHomography(I1,I2,CV_RANSAC,2);
  system("PAUSE");
  return 1; 
}
edit retag flag offensive close merge delete

Comments

you have to use it with vector<point>, not with images as input.

see docs

berak gravatar imageberak ( 2015-06-23 07:59:15 -0600 )edit

although i fix it but it doesn't run I1=imread("D:\detect\box.png"); I2=imread("D:\detect\box_in_scene.png");

QuangAnh94 gravatar imageQuangAnh94 ( 2015-06-23 08:04:09 -0600 )edit
1

again, I1 and I2 must not be images, but Point arrays, either as vector<Point> or Mat(1,N,CV_32FC2)

berak gravatar imageberak ( 2015-06-23 08:14:50 -0600 )edit

can you help me convert it to vector, thanks

QuangAnh94 gravatar imageQuangAnh94 ( 2015-06-23 08:39:53 -0600 )edit

I convert image to vector but error too:

vector<point> b1;
I1.copyTo(b1);

QuangAnh94 gravatar imageQuangAnh94 ( 2015-06-23 08:44:32 -0600 )edit

it's not a conversion issue. you need x,y points, not pixels. not images , again.

can you give it a break, and have a look at the tutorial ?

berak gravatar imageberak ( 2015-06-23 08:51:42 -0600 )edit

thanks you :D

QuangAnh94 gravatar imageQuangAnh94 ( 2015-06-23 09:08:23 -0600 )edit