Date: Sun, 25 Nov 2001 23:0:40 +0800
From: pear <zhangpear@...>
To: "vxl@..." <vxl@...>
Subject: where are the errors of my program?
Hello, all,
I want to compute the Fmatrix using Robust Method, but I can't get the correct result.
here are my program and data in attached file.
Warning Monte Carlo sampling will not work.
Not enough points to choose from: need 7, have 0.
#include <vcl_iostream.h>
#include <stdlib.h>
#include <vcl_cmath.h>
#include <mvl/FMatrixComputeLinear.h>
#include <fstream.h>
#include <iomanip.h>
#include <mvl/FMatrixComputeRANSAC.h>
#include <mvl/SimilarityMetric.h>
#include <mvl/PairMatchSetCorner.h>
#include <mvl/HomgInterestPointSet.h>
void main()
{
vcl_vector<HomgPoint2D> points1(128);
vcl_vector<HomgPoint2D> points2(128);
SimilarityMetric metric=SimilarityMetric(512,512);
// Read points
ifstream datain("D://projects//temp//vxlTest//test.in");
if(datain.fail())
{
return;
}
int i;
double ptx1,pty1,ptx2,pty2;
// vnl_double_2 t1,t2;
for(i=0;i<128;i++)
{
datain>>ptx1>>pty1>>ptx2>>pty2;
points1[i]=metric.image_to_homg(ptx1,pty1);
points2[i]=metric.image_to_homg(ptx2,pty2);
}
datain.close();
HomgInterestPointSet *corners[2];
corners[0]=new HomgInterestPointSet(points1,&metric);
corners[1]=new HomgInterestPointSet(points2,&metric);
PairMatchSetCorner match;
match.set(corners[0],corners[1]);
FMatrixComputeRANSAC comput(true,0.75);
FMatrix f1;
f1=comput.compute(match);
vcl_cout <<f1 << vcl_endl;
}
|