modify doxygen comments
[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  *
46  * // Initializes recognition engine 
47  *
48  * void
49  * Tracker::Initialize()
50  *
51  * {
52  *      __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
53  *      __pQrRecognizer->Construct();
54  *      __pQrRecognizer->SetFrameSize(CAMERA_WIDTH, CAMERA_HEIGHT);
55  * }
56  *
57  * // We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
58  *
59  * void
60  * Tracker::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
61  * {
62  *         // Processing of the camera image follows
63  *         __pQrRecognizer->ProcessFrame(previewedData);
64  *
65  *        // Loops through all recognized QRs
66  *        for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
67  *        {
68  *
69  *             const Tizen::Uix::Vision::QrCodeObject *o = __pQrRecognizer->GetQrCodeObject(i);
70  *             Tizen::Base::String qrText = o->GetText();
71  *
72  *         }
73  *     }
74  * }
75  *
76  * @endcode
77  */
78 class _OSP_EXPORT_ QrCodeRecognizer
79     : public Tizen::Base::Object
80 {
81 public:
82
83     /**
84      * This is the default constructor for this class. @n
85      * The object is not fully constructed after this constructor is called. @n
86      * For full construction, the Construct() method must be called right after calling this constructor.
87      *
88      * @since    2.1
89      */
90     QrCodeRecognizer(void);
91
92     /**
93      * This is the destructor for this class. @n
94      * The resources are deallocated by this method.
95      * This destructor overrides Tizen::Base::Object::~Object().
96      *
97      * @since    2.1
98      */
99     ~QrCodeRecognizer(void);
100
101     /**
102      * Initializes this instance of %QrCodeRecognizer. @n
103      * Every application must call %Construct() before calling any other methods of %QrCodeRecognizer.
104      *
105      * @since        2.1
106      *
107      * @feature      %http://tizen.org/feature/vision.qrcode_recognition
108      *
109      * @exception    E_SUCCESS          The method is successful.
110      * @exception    E_UNSUPPORTED_OPERATION   The Emulator or target device does not support the required feature. 
111      * For more information, see <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">Application Filtering</a>.
112      * @remarks      Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue() methods.
113      */
114     result Construct(void);
115
116     /**
117      * Sets the width and height of an input image.
118      *
119      * @since        2.1
120      *
121      * @return       An error code
122      *
123      * @param[in]    width               The width of the frame in pixels
124      * @param[in]    height              The height of the frame in pixels
125      * @exception    E_SUCCESS           The method is successful.
126      * @exception    E_INVALID_ARG       A specified input parameter is invalid.
127      * @remarks      This method must be called once before calling ProcessImage().
128      */
129     result SetImageSize(int width, int height);
130
131     /**
132      * Processes an input image for recognition.
133      *
134      * @since        2.1
135      *
136      * @return       An error code
137      *
138      * @param[in]    imageBuffer        The input image buffer @n
139      *                                  It must be allocated outside and have size of (width*height) set by SetImageSize().
140      * @exception    E_SUCCESS          The method is successful.
141      * @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().
142      * @exception    E_OUT_OF_MEMORY    The memory is insufficient.
143      * @see          SetImageSize(int, int)
144      */
145     result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
146
147     /**
148      * Gets the expected ROI (Region of Interest) of the recognized QR code for focusing.
149      *
150      * @since        2.1
151      *
152      * @return       An error code
153      * @param[out]   roi                 The expected ROI (Region of Interest) of the recognized QR code
154      * @exception    E_SUCCESS           The method is successful.
155      * @exception    E_INVALID_ARG       The specified input parameter is invalid.
156      *
157      * @remarks      The ROI is used to reset camera focus to get better image and it can be obtained after calling ProcessImage() at least once.
158      */
159     result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
160
161     /**
162      * Gets a count of the recognized QR code object.
163      *
164      * @since        2.1
165      *
166      * @return       A count of the recognized QR code object
167      *
168      * @remarks      The recognized QR code object has index value from @c 0 to (count of the recognized QR code objects - 1)
169      * @see          GetRecognizedObject(int)
170      */
171     int GetRecognizedObjectCount(void);
172
173     /**
174      * Gets the recognized QR code object to get information.
175      *
176      * @since        2.1
177      *
178      * @return       A pointer to QrCodeObject that includes all information about the recognized QR code object
179      * @param[in]    index          The index of the recognized QR code object @n
180      *                              Valid range of this parameter is @c 0 to (count of the recognized QR code objects - 1).
181      * @exception    E_SUCCESS      The method is successful.
182      *
183      * @see          GetRecognizedObjectCount()
184      */
185     const QrCodeObject* GetRecognizedObject(int index) const;
186
187
188 private:
189     /**
190      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
191      */
192     QrCodeRecognizer(const QrCodeRecognizer& in);
193
194     /**
195      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
196      */
197     QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
198
199 private:
200     class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
201     friend class _QrCodeRecognizerImpl;
202
203 };
204
205 } } } //Tizen::Uix::Vision
206
207 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_