sync with master
[platform/framework/native/vision.git] / src / ImageFeatureManager.h
1 /**
2  * ImageFeatureManager.h
3  *
4  *  Created on: Oct 8, 2012
5  *      Author: ikhwancho
6  */
7
8 #ifndef IMAGEFEATUREMANAGER_H_
9 #define IMAGEFEATUREMANAGER_H_
10
11 namespace sari2
12 {
13
14 class ImageFeatureManager
15 {
16     friend class ImageRecognizer;
17     friend class ImageFeatureInfo;
18
19 public:
20     ImageFeatureManager(void);
21     ~ImageFeatureManager(void);
22
23 public:
24     /// \breif Creates object database.
25     ///
26     /// Releases previously created DB if there is any.
27     void initDB(void);
28
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);
33
34     /// Adds an object to referencing database.
35     /// \param[in] data Buffer of grayscale 8 bit image data of specified width
36     /// and height.
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);
41
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);
46
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);
51
52     /// \return Total number of images in database.
53     unsigned int totalNumberOfImages(void);
54
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
58     /// takes some time.
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);
63
64     /// \brief Updates opened database.
65     /// \return 'true' on success.
66     bool updateDB(void);
67
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);
72
73     /// \brief Delete all objects from the database.
74     void releaseDB(void);
75
76 private:
77     void* databasePtr(void) const;
78     ImageFeatureManager(const ImageFeatureManager&);
79     ImageFeatureManager& operator=(const ImageFeatureManager&);
80
81 private:
82     class ImageFeatureManagerImpl;
83     ImageFeatureManagerImpl* d; ///< implementation
84 };
85
86 }
87 #endif // IMAGEFEATUREMANAGER_H_