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 %Tizen::Uix::Vision::QrCodeRecognizer class.
23 #ifndef _FUIX_VISION_QR_CODE_RECOGNIZER_H_
24 #define _FUIX_VISION_QR_CODE_RECOGNIZER_H_
25 #include <FBaseObject.h>
26 #include <FUixVisionQrCodeObject.h>
29 namespace Tizen { namespace Uix { namespace Vision
32 * @class QrCodeRecognizer
33 * @brief This class provides methods to generate QR code image.
37 * The following example demonstrates how to use the %QrCodeRecognizer class.
41 * // Recognition engine initialization
44 * Tracker::Initialize()
47 * __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
48 * __pQrRecognizer->Construct();
49 * __pQrRecognizer->SetFrameSize(CAMERA_WIDTH, CAMERA_HEIGHT);
52 * //We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
55 * Tracker::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
57 * //Processing of the camera image follows
58 * __pQrRecognizer->ProcessFrame(previewedData);
60 * //Loop through all recognized QRs
61 * for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
64 * const Tizen::Uix::Vision::QrCodeObject *o = __pQrRecognizer->GetQrCodeObject(i);
65 * Tizen::Base::String qrText = o->GetText();
73 class _OSP_EXPORT_ QrCodeRecognizer
74 : public Tizen::Base::Object
79 * This is the default constructor for this class.
80 * The object is not fully constructed after this constructor is called.
81 * For full construction, the Construct() method must be called right after calling this constructor.
85 QrCodeRecognizer(void);
88 * This is the destructor for this class. @n
89 * The resources are deallocated by this method.
90 * This destructor overrides Tizen::Base::Object::~Object().
94 ~QrCodeRecognizer(void);
97 * Initializes this instance of ImageRecognizer.
98 * Every application must call Construct() before calling any other method of ImageRecognizer.
101 * @exception E_SUCCESS The method is successful.
102 * @exception E_OUT_OF_MEMORY The memory is insufficient.
105 result Construct(void);
108 * Sets width and height of input image
112 * @return An error code.
114 * @param[in] width frame width in pixels
115 * @param[in] height frame height in pixels
116 * @exception E_SUCCESS The method is successful.
117 * @exception E_INVALID_ARG A specified input parameter is invalid.
118 * @remarks This must be called once before calling processFrame.
121 result SetImageSize(int width, int height);
124 * Process input image for recognition
128 * @return An error code.
130 * @param[in] imageBuffer Input image buffer
131 * It must be allocated outside and have size of (width*height) by SetImageSize().
132 * @exception E_SUCCESS The method is successful.
133 * @exception E_INVALID_ARG imageBuffer is not allocated or the size of imageBuffer is not equal to input image size by SetImageSize().
134 * @exception E_OUT_OF_MEMORY The memory is insufficient.
135 * @see SetImageSize(int width, int height)
137 result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
140 * Get the expected ROI(Region of Interest) of the recognized QR code for focusing
144 * @return An error code
145 * @param[out] roi the expected ROI(Region of Interest) of the recognized QR code
146 * @exception E_SUCCESS The method is successful.
147 * @exception E_INVALID_ARG A specified input parameter is invalid.
149 * @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.
152 result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
155 * Gets the number of the recognized QR code object
159 * @return Number of recognized QR code object
161 * @remarks The recognized QR code object has index value from 0 to (number of the recognized QR code objects - 1)
162 * @see GetRecognizedObject(int index)
164 int GetRecognizedObjectCount(void);
167 * Gets the recognized QR code object to get information
171 * @return The pointer of QrCodeObject including all information about the reconginzed QR code object
172 * @param[in] index Index of the recognized QR code object
173 * Valid range of this parameter is 0 to (number of the recognized QR code objects - 1).
174 * @exception E_SUCCESS The method is successful.
176 * @see GetRecognizedObjectCount(void)
178 const QrCodeObject* GetRecognizedObject(int index) const;
183 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
185 QrCodeRecognizer(const QrCodeRecognizer& in);
188 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
190 QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
193 class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
194 friend class _QrCodeRecognizerImpl;
198 } } } //Tizen::Uix::Vision
200 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_