flora site modification
[platform/framework/native/vision.git] / src / ImageRecognizer.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://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 IMAGERECOGNIZER_H_
19 #define IMAGERECOGNIZER_H_
20
21 #include "ImageRecognitionInfo.h"
22
23 namespace sari2
24 {
25         class ImageFeatureManager;
26 }
27
28
29 namespace sari2
30 {
31
32 class ImageRecognizer
33 {
34 public:
35     ImageRecognizer(void);
36     ~ImageRecognizer(void);
37
38 public:
39     /// \brief Enables single or multi tracking mode.
40     /// \param[in] useMultiTracking Specifies if multiple objects tracking must
41     /// be enabled. If 'false', enables single object tracking.
42     void setMultiTracking(bool useMultiTracking);
43
44     /// \brief Setup input video-frame width and height.
45     ///
46     /// Must be called once before calling processFrame.
47     /// \param[in] width Frame width in pixels that is reported by
48     /// video-capture device.
49     /// \param[in] height Frame height in pixels that is reported by
50     /// video-capture device.
51     /// \return 'true' on success.
52     bool setImageSize(unsigned int width, unsigned int height);
53
54     /// \brief Setting scene transformation.
55     ///
56     /// Default matrix is identity.
57     /// \param[in] left Left transformation matrix 4x4.
58     /// \param[in] right Right transformation matrix 4x4.
59     void setSceneTransform(const float* left, const float* right);
60
61     /// \brief Sets object database for tracking.
62     /// \param[in] imgFMan Pointer on DB manager.
63     /// \return 'true' on success.
64     bool setImageDatabase(const ImageFeatureManager* imgFMan);
65
66     /// \brief Process external buffer with captured frame image.
67     /// \param[in] frame Pointer to buffer with intensity (grayscale8) data.
68     /// Buffer size must not be less than it set with setFrameSize
69     /// \pre setFrameSize
70     /// \return -1 on any error and processing time in ms on success.
71     int processImage(const unsigned char* frame);
72
73     /// Updates information about objects on scene.
74     /// \return Pointer on first element of the array of structures that holds
75     /// information about scene objects.
76     const ImageRecognitionInfo* objectsBegin(void) const;
77
78     /// \return Pointer on the end of the array of structures that holds
79     /// information about scene objects.
80     const ImageRecognitionInfo* objectsEnd(void) const;
81
82     /// \return Total number of images in database.
83     unsigned int databaseSize(void) const;
84
85 private:
86     ImageRecognizer(const ImageRecognizer&);
87     ImageRecognizer& operator=(const ImageRecognizer&);
88
89 private:
90     class ImageRecognizerImpl;
91     ImageRecognizerImpl* d; ///< implementation bridge
92 };
93
94 }
95 #endif // IMAGERECOGNIZER_H_