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 * @feature %http://tizen.org/feature/vision.image_recognition
89 * @return An error code.
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
93 * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
94 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
97 result Construct(void);
100 * Loads feature set file
104 * @return An error code.
106 * @param[in] featureSetFilePath Feature set file path
108 * @exception E_SUCCESS The method is successful.
109 * @exception E_INVALID_ARG A specified feature set file path is invalid.
110 * @exception E_OUT_OF_MEMORY The memory is insufficient.
112 * @remarks if feature set file exists, it will be updated.
113 * if feature set file does not exist, it will be newly created.
116 result Load(const Tizen::Base::String& featureSetFilePath);
119 * Returns list of supported image file formats for adding feature.
122 * @return list of supported image file formats
126 static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
129 * Adds a feature to feature set
133 * @return Feature index of newly created feature on success.
134 * If the specified input image file path is invalid, it returns -1.
136 * @param[in] imagePath Input image file path
138 * @exception E_INVALID_ARG A specified input parameter is invalid.
140 * @remarks The specific error code can be accessed using the GetLastResult() method.
141 * Input image file must be one of the supported image file formats.
142 * Calling this method actually means 'Mark As Add Feature'.
143 * And the marked feature data will be added to feature set file after calling Flush();
144 * @see GetSupportedImageFileFormatsListN(void)
145 * Flush(const Tizen::Base::String* featureSetFilePath = 0);
147 int AddFeature(const Tizen::Base::String& imagePath);
150 * Adds a feature to feature set
154 * @return Feature index of newly created feature on success.
155 * If A specified input image file path is invalid, it returns -1.
157 * @param[in] imageBuffer Image buffer of grayscale image data of specified width and height
158 * @param[in] width Width of input image
159 * @param[in] height Height of input image
160 * @param[in] description Description of the feature
162 * @exception E_INVALID_ARG A specified input parameter is invalid.
164 * @remarks The specific error code can be accessed using the GetLastResult() method.
165 * Calling this method actually means 'Mark As Add Feature'.
166 * And the marked feature data will be added to feature set file after calling Flush();
167 * @see Flush(const Tizen::Base::String* featureSetFilePath = 0);
169 int AddFeature(const Tizen::Base::ByteBuffer& imageBuffer, int width, int height, const Tizen::Base::String& description);
172 * Gets total number of features in feature set.
176 * @return Total number of features in the feature set.
179 int GetTotalNumberOfFeatures(void);
182 * Deletes a feature of specified index in the feature set
186 * @return An error code.
188 * @param[in] featureIndex Feature index in feature set
190 * @exception E_SUCCESS The method is successful.
191 * @exception E_INVALID_ARG A specified input parameter is invalid.
192 * @exception E_OUT_OF_MEMORY The memory is insufficient.
194 * @remarks Calling this method actually means 'Mark As Delete Feature'.
195 * And the marked feature data will be deleted after calling Flush();
196 * @see Flush(const Tizen::Base::String* featureSetFilePath = 0);
198 result DeleteFeature(int featureIndex);
201 * Deletes all features in feature set
205 * @return An error code.
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_OUT_OF_MEMORY The memory is insufficient.
210 * @remarks Calling this method actually means 'Mark As Delete All Features'.
211 * And all feature data will be deleted after calling Flush();
212 * @see Flush(const Tizen::Base::String* featureSetFilePath = 0);
214 result DeleteAllFeatures(void);
217 * Saves features into feature set file and update all changes as marked.
222 * @return An error code.
224 * @param[in] featureSetFilePath Feature set file path
225 * @exception E_SUCCESS The method is successful.
226 * @exception E_INVALID_ARG A specified Feature set path is invalid.
228 * @remarks All changes in feature set file by 'AddFeature' or 'DeleteFeature' or 'DeleteAllFeatures' are updated by calling this Flush() method.
229 * If featureSetFilePath is not decided or is same to file path used in Load(), the loaded feature set file will be updated.
230 * 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.
231 * @remarks If featureSetFilePath is null, the feature set file loaded by Load() method will be overwritten.
235 result Flush(const Tizen::Base::String* featureSetFilePath = null);
238 * Gets information of the individual feature
242 * @return pointer to ImageFeatureInfo
244 * @param[in] index Feature index in feature set.
247 const Tizen::Uix::Vision::ImageFeatureInfo* GetImageFeatureInfo(int featureIndex) const;
252 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
254 ImageFeatureManager(const ImageFeatureManager&);
257 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
259 ImageFeatureManager& operator=(const ImageFeatureManager&);
262 class _ImageFeatureManagerImpl* __pImageFeatureManagerImpl;
263 friend class _ImageFeatureManagerImpl;
266 } } } //Tizen::Uix::Vision
268 #endif // _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_