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 IMAGERECOGNITIONINFO_H_
19 #define IMAGERECOGNITIONINFO_H_
23 class ImageFeatureManager;
26 /// Holds all required information about one object on scene.
27 class ImageRecognitionInfo
29 friend class ImageRecognizer;
32 /// \brief Default constructor.
33 ImageRecognitionInfo(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 ImageRecognitionInfo(const ImageFeatureManager* ifm, int index);
43 ImageRecognitionInfo(const ImageRecognitionInfo&);
44 ~ImageRecognitionInfo(void) {}
45 ImageRecognitionInfo& operator=(const ImageRecognitionInfo&);
47 /// \return Unique ID of object on scene.
48 inline int index(void) const { return mIndex; }
49 /// \return ID of object type.
50 inline int typeId(void) const { return mTypeId; }
51 /// \return OpenGL transformation matrix for object position.
52 inline const float* transform(void) const { return mTransform; }
54 inline const float aspect(void) const { int w = imageWidth(); return w > 0 ? imageHeight() / (float) w : 0.f; }
56 /// \brief Width of image of corresponding object from the database.
57 /// \return Image width.
58 int imageWidth(void) const;
60 /// \brief Height of image of corresponding object from the database.
61 /// \return Image height.
62 int imageHeight(void) const;
64 /// \brief Calculates homogeneous coordinates of reference image rectangle
65 /// verteces projections on current view.
66 /// \param[out] coordinates Buffer of size 8 to store calculation result as
67 /// follows: {x1, y1, x2, y2, x3, y3, x4, y4}.
68 /// \return 'true' on success.
69 bool rectangle(float *coordinates) const;
72 int mIndex; ///< Unique ID of object on scene.
73 int mTypeId; ///< ID of object type.
74 float mTransform[16]; ///< OpenGL transformation matrix for object position.
75 const Database* mDatabase;
80 #endif // IMAGERECOGNITIONINFO_H_