hardcoded paths fixed
[framework/osp/vision.git] / inc / FUixVisionImageFeatureManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18
19 /**
20  * @file     FUixVisionImageFeatureManager.h
21  * @brief    This is the header file for the %Tizen::Uix::Vision::ImageFeatureManager class.
22  */
23
24 #ifndef _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
25 #define _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
26 #include <FBaseObject.h>
27 #include <FBase.h>
28 #include <FGrpBitmap.h>
29 #include <FUixVisionImageFeatureInfo.h>
30 #include <FMedia.h>
31
32 namespace Tizen { namespace Uix { namespace Vision
33 {
34
35 /**
36  * @class    ImageFeatureManager
37  * @brief    This class provides methods to generate individual feature data from individual image data.
38  *           And this class also provides method to manage image feature set which is the collection of individual feature data.
39  *
40  * @since    2.1
41  *
42  * The %ImageFeatureManager class provides the ability to generate individual image feature data and manage image feature set.
43  *
44  * The following example demonstrates how to use the %ImageFeatureManager class.
45  *
46  * @code
47  * void GenerateImageFeatureSet()
48  * {
49  *     Tizen::Uix::Vision::ImageFeatureManager imageFeatureManager;
50  *     imageFeatureManager.Construct();
51  *     imageFeatureManager.Load("/mnt/ums/Images/testFeatureSet.xdb");
52  *     imageFeatureManager.AddFeature("/mnt/ums/Images/image1.jpg");
53  *     imageFeatureManager.AddFeature("/mnt/ums/Images/image2.jpg");
54  *     imageFeatureManager.AddFeature("/mnt/ums/Images/image3.jpg");
55  *     imageFeatureManager.Flush();
56  * }
57  */
58 class _OSP_EXPORT_ ImageFeatureManager
59     : public Tizen::Base::Object
60 {
61 public:
62
63     /**
64      * This is the default constructor for this class.
65      * The object is not fully constructed after this constructor is called.
66      * For full construction, the Construct() method must be called right after calling this constructor.
67      *
68      * @since    2.1
69      */
70     ImageFeatureManager(void);
71
72     /**
73      * This is the destructor for this class. @n
74      * The resources are deallocated by this method.
75      * This destructor overrides Tizen::Base::Object::~Object().
76      *
77      * @since    2.1
78      */
79     ~ImageFeatureManager(void);
80
81     /**
82      * Initialize this instance of ImageFeatureManager and create image feature set.
83      * Every application must call Construct() before calling any other method of ImageFeatureManager.
84      *
85      * @since       2.1
86      *
87      * @return      An error code.
88      *
89      * @exception   E_SUCCESS          The method is successful.
90      * @exception   E_OUT_OF_MEMORY    The memory is insufficient.
91      * @see
92      */
93     result Construct(void);
94
95     /**
96      * Loads feature set file
97      *
98      * @since       2.1
99      *
100      * @return      An error code.
101      *
102      * @param[in]   featureSetFilePath       Feature set file path
103      *
104      * @exception   E_SUCCESS                The method is successful.
105      * @exception   E_INVALID_ARG            A specified feature set file path is invalid.
106      * @exception   E_OUT_OF_MEMORY          The memory is insufficient.
107      *
108      * @remarks     if feature set file exists, it will be updated.
109      *              if feature set file does not exist, it will be newly created.
110      * @see
111      */
112     result Load(const Tizen::Base::String& featureSetFilePath);
113
114     /**
115      * Returns list of supported image file formats for adding feature.
116      *
117      * @since       2.1
118      * @return      list of supported image file formats
119      *
120      * @see
121      */
122     static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
123
124     /**
125      * Adds a feature to feature set
126      *
127      * @since       2.1
128      *
129      * @return      Feature index of newly created feature on success.
130      *              If the specified input image file path is invalid, it returns -1.
131      *
132      * @param[in]   imagePath            Input image file path
133      *
134      * @exception   E_INVALID_ARG        A specified input parameter is invalid.
135      *
136      * @remarks     The specific error code can be accessed using the GetLastResult() method.
137      *              Input image file must be one of the supported image file formats.
138      *              Calling this method actually means 'Mark As Add Feature'.
139      *              And the marked feature data will be added to feature set file after calling Flush();
140      * @see         GetSupportedImageFileFormatsListN(void)
141      *              Flush(const Tizen::Base::String* featureSetFilePath = 0);
142      */
143     int AddFeature(const Tizen::Base::String& imagePath);
144
145     /**
146      * Adds a feature to feature set
147      *
148      * @since       2.1
149      *
150      * @return      Feature index of newly created feature on success.
151      *              If A specified input image file path is invalid, it returns -1.
152      *
153      * @param[in]   imageBuffer              Image buffer of grayscale image data of specified width and height
154      * @param[in]   width                    Width of input image
155      * @param[in]   height                   Height of input image
156      * @param[in]   description              Description of the feature
157      *
158      * @exception   E_INVALID_ARG            A specified input parameter is invalid.
159      *
160      * @remarks     The specific error code can be accessed using the GetLastResult() method.
161      *              Calling this method actually means 'Mark As Add Feature'.
162      *              And the marked feature data will be added to feature set file after calling Flush();
163      * @see         Flush(const Tizen::Base::String* featureSetFilePath = 0);
164      */
165     int AddFeature(const Tizen::Base::ByteBuffer& imageBuffer, int width, int height, const Tizen::Base::String& description);
166
167     /**
168      * Gets total number of features in feature set.
169      *
170      * @since       2.1
171      *
172      * @return      Total number of features in the feature set.
173      * @see
174      */
175     int GetTotalNumberOfFeatures(void);
176
177     /**
178      * Deletes a feature of specified index in the feature set
179      *
180      * @since       2.1
181      *
182      * @return      An error code.
183      *
184      * @param[in]   featureIndex             Feature index in feature set
185      *
186      * @exception   E_SUCCESS                The method is successful.
187      * @exception   E_INVALID_ARG            A specified input parameter is invalid.
188      * @exception   E_OUT_OF_MEMORY          The memory is insufficient.
189      *
190      * @remarks     Calling this method actually means 'Mark As Delete Feature'.
191      *              And the marked feature data will be deleted after calling Flush();
192      * @see         Flush(const Tizen::Base::String* featureSetFilePath = 0);
193      */
194     result DeleteFeature(int featureIndex);
195
196     /**
197      * Deletes all features in feature set
198      *
199      * @since       2.1
200      *
201      * @return      An error code.
202      *
203      * @exception   E_SUCCESS          The method is successful.
204      * @exception   E_OUT_OF_MEMORY    The memory is insufficient.
205      *
206      * @remarks     Calling this method actually means 'Mark As Delete All Features'.
207      *              And all feature data will be deleted after calling Flush();
208      * @see         Flush(const Tizen::Base::String* featureSetFilePath = 0);
209      */
210     result DeleteAllFeatures(void);
211
212     /**
213      * Saves features into feature set file and update all changes as marked.
214      *
215      *
216      * @since       2.1
217      *
218      * @return      An error code.
219      *
220      * @param[in]   featureSetFilePath   Feature set file path
221      * @exception   E_SUCCESS            The method is successful.
222      * @exception   E_INVALID_ARG        A specified Feature set path is invalid.
223      *
224      * @remarks     All changes in feature set file by 'AddFeature' or 'DeleteFeature' or 'DeleteAllFeatures' are updated by calling this Flush() method.
225      *              If featureSetFilePath is not decided or is same to file path used in Load(), the loaded feature set file will be updated.
226      *              If featureSetFilePath is not same to file path used in Load(), the loaded feature set file is remained and new feature set file will be created.
227      * @remarks     If featureSetFilePath is null, the feature set file loaded by Load() method will be overwritten.
228      *
229      * @see
230      */
231     result Flush(const Tizen::Base::String* featureSetFilePath = null);
232
233     /**
234      * Gets information of the individual feature
235      *
236      * @since       2.1
237      *
238      * @return      pointer to ImageFeatureInfo
239      *
240      * @param[in]   index       Feature index in feature set.
241      * @see
242      */
243     const Tizen::Uix::Vision::ImageFeatureInfo* GetImageFeatureInfo(int featureIndex) const;
244
245
246 private:
247     /**
248      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
249      */
250     ImageFeatureManager(const ImageFeatureManager&);
251
252     /**
253      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
254      */
255     ImageFeatureManager& operator=(const ImageFeatureManager&);
256
257 private:
258     class  _ImageFeatureManagerImpl* __pImageFeatureManagerImpl;
259     friend class _ImageFeatureManagerImpl;
260   };
261
262 } } } //Tizen::Uix::Vision
263
264 #endif // _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_