hardcoded paths fixed
[framework/osp/vision.git] / inc / FUixVisionQrCodeRecognizer.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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
19 /**
20  * @file     FUixVisionQrCodeRecognizer.h
21  * @brief    This is the header file for the %Tizen::Uix::Vision::QrCodeRecognizer class.
22  */
23 #ifndef _FUIX_VISION_QR_CODE_RECOGNIZER_H_
24 #define _FUIX_VISION_QR_CODE_RECOGNIZER_H_
25 #include <FBaseObject.h>
26 #include <FUixVisionQrCodeObject.h>
27 #include <FBase.h>
28 #include <FGraphics.h>
29
30 namespace Tizen { namespace Uix { namespace Vision
31 {
32 /**
33  * @class    QrCodeRecognizer
34  * @brief    This class provides methods to generate QR code image.
35  *
36  * @since    2.1
37  *
38  * The following example demonstrates how to use the %QrCodeRecognizer class.
39  *
40  * @code
41  *
42  * // Recognition engine initialization
43  *
44  * void
45  * Tracker::Initialize()
46  *
47  * {
48  *      __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
49  *      __pQrRecognizer->Construct();
50  *      __pQrRecognizer->SetFrameSize(CAMERA_WIDTH, CAMERA_HEIGHT);
51  * }
52  *
53  * //We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
54  *
55  * void
56  * Tracker::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
57  * {
58  *         //Processing of the camera image follows
59  *         __pQrRecognizer->ProcessFrame(previewedData);
60  *
61  *        //Loop through all recognized QRs
62  *        for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
63  *        {
64  *
65  *             const Tizen::Uix::Vision::QrCodeObject *o = __pQrRecognizer->GetQrCodeObject(i);
66  *             Tizen::Base::String qrText = o->GetText();
67  *
68  *         }
69  *     }
70  * }
71  *
72  * @endcode
73  */
74 class _OSP_EXPORT_ QrCodeRecognizer
75     : public Tizen::Base::Object
76 {
77 public:
78
79     /**
80      * This is the default constructor for this class.
81      * The object is not fully constructed after this constructor is called.
82      * For full construction, the Construct() method must be called right after calling this constructor.
83      *
84      * @since    2.1
85      */
86     QrCodeRecognizer(void);
87
88     /**
89      * This is the destructor for this class. @n
90      * The resources are deallocated by this method.
91      * This destructor overrides Tizen::Base::Object::~Object().
92      *
93      * @since    2.1
94      */
95     ~QrCodeRecognizer(void);
96
97     /**
98      * Initializes this instance of ImageRecognizer.
99      * Every application must call Construct() before calling any other method of ImageRecognizer.
100      *
101      * @since        2.1
102      * @exception    E_SUCCESS          The method is successful.
103      * @exception    E_OUT_OF_MEMORY    The memory is insufficient.
104      * @see
105      */
106     result Construct(void);
107
108     /**
109      * Sets width and height of input image
110      *
111      * @since        2.1
112      *
113      * @return       An error code.
114      *
115      * @param[in]    width               frame width in pixels
116      * @param[in]    height              frame height in pixels
117      * @exception    E_SUCCESS           The method is successful.
118      * @exception    E_INVALID_ARG       A specified input parameter is invalid.
119      * @remarks      This must be called once before calling processFrame.
120      * @see
121      */
122     result SetImageSize(int width, int height);
123
124     /**
125      * Process input image for recognition
126      *
127      * @since        2.1
128      *
129      * @return       An error code.
130      *
131      * @param[in]    imageBuffer        Input image buffer
132      *                                  It must be allocated outside and have size of (width*height) by SetImageSize().
133      * @exception    E_SUCCESS          The method is successful.
134      * @exception    E_INVALID_ARG      imageBuffer is not allocated or the size of imageBuffer is not equal to input image size by SetImageSize().
135      * @exception    E_OUT_OF_MEMORY    The memory is insufficient.
136      * @see          SetImageSize(int width, int height)
137      */
138     result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
139
140     /**
141      * Get the expected ROI(Region of Interest) of the recognized QR code for focusing
142      *
143      * @since        2.1
144      *
145      * @return       An error code
146      * @param[out]   roi                 the expected ROI(Region of Interest) of the recognized QR code
147      * @exception    E_SUCCESS           The method is successful.
148      * @exception    E_INVALID_ARG       A specified input parameter is invalid.
149      *
150      * @remarks      The ROI is used for reset of camera foucs to get better image and it can be obtained after calling ProcessImage() at least once.
151      * @see
152      */
153     result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
154
155     /**
156      * Gets the number of the recognized QR code object
157      *
158      * @since        2.1
159      *
160      * @return       Number of recognized QR code object
161      *
162      * @remarks      The recognized QR code object has index value from 0 to (number of the recognized QR code objects - 1)
163      * @see          GetRecognizedObject(int index)
164      */
165     int GetRecognizedObjectCount(void);
166
167     /**
168      * Gets the recognized QR code object to get information
169      *
170      * @since        2.1
171      *
172      * @return       The pointer of QrCodeObject including all information about the reconginzed QR code object
173      * @param[in]    index          Index of the recognized QR code object
174      *                              Valid range of this parameter is 0 to (number of the recognized QR code objects - 1).
175      * @exception    E_SUCCESS      The method is successful.
176      *
177      * @see          GetRecognizedObjectCount(void)
178      */
179     const QrCodeObject* GetRecognizedObject(int index) const;
180
181
182 private:
183     /**
184      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
185      */
186     QrCodeRecognizer(const QrCodeRecognizer& in);
187
188     /**
189      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
190      */
191     QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
192
193 private:
194     class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
195     friend class _QrCodeRecognizerImpl;
196
197 };
198
199 } } } //Tizen::Uix::Vision
200
201 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_