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 IMAGEFEATUREINFO_H_
19 #define IMAGEFEATUREINFO_H_
24 class ImageFeatureManager;
26 /// Holds all required information about one object on scene.
27 class ImageFeatureInfo
29 friend class ImageRecognizer;
32 /// \brief Default constructor.
33 ImageFeatureInfo(void);
35 /// \brief Constructor.
37 /// Gives information about image of specified object from database,
38 /// without providing tracking information.
39 /// \param[in] ifm ImageFeatureManager instance (holds image database).
40 /// \param[in] index ID of object in database.
41 ImageFeatureInfo(const ImageFeatureManager* ifm, int index);
43 ImageFeatureInfo(const ImageFeatureInfo&);
44 ~ImageFeatureInfo(void) {}
45 ImageFeatureInfo& operator=(const ImageFeatureInfo&);
47 /// \brief Outputs file path to image of corresponding object from the
49 /// \param[out] path Buffer to write image path into. Must be allocated
50 /// outside with specified size.
51 /// \param[in] length Allocated buffer size.
52 /// \return Path size.
53 unsigned int imagePath(char* path, unsigned int length) const;
55 /// \brief valuate if the object is available for query.
56 /// \return true if object is available
57 bool isActive(void) const;
59 /// \brief Width of image of corresponding object from the database.
60 /// \return Image width.
61 int imageWidth(void) const;
63 /// \brief Height of image of corresponding object from the database.
64 /// \return Image height.
65 int imageHeight(void) const;
67 /// \breif Outputs thumbnail of image of corresponding object from the
69 /// \param[out] outBuffer Buffer to store corresponding image thumbnail.
70 /// Must be allocated outside and have size 'bufWidth*bufHeight'.
71 /// \param[in] bufWidth Width of thumbnail image.
72 /// \param[in] bufHeight Height of thumbnail image.
73 /// \param[in] fit Specifies if fitting image is requires. If 'false', then
74 /// thumbnail image will be cropped.
75 /// \return 'true' on success.
76 bool getThumbnailImage(char* outBuffer, int bufWidth, int bufHeight, bool fit = true) const;
78 /// \return Object's rectangle aspect ratio.
79 inline float aspect(void) const { int w = imageWidth(); return w > 0 ? imageHeight() / (float) w : 0.f; }
83 int mTypeId; ///< ID of object type.
84 const void* mDatabase; ///< Objects database.
90 #endif // IMAGEFEATUREINFO_H_