00001
00002
00003 #ifndef LOCPANO_ENGINE_HPP
00004 #define LOCPANO_ENGINE_HPP
00005
00006 #include <ostream>
00007 #include <map>
00008
00009 #include "boost/tuple/tuple.hpp"
00010
00011 #include "image/Image.hpp"
00012
00013 #include "camera/cameraBarreto.hpp"
00014
00015 #include "locpano/LocPano_struct.h"
00016
00017 namespace jafar {
00018 namespace locpano {
00019
00025 class Engine {
00026
00027 private:
00028
00029 double imageScale;
00030
00031
00032 LocPanoParams* params;
00033 LocPanoInternal* internal;
00034 LocPanoData* dataBase;
00035
00037 int internalIndex;
00038
00039 typedef std::map<int, int> ImageIndexMap;
00040
00042 ImageIndexMap imageIndexInternalToUser;
00043 ImageIndexMap imageIndexUserToInternal;
00044
00045 public:
00046
00047 Engine();
00048 Engine(jafar::camera::CameraParabolicBarreto const& pCam, jafar::image::Image const& initImage, int maxNbImagesInDataBase);
00049
00050 ~Engine();
00051
00052 void setImageScale(double imageScale_) {imageScale = imageScale_;}
00053
00054 int getNbImages() const {return dataBase->nbImages;}
00055
00059 void init(jafar::camera::CameraParabolicBarreto const& pCam, jafar::image::Image const& initImage, int nbImagesInDataBase);
00060
00063 void addImage(jafar::image::Image const& image, bool updateProfile = true);
00064
00067 void addImage(jafar::image::Image const& image, int imageIndex, bool updateProfile = true);
00068
00072 double getImageDistance(jafar::image::Image const& image,
00073 int index,
00074 bool useProfile = true, int distanceType = 3);
00075
00079 boost::tuple<int, double> getClosestImage(jafar::image::Image const& image,
00080 bool useProfile = true, int distanceType = 3);
00081
00087 boost::tuple<int, double> getClosestImage(jafar::image::Image const& image,
00088 int index1, int index2,
00089 bool useProfile = true, int distanceType = 3);
00090 private:
00091
00092 boost::tuple<int, double> getClosestImageWrapper(jafar::image::Image const& image,
00093 int internIndex1, int internIndex2,
00094 bool useProfile = true, int distanceType = 3);
00095
00096 };
00097
00098 std::ostream& operator <<(std::ostream& s, const boost::tuple<int, double>& t);
00099
00100 }
00101 }
00102
00103 #endif // LOCPANO_ENGINE_HPP