Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008 #include "FMatrixCompute.h"
00009 #include <mvl/PairMatchSetCorner.h>
00010 #include <mvl/HomgInterestPointSet.h>
00011 #include <vcl_cassert.h>
00012 #include <vcl_iostream.h>
00013
00014
00015
00016
00017
00018
00019
00020 FMatrixCompute::FMatrixCompute ()
00021 {
00022 }
00023
00024
00025
00026
00027
00028 FMatrixCompute::~FMatrixCompute()
00029 {
00030 }
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 bool FMatrixCompute::compute (PairMatchSetCorner& matches, FMatrix* F_out)
00044 {
00045
00046 vcl_vector<HomgPoint2D> points1(matches.count());
00047 vcl_vector<HomgPoint2D> points2(matches.count());
00048 matches.extract_matches(points1, points2);
00049 return compute(points1, points2, F_out);
00050 }
00051
00052 bool FMatrixCompute::compute (vcl_vector<vgl_homg_point_2d<double> >& points1,
00053 vcl_vector<vgl_homg_point_2d<double> >& points2,
00054 FMatrix& F_out)
00055 {
00056 if (points1.size() != points2.size())
00057 vcl_cerr << "FMatrixCompute::compute(): Point vectors are not of equal length\n";
00058 assert(points1.size() <= points2.size());
00059 HomgInterestPointSet p1(points1,0);
00060 HomgInterestPointSet p2(points2,0);
00061
00062 PairMatchSetCorner matches(&p1, &p2);
00063 int count = matches.size();
00064 vcl_vector<bool> inliers(count, true);
00065 vcl_vector<int> ind1(count), ind2(count);
00066 for (int i = 0; i < count; i++) ind1[i] = ind2[i] = i;
00067 matches.set(inliers, ind1, ind2);
00068 return compute(matches, &F_out);
00069 }
00070
00071 bool FMatrixCompute::compute (vcl_vector<HomgPoint2D>& points1,
00072 vcl_vector<HomgPoint2D>& points2,
00073 FMatrix* F_out)
00074 {
00075 if (points1.size() != points2.size())
00076 vcl_cerr << "FMatrixCompute::compute(): Point vectors are not of equal length\n";
00077 assert(points1.size() <= points2.size());
00078 HomgInterestPointSet p1(points1,0);
00079 HomgInterestPointSet p2(points2,0);
00080
00081 PairMatchSetCorner matches(&p1, &p2);
00082 int count = matches.size();
00083 vcl_vector<bool> inliers(count, true);
00084 vcl_vector<int> ind1(count), ind2(count);
00085 for (int i = 0; i < count; i++) ind1[i] = ind2[i] = i;
00086 matches.set(inliers, ind1, ind2);
00087 return compute(matches, F_out);
00088 }