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>
28 #include <FGraphics.h>
30 namespace Tizen { namespace Uix { namespace Vision
33 * @class QrCodeRecognizer
34 * @brief This class provides methods to generate QR code image.
38 * The following example demonstrates how to use the %QrCodeRecognizer class.
42 * // Recognition engine initialization
45 * Tracker::Initialize()
48 * __pQrRecognizer = new Tizen::Uix::Vision::QrCodeRecognizer();
49 * __pQrRecognizer->Construct();
50 * __pQrRecognizer->SetFrameSize(CAMERA_WIDTH, CAMERA_HEIGHT);
53 * //We suppose camera to be initialized with Tizen::Graphics::PIXEL_FORMAT_YCbCr420_PLANAR format
56 * Tracker::OnCameraPreviewed(Tizen::Base::ByteBuffer& previewedData, result r)
58 * //Processing of the camera image follows
59 * __pQrRecognizer->ProcessFrame(previewedData);
61 * //Loop through all recognized QRs
62 * for (int i = 0; i < __pQrRecognizer->GetRecognizedObjectCount(); i++)
65 * const Tizen::Uix::Vision::QrCodeObject *o = __pQrRecognizer->GetQrCodeObject(i);
66 * Tizen::Base::String qrText = o->GetText();
74 class _OSP_EXPORT_ QrCodeRecognizer
75 : public Tizen::Base::Object
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.
86 QrCodeRecognizer(void);
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().
95 ~QrCodeRecognizer(void);
98 * Initializes this instance of ImageRecognizer.
99 * Every application must call Construct() before calling any other method of ImageRecognizer.
102 * @exception E_SUCCESS The method is successful.
103 * @exception E_OUT_OF_MEMORY The memory is insufficient.
106 result Construct(void);
109 * Sets width and height of input image
113 * @return An error code.
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.
122 result SetImageSize(int width, int height);
125 * Process input image for recognition
129 * @return An error code.
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)
138 result ProcessImage(const Tizen::Base::ByteBuffer& imageBuffer);
141 * Get the expected ROI(Region of Interest) of the recognized QR code for focusing
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.
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.
153 result GetFocusRoi(Tizen::Graphics::Rectangle& roi);
156 * Gets the number of the recognized QR code object
160 * @return Number of recognized QR code object
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)
165 int GetRecognizedObjectCount(void);
168 * Gets the recognized QR code object to get information
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.
177 * @see GetRecognizedObjectCount(void)
179 const QrCodeObject* GetRecognizedObject(int index) const;
184 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
186 QrCodeRecognizer(const QrCodeRecognizer& in);
189 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
191 QrCodeRecognizer& operator=(const QrCodeRecognizer& in);
194 class _QrCodeRecognizerImpl* __pQrCodeRecognizerImpl;
195 friend class _QrCodeRecognizerImpl;
199 } } } //Tizen::Uix::Vision
201 #endif // _FUIX_VISION_QR_CODE_RECOGNIZER_H_