a23e55c00bd26ce7cd4062345722b0b064cbbeef
[framework/osp/vision.git] / src / ImageRecognitionInfo.h
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://www.tizenopensource.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 IMAGERECOGNITIONINFO_H_
19 #define IMAGERECOGNITIONINFO_H_
20
21 namespace sari2
22 {
23
24 class ImageFeatureManager;
25
26 /// Holds all required information about one object on scene.
27 class ImageRecognitionInfo
28 {
29     friend class ImageRecognizer;
30
31 public:
32     /// \brief Default constructor.
33     ImageRecognitionInfo(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     ImageRecognitionInfo(const ImageFeatureManager* ifm, int index);
42
43     ImageRecognitionInfo(const ImageRecognitionInfo&);
44     ~ImageRecognitionInfo(void) {}
45     ImageRecognitionInfo& operator=(const ImageRecognitionInfo&);
46
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; }
53
54     inline const float aspect(void) const {return mAspect; }
55
56     /// \brief Calculates homogeneous coordinates of reference image rectangle
57     /// verteces projections on current view.
58     /// \param[out] coordinates Buffer of size 8 to store calculation result as
59     /// follows: {x1, y1, x2, y2, x3, y3, x4, y4}.
60     /// \return 'true' on success.
61     bool rectangle(float *coordinates) const;
62
63 private:
64     int mIndex; ///< Unique ID of object on scene.
65     int mTypeId; ///< ID of object type.
66     float mTransform[16]; ///< OpenGL transformation matrix for object position.
67     float mAspect; ///< Object's aspect ratio.
68     const float *mLeft, *mRight;
69 };
70
71 }
72
73 #endif // IMAGERECOGNITIONINFO_H_