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 %ImageFeatureManager class.
23 * This header file contains the declarations of the %ImageFeatureManager class.
26 #ifndef _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
27 #define _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_
28 #include <FBaseObject.h>
30 #include <FGrpBitmap.h>
31 #include <FUixVisionImageFeatureInfo.h>
34 namespace Tizen { namespace Uix { namespace Vision
38 * @class ImageFeatureManager
39 * @brief This class provides methods to generate individual feature data from an individual image data.
43 * The %ImageFeatureManager class provides methods to generate individual feature data from an individual image data. This class also provides methods to manage image feature set which is a collection of individual feature data.
45 * The following example demonstrates how to use the %ImageFeatureManager class.
48 * void GenerateImageFeatureSet()
50 * Tizen::Uix::Vision::ImageFeatureManager imageFeatureManager;
51 * imageFeatureManager.Construct();
52 * imageFeatureManager.Load("/opt/usr/media/Images/testFeatureSet.xdb");
53 * imageFeatureManager.AddFeature("/opt/usr/media/Images/image1.jpg");
54 * imageFeatureManager.AddFeature("/opt/usr/media/Images/image2.jpg");
55 * imageFeatureManager.AddFeature("/opt/usr/media/Images/image3.jpg");
56 * imageFeatureManager.Flush();
60 class _OSP_EXPORT_ ImageFeatureManager
61 : public Tizen::Base::Object
66 * This is the default constructor for this class. @n
67 * The object is not fully constructed after this constructor is called. @n
68 * For full construction, the Construct() method must be called right after calling this constructor.
72 ImageFeatureManager(void);
75 * This is the destructor for this class. @n
76 * The resources are deallocated by this method.
77 * This destructor overrides Tizen::Base::Object::~Object().
81 ~ImageFeatureManager(void);
84 * Initializes this instance of %ImageFeatureManager and create image feature set. @n
85 * Every application must call %Construct() before calling any other methods of %ImageFeatureManager.
89 * @feature %http://tizen.org/feature/vision.image_recognition
91 * @return An error code
93 * @exception E_SUCCESS The method is successful.
94 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
95 * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
96 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
98 result Construct(void);
101 * Loads a feature set file.
105 * @return An error code
107 * @param[in] featureSetFilePath The feature set file path
109 * @exception E_SUCCESS The method is successful.
110 * @exception E_INVALID_ARG The specified feature set file path is invalid.
111 * @exception E_OUT_OF_MEMORY The memory is insufficient.
114 * - If a feature set file exists, it is updated.
115 * - If a feature set file does not exist, it is newly created.
117 result Load(const Tizen::Base::String& featureSetFilePath);
120 * Gets a list of supported image file formats for adding a feature.
124 * @return A list of supported image file formats
126 static Tizen::Base::Collection::IListT<Tizen::Media::ImageFormat>* GetSupportedImageFileFormatsListN(void);
129 * Adds a feature to a feature set.
133 * @return A feature index of newly and successfully created feature, otherwise returns -1.
135 * @param[in] imagePath The input image file path
137 * @exception E_INVALID_ARG The specified input parameter is invalid.
140 * - 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 a feature set file after calling Flush().
144 * @see GetSupportedImageFileFormatsListN()
145 * Flush(const Tizen::Base::String*)
147 int AddFeature(const Tizen::Base::String& imagePath);
150 * Adds a feature to a feature set.
154 * @return A feature index of newly and successfully created feature, otherwise returns -1.
156 * @param[in] imageBuffer The image buffer of grayscale image data of specified width and height
157 * @param[in] width The width of the input image
158 * @param[in] height The height of the input image
159 * @param[in] description The description of the feature
161 * @exception E_INVALID_ARG A specified input parameter is invalid.
164 * - 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 a feature set file after calling Flush().
167 * @see Flush(const Tizen::Base::String*)
169 int AddFeature(const Tizen::Base::ByteBuffer& imageBuffer, int width, int height, const Tizen::Base::String& description);
172 * Gets the total number of features in a feature set.
176 * @return The total number of features in a feature set
178 int GetTotalNumberOfFeatures(void);
181 * Deletes a feature with a specified index in a feature set.
185 * @return An error code
187 * @param[in] featureIndex The feature index in a feature set
189 * @exception E_SUCCESS The method is successful.
190 * @exception E_INVALID_ARG The specified input parameter is invalid.
191 * @exception E_OUT_OF_MEMORY The memory is insufficient.
193 * @remarks Calling this method actually means 'Mark As Delete Feature'.
194 * And the marked feature data is deleted after calling Flush().
195 * @see Flush(const Tizen::Base::String*)
197 result DeleteFeature(int featureIndex);
200 * Deletes all features in a feature set.
204 * @return An error code
206 * @exception E_SUCCESS The method is successful.
207 * @exception E_OUT_OF_MEMORY The memory is insufficient.
209 * @remarks Calling this method actually means 'Mark As Delete All Features'.
210 * And all feature data is deleted after calling Flush().
211 * @see Flush(const Tizen::Base::String*)
213 result DeleteAllFeatures(void);
216 * Flushes features into a feature set file and updates all changes as marked.
221 * @return An error code
223 * @param[in] featureSetFilePath The feature set file path
224 * @exception E_SUCCESS The method is successful.
225 * @exception E_INVALID_ARG The specified feature set path is invalid.
228 * - All changes in the feature set file by 'AddFeature' or 'DeleteFeature' or 'DeleteAllFeatures' are updated by calling this method.
229 * - If @c featureSetFilePath is not decided or is same as the file path used in Load(), the loaded feature set file is updated.
230 * - If @c featureSetFilePath is not same as the file path used in %Load(), the loaded feature set file remains as is and new feature set file is created.
231 * - If @c featureSetFilePath is @c null, the feature set file loaded by %Load() is overwritten.
232 * - If @c featureSetFilePath is not decided or is same to file path used in Load() and the loaded feature set file is read-only E_INVALID_ARG exception will be returned.
234 result Flush(const Tizen::Base::String* featureSetFilePath = null);
237 * Gets information of the individual feature.
241 * @return A pointer to ImageFeatureInfo
243 * @param[in] featureIndex The feature index in a feature set
245 const Tizen::Uix::Vision::ImageFeatureInfo* GetImageFeatureInfo(int featureIndex) const;
250 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
252 ImageFeatureManager(const ImageFeatureManager&);
255 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
257 ImageFeatureManager& operator=(const ImageFeatureManager&);
260 class _ImageFeatureManagerImpl* __pImageFeatureManagerImpl;
261 friend class _ImageFeatureManagerImpl;
264 } } } //Tizen::Uix::Vision
266 #endif // _FUIX_VISION_IMAGE_FEATURE_MANAGER_H_