2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef IMAGEFEATUREMANAGER_H_
19 #define IMAGEFEATUREMANAGER_H_
24 class ImageFeatureManager
26 friend class ImageRecognizer;
27 friend class ImageFeatureInfo;
30 ImageFeatureManager(void);
31 ~ImageFeatureManager(void);
34 /// \breif Creates object database.
36 /// Releases previously created DB if there is any.
39 /// Adds an object to referencing database.
40 /// \param[in] filepath Path to image on the disk.
41 /// \return index of newly created object on success, otherwise -1.
42 int addImageToDB(const char* filepath);
44 /// Adds an object to referencing database.
45 /// \param[in] data Buffer of grayscale 8 bit image data of specified width
47 /// \param[in] width Width of input image.
48 /// \param[in] height Height of input image.
49 /// \return index of newly created object on success, otherwise -1.
50 int addImageToDB(const unsigned char* data, int width, int height, const char* imageinfo);
52 /// \brief Removed object from referencing database.
53 /// \param[in] index Index of object saved in database.
54 /// \return 'true' on success.
55 bool deleteImageFromDB(int index);
57 /// \brief Undelete object in referencing database.
58 /// \param[in] index Index of object saved in database.
59 /// \return 'true' on success.
60 bool undeleteImageFromDB(int index);
62 /// \return Total number of images in database.
63 unsigned int totalNumberOfImages(void);
65 /// \brief Serializes database to output file.
66 /// \param[in] optimizeDatabase Specifies if database optimization is
67 /// required. Optimized database performs better, but optimization process
69 /// \param[in] dbpath Database file path. If equal to '0' and database was
70 /// loaded from file with 'openDB()' call, saves database to that file.
71 /// \return 'true' on success.
72 bool saveDB(bool optimizeDatabase, const char* dbPath = 0);
74 /// \brief Updates opened database.
75 /// \return 'true' on success.
78 /// \brief Loads database from input file.
79 /// \param[in] dbPath Database file path.
80 /// \return 0 on success.
81 /// \return -1 on failure.
82 /// \return -2 on readonly file.
83 int openDB(const char* dbPath);
85 /// \brief Delete all objects from the database.
89 void* databasePtr(void) const;
90 ImageFeatureManager(const ImageFeatureManager&);
91 ImageFeatureManager& operator=(const ImageFeatureManager&);
94 class ImageFeatureManagerImpl;
95 ImageFeatureManagerImpl* d; ///< implementation
99 #endif // IMAGEFEATUREMANAGER_H_