update header for Doxygen
[platform/framework/native/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 %QrCodeRecognizer class.
22  *
23  * This header file contains the declarations of the %QrCodeRecognizer class.
24  */
25 #ifndef _FUIX_VISION_QR_CODE_RECOGNIZER_H_
26 #define _FUIX_VISION_QR_CODE_RECOGNIZER_H_
27 #include <FBaseObject.h>
28 #include <FUixVisionQrCodeObject.h>
29 #include <FBase.h>
30 #include <FGraphics.h>
31
32 namespace Tizen { namespace Uix { namespace Vision
33 {
34 /**
35  * @class    QrCodeRecognizer
36  * @brief    This class provides methods to recognize a QR code image.
37  *
38  * @since    2.1
39  *
40  * The %QrCodeRecognizer class provides methods to generate a QR code image.
41  *
42  * The following example demonstrates how to use the %QrCodeRecognizer class.
43  *
44  * @code
45  * #include <FBase.h>
46  * #include <FUix.h>
47  * #include <FGraphics.h>
48  * #include <FIo.h>
49  * #include <FMedia.h>
50  * 
51  * using namespace Tizen::Base;
52  * using namespace Tizen::Media;
53  * using namespace Tizen::Graphics;
54  * using namespace Tizen::Io;
55  * using namespace Tizen::Uix::Vision;
56  * 
57  * class MyClass
58  *      : ICameraEventListener
59  * {
60  * public:
61  *      MyClass();
62  *      ~MyClass();
63  *      result Initialize(void);
64  * 
65  *      // Called when camera auto focus occurred
66  *      void OnCameraAutoFocused(bool completeCondition);
67  *      // Called when camera preview occurred
68  *      void OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r);
69  *      // Called when camera captured image
70  *      void OnCameraCaptured(Tizen::Base::ByteBuffer& capturedData, result r);
71  *      // Called when camera  error occurred
72  *      void OnCameraErrorOccurred(Tizen::Media::CameraErrorReason r);
73  * 
74  * private:
75  *      QrCodeRecognizer*               __pQrRecognizer;
76  * };
77  * 
78  * result
79  * MyClass::Initialize(void)
80  * {
81  *      result r;
82  * 
83  *      // Creates and initializes recognition engine
84  *      __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
85  *      r = __pQrRecognizer->Construct();
86  * 
87  *      //Image size must be same as camera preview size
88  *      r = __pQrRecognizer->SetImageSize(640, 480);
89  * 
90  *      return r;
91  * }
92  * 
93  * // We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
94  * void
95  * MyClass::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
96  * {
97  *      // Processing of the camera image follows
98  *      __pQrRecognizer->ProcessImage(previewedData);
99  * 
100  *      // Loops through all recognized QRs
101  *      for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
102  *      {
103  *              const QrCodeObject *o = __pQrRecognizer->GetRecognizedObject(i);
104  *              String qrText = o->GetText();
105  *      }
106  * }
107  *
108  * @endcode
109  */
110 class _OSP_EXPORT_ QrCodeRecognizer
111     : public Tizen::Base::Object
112 {
113 public:
114
115     /**
116      * This is the default constructor for this class. @n
117      * The object is not fully constructed after this constructor is called. @n
118      * For full construction, the Construct() method must be called right after calling this constructor.
119      *
120      * @since    2.1
121      */
122     QrCodeRecognizer(void);
123
124     /**
125      * This is the destructor for this class. @n
126      * The resources are deallocated by this method.
127      * This destructor overrides Tizen::Base::Object::~Object().
128      *
129      * @since    2.1
130      */
131     ~QrCodeRecognizer(void);
132
133     /**
134      * Initializes this instance of %QrCodeRecognizer. @n
135      * Every application must call %Construct() before calling any other methods of %QrCodeRecognizer.
136      *
137      * @since        2.1
138      *
139      * @feature      %http://tizen.org/feature/vision.qrcode_recognition
140      *
141      * @exception    E_SUCCESS          The method is successful.
142      * @exception    E_UNSUPPORTED_OPERATION   The Emulator or target device does not support the required feature. 
143      * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
144      * @remarks      Before calling this method, check whether the feature is supported by 
145          *                      Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
146      */
147     result Construct(void);
148
149     /**
150      * Sets the width and height of an input image.
151      *
152      * @since        2.1
153      *
154      * @return       An error code
155      *
156      * @param[in]    width               The width of the frame in pixels
157      * @param[in]    height              The height of the frame in pixels
158      * @exception    E_SUCCESS           The method is successful.
159      * @exception    E_INVALID_ARG       A specified input parameter is invalid.
160      * @remarks      This method must be called once before calling ProcessImage().
161      */
162     result SetImageSize(int width, int height);
163
164     /**
165      * Processes an input image for recognition.
166      *
167      * @since        2.1
168      *
169      * @return       An error code
170      *
171      * @param[in]    imageBuffer        The input image buffer @n
172      *                                  It must be allocated outside and have size of (width*height) set by SetImageSize().
173      * @exception    E_SUCCESS          The method is successful.
174      * @exception    E_INVALID_ARG      The specified @c imageBuffer is not allocated or the size of @c imageBuffer is not equal to the input image size set by SetImageSize().
175      * @exception    E_OUT_OF_MEMORY    The memory is insufficient.
176      * @see          SetImageSize(int, int)
177      */
178     result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
179
180     /**
181      * Gets the expected ROI (Region of Interest) of the recognized QR code for focusing.
182      *
183      * @since        2.1
184      *
185      * @return       An error code
186      * @param[out]   roi                 The expected ROI (Region of Interest) of the recognized QR code
187      * @exception    E_SUCCESS           The method is successful.
188      * @exception    E_INVALID_ARG       The specified input parameter is invalid.
189      *
190      * @remarks      The ROI is used to reset camera focus to get better image and it can be obtained after calling ProcessImage() at least once.
191      */
192     result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
193
194     /**
195      * Gets a count of the recognized QR code object.
196      *
197      * @since        2.1
198      *
199      * @return       A count of the recognized QR code object
200      *
201      * @remarks      The recognized QR code object has index value from @c 0 to (count of the recognized QR code objects - 1)
202      * @see          GetRecognizedObject(int)
203      */
204     int GetRecognizedObjectCount(void);
205
206     /**
207      * Gets the recognized QR code object to get information.
208      *
209      * @since        2.1
210      *
211      * @return       A pointer to QrCodeObject that includes all information about the recognized QR code object
212      * @param[in]    index          The index of the recognized QR code object @n
213      *                              Valid range of this parameter is @c 0 to (count of the recognized QR code objects - 1).
214      * @exception    E_SUCCESS      The method is successful.
215      *
216      * @see          GetRecognizedObjectCount()
217      */
218     const QrCodeObject* GetRecognizedObject(int index) const;
219
220
221 private:
222     /**
223      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
224      */
225     QrCodeRecognizer(const QrCodeRecognizer& in);
226
227     /**
228      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
229      */
230     QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
231
232 private:
233     class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
234     friend class _QrCodeRecognizerImpl;
235
236 };
237
238 } } } //Tizen::Uix::Vision
239
240 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_