00001 // This is oxl/mvl/PairMatchSet2D3D.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 00006 #include "PairMatchSet2D3D.h" 00007 #include <mvl/HomgInterestPointSet.h> 00008 #include <mvl/PairMatchSetCorner.h> 00009 #include <mvl/ProjStructure.h> 00010 #include <vcl_iostream.h> 00011 00012 // Default ctor 00013 PairMatchSet2D3D::PairMatchSet2D3D() 00014 { 00015 corners_ = 0; 00016 structure_ = 0; 00017 } 00018 00019 // Copy ctor 00020 PairMatchSet2D3D::PairMatchSet2D3D(const PairMatchSet2D3D& that) 00021 : PairMatchSet(that), 00022 corners_(new HomgInterestPointSet(*that.corners_)), 00023 structure_(new vcl_vector<HomgPoint3D>(*that.structure_)) 00024 { 00025 } 00026 00027 PairMatchSet2D3D::PairMatchSet2D3D(const HomgInterestPointSet* corners, vcl_vector<HomgPoint3D>* structure) 00028 { 00029 set(corners, structure); 00030 } 00031 00032 // Assignment 00033 PairMatchSet2D3D& PairMatchSet2D3D::operator=(const PairMatchSet2D3D& ) 00034 { 00035 vcl_cerr << "PairMatchSet2D3D::operator= not implemented\n"; 00036 return *this; 00037 } 00038 00039 // Destructor 00040 PairMatchSet2D3D::~PairMatchSet2D3D() 00041 { 00042 } 00043 00044 void PairMatchSet2D3D::set(const HomgInterestPointSet* corners, vcl_vector<HomgPoint3D>* structure) 00045 { 00046 corners_ = corners; 00047 structure_ = structure; 00048 set_size(corners_->size()); 00049 } 00050 00051 void PairMatchSet2D3D::set(int num_corners, vcl_vector<HomgPoint3D>* structure) 00052 { 00053 corners_ = 0; 00054 structure_ = structure; 00055 set_size(num_corners); 00056 } 00057 00058 void PairMatchSet2D3D::set_from(const PairMatchSet2D3D& otherframe_to_3d, const PairMatchSetCorner& otherframe_to_this) 00059 { 00060 corners_ = otherframe_to_this.get_corners2(); 00061 structure_ = otherframe_to_3d.get_structure(); 00062 set_size(otherframe_to_this.size()); 00063 00064 clear(); 00065 for (PairMatchSetCorner::iterator match = otherframe_to_this; match; match.next()) { 00066 int corner1 = match.get_i1(); 00067 int corner2 = match.get_i2(); 00068 int structure1 = otherframe_to_3d.get_match_12(corner1); 00069 add_match(corner2, structure1); 00070 } 00071 } 00072 00073 HomgMetric PairMatchSet2D3D::get_conditioner() const 00074 { 00075 if (!corners_) { 00076 vcl_cerr << "PairMatchSet2D3D::get_conditioner() WARNING corners_ not set!\n"; 00077 return 0; 00078 } 00079 return corners_->get_conditioner(); 00080 } 00081 00082 const HomgPoint2D& PairMatchSet2D3D::get_point_2d(int i1) const 00083 { 00084 if (!corners_) { 00085 static HomgPoint2D dummy; 00086 vcl_cerr << "PairMatchSet2D3D::get_point_2d() WARNING corners_ not set!\n"; 00087 return dummy; 00088 } 00089 return corners_->get_homg(i1); 00090 } 00091 00092 const HomgPoint3D& PairMatchSet2D3D::get_point_3d(int i2) const 00093 { 00094 return structure_->operator[](i2); 00095 } 00096 00097 const HomgInterestPointSet* PairMatchSet2D3D::get_corners() const 00098 { 00099 if (!corners_) { 00100 vcl_cerr << "PairMatchSet2D3D::get_point_2d() WARNING corners_ not set!\n"; 00101 return 0; 00102 } 00103 return corners_; 00104 }