2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @file FUixVisionQrCodeRecognizer.h
21 * @brief This is the header file for the %QrCodeRecognizer class.
23 * This header file contains the declarations of the %QrCodeRecognizer class.
25 #ifndef _FUIX_VISION_QR_CODE_RECOGNIZER_H_
26 #define _FUIX_VISION_QR_CODE_RECOGNIZER_H_
27 #include <FBaseObject.h>
28 #include <FUixVisionQrCodeObject.h>
30 #include <FGraphics.h>
32 namespace Tizen { namespace Uix { namespace Vision
35 * @class QrCodeRecognizer
36 * @brief This class provides methods to recognize a QR code image.
40 * The %QrCodeRecognizer class provides methods to generate a QR code image.
42 * The following example demonstrates how to use the %QrCodeRecognizer class.
46 * // Initializes recognition engine
49 * Tracker::Initialize()
52 * __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
53 * __pQrRecognizer->Construct();
54 * __pQrRecognizer->SetFrameSize(CAMERA_WIDTH, CAMERA_HEIGHT);
57 * // We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
60 * Tracker::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
62 * // Processing of the camera image follows
63 * __pQrRecognizer->ProcessFrame(previewedData);
65 * // Loops through all recognized QRs
66 * for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
69 * const Tizen::Uix::Vision::QrCodeObject *o = __pQrRecognizer->GetQrCodeObject(i);
70 * Tizen::Base::String qrText = o->GetText();
78 class _OSP_EXPORT_ QrCodeRecognizer
79 : public Tizen::Base::Object
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.
90 QrCodeRecognizer(void);
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().
99 ~QrCodeRecognizer(void);
102 * Initializes this instance of %QrCodeRecognizer. @n
103 * Every application must call %Construct() before calling any other methods of %QrCodeRecognizer.
107 * @feature %http://tizen.org/feature/vision.qrcode_recognition
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.
114 result Construct(void);
117 * Sets the width and height of an input image.
121 * @return An error code
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().
129 result SetImageSize(int width, int height);
132 * Processes an input image for recognition.
136 * @return An error code
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)
145 result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
148 * Gets the expected ROI (Region of Interest) of the recognized QR code for focusing.
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.
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.
159 result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
162 * Gets a count of the recognized QR code object.
166 * @return A count of the recognized QR code object
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)
171 int GetRecognizedObjectCount(void);
174 * Gets the recognized QR code object to get information.
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.
183 * @see GetRecognizedObjectCount()
185 const QrCodeObject* GetRecognizedObject(int index) const;
190 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
192 QrCodeRecognizer(const QrCodeRecognizer& in);
195 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
197 QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
200 class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
201 friend class _QrCodeRecognizerImpl;
205 } } } //Tizen::Uix::Vision
207 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_