2 * ImageFeatureManager.h
4 * Created on: Oct 8, 2012
8 #ifndef IMAGEFEATUREMANAGER_H_
9 #define IMAGEFEATUREMANAGER_H_
14 class ImageFeatureManager
16 friend class ImageRecognizer;
17 friend class ImageFeatureInfo;
20 ImageFeatureManager(void);
21 ~ImageFeatureManager(void);
24 /// \breif Creates object database.
26 /// Releases previously created DB if there is any.
29 /// Adds an object to referencing database.
30 /// \param[in] filepath Path to image on the disk.
31 /// \return index of newly created object on success, otherwise -1.
32 int addImageToDB(const char* filepath);
34 /// Adds an object to referencing database.
35 /// \param[in] data Buffer of grayscale 8 bit image data of specified width
37 /// \param[in] width Width of input image.
38 /// \param[in] height Height of input image.
39 /// \return index of newly created object on success, otherwise -1.
40 int addImageToDB(const unsigned char* data, int width, int height, const char* imageinfo);
42 /// \brief Removed object from referencing database.
43 /// \param[in] index Index of object saved in database.
44 /// \return 'true' on success.
45 bool deleteImageFromDB(int index);
47 /// \brief Undelete object in referencing database.
48 /// \param[in] index Index of object saved in database.
49 /// \return 'true' on success.
50 bool undeleteImageFromDB(int index);
52 /// \return Total number of images in database.
53 unsigned int totalNumberOfImages(void);
55 /// \brief Serializes database to output file.
56 /// \param[in] optimizeDatabase Specifies if database optimization is
57 /// required. Optimized database performs better, but optimization process
59 /// \param[in] dbpath Database file path. If equal to '0' and database was
60 /// loaded from file with 'openDB()' call, saves database to that file.
61 /// \return 'true' on success.
62 bool saveDB(bool optimizeDatabase, const char* dbPath = 0);
64 /// \brief Updates opened database.
65 /// \return 'true' on success.
68 /// \brief Loads database from input file.
69 /// \param[in] dbPath Database file path.
70 /// \return 'true' on success.
71 bool openDB(const char* dbPath);
73 /// \brief Delete all objects from the database.
77 void* databasePtr(void) const;
78 ImageFeatureManager(const ImageFeatureManager&);
79 ImageFeatureManager& operator=(const ImageFeatureManager&);
82 class ImageFeatureManagerImpl;
83 ImageFeatureManagerImpl* d; ///< implementation
87 #endif // IMAGEFEATUREMANAGER_H_