Fix flora license version
[platform/framework/native/vision.git] / src / ImageFeatureInfo.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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 #ifndef IMAGEFEATUREINFO_H_
19 #define IMAGEFEATUREINFO_H_
20
21 namespace sari2
22 {
23
24 class ImageFeatureManager;
25
26 /// Holds all required information about one object on scene.
27 class ImageFeatureInfo
28 {
29     friend class ImageRecognizer;
30
31 public:
32     /// \brief Default constructor.
33     ImageFeatureInfo(void);
34
35     /// \brief Constructor.
36     ///
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);
42
43     ImageFeatureInfo(const ImageFeatureInfo&);
44     ~ImageFeatureInfo(void) {}
45     ImageFeatureInfo& operator=(const ImageFeatureInfo&);
46
47     /// \brief Outputs file path to image of corresponding object from the
48     /// database.
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;
54
55     /// \brief valuate if the object is available for query.
56     /// \return true if object is available
57     bool isActive(void) const;
58
59     /// \brief Width of image of corresponding object from the database.
60     /// \return Image width.
61     int imageWidth(void) const;
62
63     /// \brief Height of image of corresponding object from the database.
64     /// \return Image height.
65     int imageHeight(void) const;
66
67     /// \breif Outputs thumbnail of image of corresponding object from the
68     /// database.
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;
77
78     /// \return Object's rectangle aspect ratio.
79     inline float aspect(void) const { int w = imageWidth(); return w > 0 ? imageHeight() / (float) w : 0.f; }
80
81
82 private:
83     int mTypeId; ///< ID of object type.
84     const void* mDatabase; ///< Objects database.
85
86 };
87
88 }
89
90 #endif // IMAGEFEATUREINFO_H_