2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @file FUixVisionImageFeatureManager.h
21 * @brief This is the header file for the %Tizen::Uix::Vision::ImageFeatureManager class.
24 #ifndef _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
25 #define _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
26 #include <FBaseObject.h>
28 #include <FGrpBitmap.h>
29 #include <FUixVisionImageFeatureInfo.h>
32 namespace Tizen { namespace Uix { namespace Vision
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.
42 * The %ImageFeatureManager class provides the ability to generate individual image feature data and manage image feature set.
44 * The following example demonstrates how to use the %ImageFeatureManager class.
47 * void GenerateImageFeatureSet()
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();
58 class _OSP_EXPORT_ ImageFeatureManager
59 : public Tizen::Base::Object
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.
70 ImageFeatureManager(void);
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().
79 ~ImageFeatureManager(void);
82 * Initialize this instance of ImageFeatureManager and create image feature set.
83 * Every application must call Construct() before calling any other method of ImageFeatureManager.
87 * @return An error code.
89 * @exception E_SUCCESS The method is successful.
90 * @exception E_OUT_OF_MEMORY The memory is insufficient.
93 result Construct(void);
96 * Loads feature set file
100 * @return An error code.
102 * @param[in] featureSetFilePath Feature set file path
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.
108 * @remarks if feature set file exists, it will be updated.
109 * if feature set file does not exist, it will be newly created.
112 result Load(const Tizen::Base::String& featureSetFilePath);
115 * Returns list of supported image file formats for adding feature.
118 * @return list of supported image file formats
122 static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
125 * Adds a feature to feature set
129 * @return Feature index of newly created feature on success.
130 * If the specified input image file path is invalid, it returns -1.
132 * @param[in] imagePath Input image file path
134 * @exception E_INVALID_ARG A specified input parameter is invalid.
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);
143 int AddFeature(const Tizen::Base::String& imagePath);
146 * Adds a feature to feature set
150 * @return Feature index of newly created feature on success.
151 * If A specified input image file path is invalid, it returns -1.
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
158 * @exception E_INVALID_ARG A specified input parameter is invalid.
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);
165 int AddFeature(const Tizen::Base::ByteBuffer& imageBuffer, int width, int height, const Tizen::Base::String& description);
168 * Gets total number of features in feature set.
172 * @return Total number of features in the feature set.
175 int GetTotalNumberOfFeatures(void);
178 * Deletes a feature of specified index in the feature set
182 * @return An error code.
184 * @param[in] featureIndex Feature index in feature set
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.
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);
194 result DeleteFeature(int featureIndex);
197 * Deletes all features in feature set
201 * @return An error code.
203 * @exception E_SUCCESS The method is successful.
204 * @exception E_OUT_OF_MEMORY The memory is insufficient.
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);
210 result DeleteAllFeatures(void);
213 * Saves features into feature set file and update all changes as marked.
218 * @return An error code.
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.
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.
231 result Flush(const Tizen::Base::String* featureSetFilePath = null);
234 * Gets information of the individual feature
238 * @return pointer to ImageFeatureInfo
240 * @param[in] index Feature index in feature set.
243 const Tizen::Uix::Vision::ImageFeatureInfo* GetImageFeatureInfo(int featureIndex) const;
248 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
250 ImageFeatureManager(const ImageFeatureManager&);
253 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
255 ImageFeatureManager& operator=(const ImageFeatureManager&);
258 class _ImageFeatureManagerImpl* __pImageFeatureManagerImpl;
259 friend class _ImageFeatureManagerImpl;
262 } } } //Tizen::Uix::Vision
264 #endif // _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_