00001
00002 #ifndef MODELER_MIXER_HPP
00003 #define MODELER_MIXER_HPP
00004
00005 #include "modeler/vcgDeclarations.hpp"
00006 #include "fdetect/InterestFeature.hpp"
00007 #include "fdetect/DetectionResult.hpp"
00008 #include "gfm/MatchingResult.hpp"
00009 #include "gfm/Matcher.hpp"
00010 #include "image/Image.hpp"
00011 #include "fdetect/Detector.hpp"
00012 #include "localizer/planLocalizer.hpp"
00013 #include "camera/cameraContainer.hpp"
00014 #include "modeler/modeler.hpp"
00015 #include "modeler/jfr_import_ply.h"
00016 #include "modeler/jfr_io_mask.h"
00017
00018 #include <vcg/complex/trimesh/autoalign_4pcs.h>
00019
00020 namespace jafar {
00021 namespace modeler {
00029 class Mixer : public modeler::Modeler {
00030 public:
00031 typedef fdetect_v2::InterestFeature<fdetect_v2::FloatDescriptor> Feature;
00032 private:
00034 bool is_updatable;
00036 gfm_v2::MatchingResult<Feature> current_result;
00038 unsigned int first_new_vertex_id;
00040 unsigned int first_new_shot_id;
00041 std::vector<unsigned int> transient_vertices;
00042 vcg::tri::FourPCS<JfrMesh> icp;
00043 JfrMesh m_model;
00044 public:
00053 Mixer(JfrMesh& _mesh, camera::CameraType _type, const jblas::vec& _params,
00054 fdetect_v2::Detector<Feature>* _detector,
00055 gfm_v2::Matcher<Feature>* _matcher ) :
00056 Modeler(_type, _params, _detector, _matcher), m_model(_mesh),
00057 is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00058 {
00059 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00060 }
00061
00068 Mixer(JfrMesh& _mesh,
00069 fdetect_v2::Detector<Feature>* _detector,
00070 gfm_v2::Matcher<Feature>* _matcher ) :
00071 Modeler(_detector, _matcher), m_model(_mesh),
00072 is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00073 {
00074 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00075 }
00076
00082 Mixer(JfrMesh& _mesh, camera::CameraType _type, const jblas::vec& _params) :
00083 Modeler(_type, _params), m_model(_mesh),
00084 is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00085 {
00086 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00087 }
00088
00094 Mixer(const std::string& ply_mesh_file,
00095 camera::CameraType _type, const jblas::vec& _params) :
00096 Modeler(_type, _params),
00097 is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00098 {
00099 int mask = 0;
00100 if(vcg::tri::io::JfrImporterPLY<JfrMesh>::Open(m_model, ply_mesh_file.c_str(), mask) != 0)
00101 JFR_ERROR(ModelerException,
00102 ModelerException::FILE_READING_ERROR,
00103 "Error reading ply file "<<ply_mesh_file)
00104 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00105 }
00106
00110 Mixer(JfrMesh& _mesh) :
00111 Modeler(), m_model(_mesh),
00112 is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00113 {
00114 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00115 }
00116
00120 Mixer(const std::string& ply_mesh_file) :
00121 Modeler(), is_updatable(false), first_new_vertex_id(0), first_new_shot_id(0)
00122 {
00123 int mask = 0;
00124 if(vcg::tri::io::JfrImporterPLY<JfrMesh>::Open(m_model, ply_mesh_file.c_str(), mask) != 0)
00125 JFR_ERROR(ModelerException,
00126 ModelerException::FILE_READING_ERROR,
00127 "Error reading ply file "<<ply_mesh_file)
00128 JFR_POSTCOND(m_model.vn > 0, "model mesh is empty")
00129 }
00130
00132 void setDetector(fdetect_v2::Detector<Feature>* _detector)
00133 {
00134 detector = _detector;
00135 }
00136
00138 void setMatcher(gfm_v2::Matcher<Feature>* _matcher)
00139 {
00140 matcher = _matcher;
00141 }
00142
00148 bool update();
00149 };
00150 };
00151 }
00152
00153 #endif