TexturedObjectDatabase.h
Go to the documentation of this file.
00001 // *****************************************************************
00002 // Filename:  TexturedObjectDatabase.h
00003 // Copyright: Pedram Azad, Chair Prof. Dillmann (IAIM),
00004 //            Institute for Computer Science and Engineering (CSE),
00005 //            University of Karlsruhe. All rights reserved.
00006 // Author:    Pedram Azad
00007 // Date:      2006
00008 // *****************************************************************
00009 
00010 
00011 #ifndef _TEXTURED_OBJECT_DATABASE_H_
00012 #define _TEXTURED_OBJECT_DATABASE_H_
00013 
00014 
00015 // *****************************************************************
00016 // necessary includes
00017 // *****************************************************************
00018 
00019 #include "Features/FeatureEntry.h"
00020 #include "DataStructures/DynamicArray.h"
00021 #include "Structs/ObjectDefinitions.h"
00022 #include <string>
00023 
00024 
00025 // *****************************************************************
00026 // define
00027 // *****************************************************************
00028 
00029 #define MAXIMUM_NUMBER_OF_CLASSES 50
00030 
00031 
00032 // *****************************************************************
00033 // forward declarations
00034 // *****************************************************************
00035 
00036 class CDynamicArray;
00037 class CByteImage;
00038 class CTexturedFeatureSet;
00039 class CHoughSpace2D;
00040 class CStereoMatcher;
00041 class CStereoCalibration;
00042 class CKdTree;
00043 struct Object3DEntry;
00044 
00045 
00046 
00047 
00048 // *****************************************************************
00049 // CTexturedObjectDatabase
00050 // *****************************************************************
00051 
00052 class CTexturedObjectDatabase
00053 {
00054 public:
00055         // constructor
00056         CTexturedObjectDatabase(int nImageWidth, int nImageHeight);
00057 
00058         // destructor
00059         ~CTexturedObjectDatabase();
00060 
00061         
00062         // public methods
00063         
00064         // loads stereo calibration from file (optional; needed for 3d localization only)
00065         bool LoadCameraParameters(const char *pFileName);
00066         void InitCameraParameters(CStereoCalibration *pStereoCalibration, bool bCloneCalibration);
00067         
00068         // loads database from configuration file
00069         bool LoadDatabase(const char *pConfigurationFilename, const char* pDataFilePathPrefix = 0);
00070         
00071         // set thresholds
00072         void SetRecognitionThresholds(int nMinValidFeatures, float fMaxError);
00073         
00074         // add feature set to database
00075         bool AddFeatureSet(CTexturedFeatureSet *pFeatureSet);
00076         bool AddClass(const std::string& sClassName, const std::string& sFeatureSetFileName);
00077     
00078         // remove feature set from database
00079         bool RemoveFeatureSet(int nIndex);
00080         bool RemoveFeatureSet(const char *pName);
00081                 
00082         // high level method for analyzing features in a scene
00083         int AnalyzeFeatures(CDynamicArray *pFeatures, CByteImage *pResultImage,
00084                 const CByteImage * const *ppInputImagesFor3DLocalization = 0,
00085                 const Vec2d *pInterestPoints = 0, int nInterestPoints = 0,
00086                 int nUseKdTree = 0, bool bInputImagesAreUndistorted = false,
00087                 const char *pObjectName = 0);
00088         
00089         // returns feature set for a given index
00090         const CTexturedFeatureSet* GetFeatureSet(int nIndex);
00091         
00092         // returns number of objects in database
00093         int GetSize();
00094 
00095         
00096         // set methods
00097         void SetVerbose(bool bVerbose);
00098         void SetStereo(bool bStereo) { m_bLocalizeWithStereo = bStereo; }
00099 
00100         void SetCorrelationParameters(int nWindowSize, float fMinZ, float fMaxZ, float fThreshold)
00101         {
00102                 m_nCorrelationWindowSize = nWindowSize;
00103                 m_fCorrelationMinZ = fMinZ;
00104                 m_fCorrelationMaxZ = fMaxZ;
00105                 m_fCorrelationThreshold = fThreshold;
00106         }
00107 
00108 
00109 private:
00110         // private class definitions
00111         class CFeatureMapEntry : public CDynamicArrayElement
00112         {
00113         public:
00114                 CFeatureMapEntry(const CFeatureEntry *pFeature_, const CFeatureEntry *pMatchedFeature_, const CTexturedFeatureSet *pFeatureSet_) :
00115                         pFeature(pFeature_), pMatchedFeature(pMatchedFeature_), pFeatureSet(pFeatureSet_)
00116                 {
00117                 }
00118                 
00119                 const CFeatureEntry *pFeature;
00120                 const CFeatureEntry *pMatchedFeature;
00121                 const CTexturedFeatureSet *pFeatureSet;
00122         };
00123         
00124         // private methods
00125         bool BuildKdTree(int nObjectIndex);
00126         bool Localize3D(const Vec2d &p1, const Vec2d &p2, const Vec2d &p3, const Vec2d &p4,
00127                 const Vec3d &p1_3d, const Vec3d &p2_3d, const Vec3d &p3_3d, const Vec3d &p4_3d,
00128                 const Vec2d *pFeatures, int nFeatures, const CByteImage * const *ppImages,
00129                 CByteImage *pResultImage, Object3DEntry &entry, bool bInputImagesAreUndistorted);       
00130         
00131         // private attributes
00132         CDynamicArray *m_pObjectArray;
00133         CDynamicArray **m_ppObjectFeatureMap;
00134         CKdTree **m_ppKdTrees;
00135         CHoughSpace2D *m_pHoughSpace;
00136         
00137         int m_nImageWidth;
00138         int m_nImageHeight;
00139         
00140         CStereoMatcher *m_pStereoMatcher;
00141         CStereoCalibration *m_pStereoCalibration;
00142         bool m_bStereoInitialized;
00143         bool m_bOwnStereoCalibrationObject;
00144         
00145         bool m_bVerbose;
00146 
00147         int m_nCorrelationWindowSize;
00148         float m_fCorrelationMinZ;
00149         float m_fCorrelationMaxZ;
00150         float m_fCorrelationThreshold;
00151 
00152         bool m_bLocalizeWithStereo;
00153 
00154         
00155 public:
00156         Object3DList m_objectList;
00157 };
00158 
00159 
00160 
00161 #endif /* _OBJECT_DATABASE_H_ */


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Thu Jun 6 2019 21:46:58