williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0""
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: APIs of the OCR(Optical Character Recognition), current engine
|
williamr@2
|
15 |
* can recognize 24 bit colored image and 8 bit gray scale image
|
williamr@2
|
16 |
* in BMP format.And the size of images are also limited within
|
williamr@2
|
17 |
* 1600x1200 in pixel
|
williamr@2
|
18 |
*
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef OCRSRV_H
|
williamr@2
|
24 |
#define OCRSRV_H
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// INCLUDE FILES
|
williamr@2
|
27 |
#include <ocrcommon.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
// Constants
|
williamr@2
|
30 |
|
williamr@2
|
31 |
//class declaration
|
williamr@2
|
32 |
class OCREngineFactory;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/**
|
williamr@2
|
35 |
* OCR (Optical Character Recognition) Engine Observer
|
williamr@2
|
36 |
*
|
williamr@2
|
37 |
* This set of interfaces defines the observers of the OCR engine. This is the unique set
|
williamr@2
|
38 |
* for all types of engines. User needs to implement a concrete class which is derived from
|
williamr@2
|
39 |
* this class.
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* @lib ocrsrv.lib
|
williamr@2
|
42 |
* @since S60 3.1
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
class MOCREngineObserver
|
williamr@2
|
45 |
{
|
williamr@2
|
46 |
public:
|
williamr@2
|
47 |
/**
|
williamr@2
|
48 |
* This interface will be called after the Block Recognition is completed. This calling
|
williamr@2
|
49 |
* only valid when using the EEngineRecognizeBlock type of engine
|
williamr@2
|
50 |
* @see OCREngineFactory::TEngineType
|
williamr@2
|
51 |
* @see MOCREngineRecognizeBlock
|
williamr@2
|
52 |
*
|
williamr@2
|
53 |
* @since S60 3.1
|
williamr@2
|
54 |
* @param aError Error code to indicate the completion status
|
williamr@2
|
55 |
* @param aBlocks Pointer to the text information of the recognized image block, Please note
|
williamr@2
|
56 |
that the memory ownership belongs to the OCR engine and will not be passed
|
williamr@2
|
57 |
to your procedure after this calling
|
williamr@2
|
58 |
* @param aBlockCount Number of block identified
|
williamr@2
|
59 |
* @return None
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
virtual void RecognizeBlockComplete(TInt aError,
|
williamr@2
|
62 |
const TOCRTextRgnInfo* aBlocks,
|
williamr@2
|
63 |
const TInt aBlockCount) = 0;
|
williamr@2
|
64 |
|
williamr@2
|
65 |
/**
|
williamr@2
|
66 |
* This interface will be called after the Special Region Recognition is completed. This calling
|
williamr@2
|
67 |
* only valid when using the EEngineRecognizeBlock type of engine
|
williamr@2
|
68 |
* @see OCREngineFactory::TEngineType
|
williamr@2
|
69 |
* @see MOCREngineRecognizeBlock
|
williamr@2
|
70 |
*
|
williamr@2
|
71 |
* @since S60 3.1
|
williamr@2
|
72 |
* @param aError Error code to indicate the completion status
|
williamr@2
|
73 |
* @param aBlocks Pointer to the text information of the recognized image block, Please note
|
williamr@2
|
74 |
that the memory ownership belongs to the OCR engine and will not be passed
|
williamr@2
|
75 |
to your procedure after this calling
|
williamr@2
|
76 |
* @param aBlockCount Number of block identified
|
williamr@2
|
77 |
* @return None
|
williamr@2
|
78 |
*/
|
williamr@2
|
79 |
virtual void RecognizeSpecialRegionComplete(TInt aError,
|
williamr@2
|
80 |
const TOCRTextRgnInfo* aBlocks,
|
williamr@2
|
81 |
const TInt aBlockCount) = 0;
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
* This interface will be called after the Full Image Recognition is completed. This calling
|
williamr@2
|
85 |
* only valid when using the EEngineLayoutRecognize type of engine
|
williamr@2
|
86 |
* @see OCREngineFactory::TEngineType
|
williamr@2
|
87 |
* @see MOCREngineLayoutRecognize
|
williamr@2
|
88 |
*
|
williamr@2
|
89 |
* @since S60 3.1
|
williamr@2
|
90 |
* @param aError Error code to indicate the completion status
|
williamr@2
|
91 |
* @param aBlocks Pointer to the text information of the recognized image block, Please note
|
williamr@2
|
92 |
that the memory ownership belongs to the OCR engine and will not be passed
|
williamr@2
|
93 |
to your procedure after this calling
|
williamr@2
|
94 |
* @param aBlockCount Number of block identified
|
williamr@2
|
95 |
* @return None
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
virtual void RecognizeComplete(TInt aError,
|
williamr@2
|
98 |
const TOCRTextRgnInfo* aBlocks,
|
williamr@2
|
99 |
const TInt aBlockCount) = 0;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/**
|
williamr@2
|
102 |
* This interface will be called after the Full Image Layout Analysis is completed. This calling
|
williamr@2
|
103 |
* only valid when using the EEngineLayoutRecognize type of engine
|
williamr@2
|
104 |
* @see OCREngineFactory::TEngineType
|
williamr@2
|
105 |
* @see MOCREngineLayoutRecognize
|
williamr@2
|
106 |
*
|
williamr@2
|
107 |
* @since S60 3.1
|
williamr@2
|
108 |
* @param aError Error code to indicate the completion status
|
williamr@2
|
109 |
* @param aBlocks Pointer to the text information of the recognized image block, Please note
|
williamr@2
|
110 |
that the memory ownership belongs to the OCR engine and will not be passed
|
williamr@2
|
111 |
to your procedure after this calling
|
williamr@2
|
112 |
* @param aBlockCount Number of block identified
|
williamr@2
|
113 |
* @return None
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
virtual void LayoutComplete(TInt aError,
|
williamr@2
|
116 |
const TOCRBlockInfo* aBlocks,
|
williamr@2
|
117 |
const TInt aBlockCount) = 0;
|
williamr@2
|
118 |
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
* This interface will be called during the procession and indicates the progress.
|
williamr@2
|
121 |
*
|
williamr@2
|
122 |
* @since S60 3.1
|
williamr@2
|
123 |
* @param aPercent A percentage of the current progression
|
williamr@2
|
124 |
* @return None
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
virtual void RecognizeProcess(const TUint aPercent) = 0;
|
williamr@2
|
127 |
};
|
williamr@2
|
128 |
|
williamr@2
|
129 |
|
williamr@2
|
130 |
/**
|
williamr@2
|
131 |
* OCR (Optical Character Recognition) Engine Base
|
williamr@2
|
132 |
*
|
williamr@2
|
133 |
* Base class of the OCR engine, this offers definitions of the features which
|
williamr@2
|
134 |
* all engines shall give support
|
williamr@2
|
135 |
*
|
williamr@2
|
136 |
* @lib ocrsrv.lib
|
williamr@2
|
137 |
* @since S60 3.1
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
class MOCREngineBase
|
williamr@2
|
140 |
{
|
williamr@2
|
141 |
public:
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Get the current version of the OCR interfaces
|
williamr@2
|
145 |
*
|
williamr@2
|
146 |
* @since S60 3.1
|
williamr@2
|
147 |
* @return Current version
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
virtual TVersion GetVersion() const = 0;
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* This interface refreshes the installed language packages. The OCR engine
|
williamr@2
|
153 |
* supports the languages to be installed as SIS packages and can be installed
|
williamr@2
|
154 |
* or uninstalled dynamically. This method shall be called after changes made
|
williamr@2
|
155 |
* on the installed language packages
|
williamr@2
|
156 |
*
|
williamr@2
|
157 |
* @leave KErrNotFound No OCR engine found
|
williamr@2
|
158 |
* @since S60 3.1
|
williamr@2
|
159 |
* @return None
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
virtual void RefreshInstalledLanguageL() = 0;
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* This method sets the languages for the recognition, maximum 2 languages can
|
williamr@2
|
165 |
* be passed together, regardless of their position in the array
|
williamr@2
|
166 |
*
|
williamr@2
|
167 |
* @since S60 3.1
|
williamr@2
|
168 |
* @param aActiveLanguage Array of specified languages @see GetInstalledLanguage
|
williamr@2
|
169 |
* @return None
|
williamr@2
|
170 |
*
|
williamr@2
|
171 |
* @leave KErrArgument Language count is more than two
|
williamr@2
|
172 |
* @leave KErrNotSupported The language is not supported by current OCR engine
|
williamr@2
|
173 |
* @leave KErrOcrBadLanguage Unsupported language
|
williamr@2
|
174 |
* @leave KErrOcrBadDictFile Not set any language packages
|
williamr@2
|
175 |
*/
|
williamr@2
|
176 |
virtual void SetActiveLanguageL(const RArray<TLanguage>& aActiveLanguage) = 0;
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/**
|
williamr@2
|
179 |
* This method gets the languages which are currently installed and supported
|
williamr@2
|
180 |
*
|
williamr@2
|
181 |
* @since S60 3.1
|
williamr@2
|
182 |
* @param aLanguages Array of installed languages @see SetActiveLanguageL
|
williamr@2
|
183 |
* @return None
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
virtual void GetInstalledLanguage(RArray<TLanguage>& aLanguages) const = 0;
|
williamr@2
|
186 |
|
williamr@2
|
187 |
/**
|
williamr@2
|
188 |
* This method cancels the recognition
|
williamr@2
|
189 |
* Call to this method the process will be terminated, and a KErrCancel flag
|
williamr@2
|
190 |
* will be passed to MOCREngineObserver's observers and through the aError
|
williamr@2
|
191 |
* parameter. Call this method when the engine is not working will not take
|
williamr@2
|
192 |
* any effect, this method internally calls IsEngineActive method
|
williamr@2
|
193 |
* @see MOCREngineObserver
|
williamr@2
|
194 |
*
|
williamr@2
|
195 |
* @since S60 3.1
|
williamr@2
|
196 |
* @return None
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
virtual void CancelOperation() = 0;
|
williamr@2
|
199 |
|
williamr@2
|
200 |
/**
|
williamr@2
|
201 |
* This method judges whether a language is supported
|
williamr@2
|
202 |
*
|
williamr@2
|
203 |
* @since S60 3.1
|
williamr@2
|
204 |
* @param aLanguage A language specifed
|
williamr@2
|
205 |
* @return ETrue if supported; EFalse otherwise
|
williamr@2
|
206 |
*/
|
williamr@2
|
207 |
virtual TBool IsLanguageSupported(const TLanguage aLanguage) = 0;
|
williamr@2
|
208 |
|
williamr@2
|
209 |
/**
|
williamr@2
|
210 |
* This method tests whether the engine is working or not
|
williamr@2
|
211 |
* Typically you could call this method to test whether there is
|
williamr@2
|
212 |
* an outstanding request or not.
|
williamr@2
|
213 |
* Note that when you are trying to exit the application when
|
williamr@2
|
214 |
* there's an outstanding issue, you should first call this method
|
williamr@2
|
215 |
* and call CancelOperation method before really terminate the
|
williamr@2
|
216 |
* client application
|
williamr@2
|
217 |
*
|
williamr@2
|
218 |
* @since S60 3.1
|
williamr@2
|
219 |
* @return ETrue if the engine is working; EFalse otherwise
|
williamr@2
|
220 |
*/
|
williamr@2
|
221 |
virtual TBool IsEngineActive() const = 0;
|
williamr@2
|
222 |
};
|
williamr@2
|
223 |
|
williamr@2
|
224 |
|
williamr@2
|
225 |
/**
|
williamr@2
|
226 |
* OCR (Optical Character Recognition) Engine Interface Base
|
williamr@2
|
227 |
*
|
williamr@2
|
228 |
* Base interfaces for the OCR engine, all engines derived from this class
|
williamr@2
|
229 |
* User can access base features from Base method
|
williamr@2
|
230 |
*
|
williamr@2
|
231 |
* @lib ocrsrv.lib
|
williamr@2
|
232 |
* @since S60 3.1
|
williamr@2
|
233 |
*/
|
williamr@2
|
234 |
class MOCREngineInterface
|
williamr@2
|
235 |
{
|
williamr@2
|
236 |
public:
|
williamr@2
|
237 |
|
williamr@2
|
238 |
/**
|
williamr@2
|
239 |
* This method gets the MOCREngineBase interface, user can access base features
|
williamr@2
|
240 |
* from this method
|
williamr@2
|
241 |
*
|
williamr@2
|
242 |
* @since S60 3.1
|
williamr@2
|
243 |
* @return Pointer to the engine base @see MOCREngineBase
|
williamr@2
|
244 |
*/
|
williamr@2
|
245 |
virtual MOCREngineBase* Base() const = 0;
|
williamr@2
|
246 |
|
williamr@2
|
247 |
/**
|
williamr@2
|
248 |
* Virtual destructor
|
williamr@2
|
249 |
*/
|
williamr@2
|
250 |
virtual ~MOCREngineInterface() { };
|
williamr@2
|
251 |
};
|
williamr@2
|
252 |
|
williamr@2
|
253 |
|
williamr@2
|
254 |
/**
|
williamr@2
|
255 |
* OCR (Optical Character Recognition) Engine Interfaces with Layout Analysis
|
williamr@2
|
256 |
*
|
williamr@2
|
257 |
* This set of interfaces offers the OCR engine which supports Layout Analysis
|
williamr@2
|
258 |
* on full images. User shall pass the handle of the image through LayoutAnalysisL
|
williamr@2
|
259 |
* first, and then pass block ids to RecognizeL to complete the recognition.
|
williamr@2
|
260 |
*
|
williamr@2
|
261 |
* For Example:
|
williamr@2
|
262 |
* After passing the image handle to LayoutAnalysisL, the MOCREngineObserver::LayoutComplete
|
williamr@2
|
263 |
* will be called after the process. Then through the TOCRBlockInfo array (const TOCRBlockInfo* aBlock
|
williamr@2
|
264 |
* and const TInt aBlockCount), the user knows how many blocks have been identified
|
williamr@2
|
265 |
* together with their position information. Those blocks are marked with ids from Zero to
|
williamr@2
|
266 |
* aBlockCount - 1.
|
williamr@2
|
267 |
*
|
williamr@2
|
268 |
* Then the user must specify which blocks are going to be further processed (Note that layout analysis
|
williamr@2
|
269 |
* only gets you the position of those blocks, but does not recognize the characters inside each block).
|
williamr@2
|
270 |
* The const RArray<TInt>& aBlock in MOCREngineLayoutRecognize::RecognizeL saves all the ids that are
|
williamr@2
|
271 |
* selected to be further processed. e.g. if you have 10 blocks from LayoutComplete, you can append
|
williamr@2
|
272 |
* 1, 3, 5, 7 to the TInt array and pass it to RecognizeL
|
williamr@2
|
273 |
*
|
williamr@2
|
274 |
* Note that this class shall be used together with TEngineType set to EEngineLayoutRecognize
|
williamr@2
|
275 |
*
|
williamr@2
|
276 |
* @lib ocrsrv.lib
|
williamr@2
|
277 |
* @since S60 3.1
|
williamr@2
|
278 |
*/
|
williamr@2
|
279 |
class MOCREngineLayoutRecognize : public MOCREngineInterface
|
williamr@2
|
280 |
{
|
williamr@2
|
281 |
public:
|
williamr@2
|
282 |
|
williamr@2
|
283 |
/**
|
williamr@2
|
284 |
* This method does the layout analysis for the full image
|
williamr@2
|
285 |
*
|
williamr@2
|
286 |
* @since S60 3.1
|
williamr@2
|
287 |
* @param aBitmapHandle Handle of the image(get from CFbsBitmap::Handle())
|
williamr@2
|
288 |
* @param aSettings Settings for layout analysis @see TOCRLayoutSetting
|
williamr@2
|
289 |
* @return None
|
williamr@2
|
290 |
*
|
williamr@2
|
291 |
* @leave KErrNotSupported Image shall be in BMP format (24bit colored or 8 bit grayscale)
|
williamr@2
|
292 |
* and the size shall not exceed 1600x1200 in pixel
|
williamr@2
|
293 |
* @leave KErrNotReady Internal object is not constructed
|
williamr@2
|
294 |
* @leave KErrAbort Child thread does not exist or operation is aborted
|
williamr@2
|
295 |
* @leave KErrServerBusy OCR service is busy
|
williamr@2
|
296 |
*/
|
williamr@2
|
297 |
virtual void LayoutAnalysisL(const TInt aBitmapHandle,
|
williamr@2
|
298 |
const TOCRLayoutSetting aSettings) = 0;
|
williamr@2
|
299 |
|
williamr@2
|
300 |
/**
|
williamr@2
|
301 |
* This method does the character recognition for the image on base of the result from
|
williamr@2
|
302 |
* LayoutAnalysisL
|
williamr@2
|
303 |
*
|
williamr@2
|
304 |
* @since S60 3.1
|
williamr@2
|
305 |
* @param aSettings Settings for recognition
|
williamr@2
|
306 |
* @param aBlockIdsToRecognize Block Ids to be recognized
|
williamr@2
|
307 |
* @return None
|
williamr@2
|
308 |
*
|
williamr@2
|
309 |
* @leave KErrNotReady Internal object is not constructed
|
williamr@2
|
310 |
* @leave KErrAbort Child thread does not exist or operation is aborted
|
williamr@2
|
311 |
* @leave KErrArgument Bolck information is available
|
williamr@2
|
312 |
*
|
williamr@2
|
313 |
*/
|
williamr@2
|
314 |
virtual void RecognizeL(const TOCRRecognizeSetting aSettings,
|
williamr@2
|
315 |
const RArray<TInt>& aBlockIdsToRecognize) = 0;
|
williamr@2
|
316 |
};
|
williamr@2
|
317 |
|
williamr@2
|
318 |
/**
|
williamr@2
|
319 |
* OCR (Optical Character Recognition) Engine Interfaces without Layout Analysis
|
williamr@2
|
320 |
*
|
williamr@2
|
321 |
* This set of interfaces offers the OCR engine which does not support Layout Analysis
|
williamr@2
|
322 |
* on full images. User shall implement their own layout solution
|
williamr@2
|
323 |
*
|
williamr@2
|
324 |
* RecognizeBlockL recognizes text information in a single block area regardless of content
|
williamr@2
|
325 |
*
|
williamr@2
|
326 |
* RecognizeSpecialRegionL recognizes text information in a single block area and its content
|
williamr@2
|
327 |
* sensitive. User can select three different types of contents: e-mail address, phone numbers
|
williamr@2
|
328 |
* or web addresses @see TRegionInfo
|
williamr@2
|
329 |
*
|
williamr@2
|
330 |
* Note that this class shall be used together with TEngineType set to EEngineRecognizeBlock
|
williamr@2
|
331 |
*
|
williamr@2
|
332 |
* @lib ocrsrv.lib
|
williamr@2
|
333 |
* @since S60 3.1
|
williamr@2
|
334 |
*/
|
williamr@2
|
335 |
class MOCREngineRecognizeBlock : public MOCREngineInterface
|
williamr@2
|
336 |
{
|
williamr@2
|
337 |
public:
|
williamr@2
|
338 |
|
williamr@2
|
339 |
/**
|
williamr@2
|
340 |
* This method recognizes text in a single block
|
williamr@2
|
341 |
*
|
williamr@2
|
342 |
* @since S60 3.1
|
williamr@2
|
343 |
* @param aBitmapHandle Handle of the image(get from CFbsBitmap::Handle())
|
williamr@2
|
344 |
* @param aLayoutInfo Block information
|
williamr@2
|
345 |
* @return None
|
williamr@2
|
346 |
*
|
williamr@2
|
347 |
* @leave KErrNotSupported Image shall be in BMP format (24bit colored or 8 bit grayscale)
|
williamr@2
|
348 |
* and the size shall not exceed 1600x1200 in pixel
|
williamr@2
|
349 |
* @leave KErrNotReady Internal object is not constructed
|
williamr@2
|
350 |
* @leave KErrAbort Child thread does not exist or operation is aborted
|
williamr@2
|
351 |
* @leave KErrCouldNotConnect No connection to the font and bitmap server could be made
|
williamr@2
|
352 |
* @leave KErrUnknown No bitmap could be found with the specified handle number
|
williamr@2
|
353 |
* @leave KErrArgument aRegionInfo is available
|
williamr@2
|
354 |
* @leave KErrServerBusy OCR service is busy
|
williamr@2
|
355 |
*/
|
williamr@2
|
356 |
virtual void RecognizeBlockL(const TInt aBitmapHandle,
|
williamr@2
|
357 |
const TOCRLayoutBlockInfo aLayoutInfo) = 0;
|
williamr@2
|
358 |
|
williamr@2
|
359 |
/**
|
williamr@2
|
360 |
* This method recognizes text with special content in a single block
|
williamr@2
|
361 |
*
|
williamr@2
|
362 |
* Note that SetActiveLanguageL has to be called first and language must be set to TLanguage::ELangEnglish
|
williamr@2
|
363 |
*
|
williamr@2
|
364 |
* @since S60 3.1
|
williamr@2
|
365 |
* @param aBitmapHandle Handle of the image(get from CFbsBitmap::Handle())
|
williamr@2
|
366 |
* @param aRegionInfo Block information
|
williamr@2
|
367 |
* @return None
|
williamr@2
|
368 |
*
|
williamr@2
|
369 |
* @leave KErrNotSupported Image shall be in BMP format (24bit colored or 8 bit grayscale)
|
williamr@2
|
370 |
* and the size shall not exceed 1600x1200 in pixel
|
williamr@2
|
371 |
* @leave KErrNotReady Internal object is not constructed
|
williamr@2
|
372 |
* @leave KErrAbort Child thread does not exist or operation is aborted
|
williamr@2
|
373 |
* @leave KErrCouldNotConnect No connection to the font and bitmap server could be made
|
williamr@2
|
374 |
* @leave KErrUnknown No bitmap could be found with the specified handle number
|
williamr@2
|
375 |
* @leave KErrArgument aRegionInfo is available
|
williamr@2
|
376 |
* @leave KErrServerBusy OCR service is busy
|
williamr@2
|
377 |
*/
|
williamr@2
|
378 |
virtual void RecognizeSpecialRegionL(const TInt aBitmapHandle,
|
williamr@2
|
379 |
const TRegionInfo aRegionInfo) = 0;
|
williamr@2
|
380 |
};
|
williamr@2
|
381 |
|
williamr@2
|
382 |
/**
|
williamr@2
|
383 |
* OCR (Optical Character Recognition) API
|
williamr@2
|
384 |
*
|
williamr@2
|
385 |
* This static class offers the OCR APIs. The user shall call CreateOCREngineL
|
williamr@2
|
386 |
* and get the instance of one type of the OCR engine and then convert the instance
|
williamr@2
|
387 |
* from MOCREngineInterface to MOCREngineLayoutRecognize or MOCREngineRecognizeBlock
|
williamr@2
|
388 |
* according to the type information. And use ReleaseOCREngine to destroy the engine.
|
williamr@2
|
389 |
* @see OCREngineFactory::TEngineType
|
williamr@2
|
390 |
*
|
williamr@2
|
391 |
* Note: This procedure will create a new thread in your current process in order to
|
williamr@2
|
392 |
* run the OCR APIs, so you don't need to create new threads for OCR by yourself
|
williamr@2
|
393 |
*
|
williamr@2
|
394 |
* For example:
|
williamr@2
|
395 |
* A typical usage for the factory class would be like:
|
williamr@2
|
396 |
* @code
|
williamr@2
|
397 |
* const TOcrEngineEnv env;
|
williamr@2
|
398 |
* env.iPriority = EPriorityLess;
|
williamr@2
|
399 |
* env.iMaxHeapSize = 1200*KMinHeapGrowBy;
|
williamr@2
|
400 |
* MOCREngineInterface* myEngine = CreateOCREngineL( aObserver, env, EEngineLayoutRecognize);
|
williamr@2
|
401 |
* MOCREngineLayoutRecognize* layoutEngine = STATIC_CAST( MOCREngineLayoutRecognize*, myEngine );
|
williamr@2
|
402 |
* // TODO: call coresponding methods in layoutEngine
|
williamr@2
|
403 |
* ReleaseOCREngine( layoutEngine );
|
williamr@2
|
404 |
* @endcode
|
williamr@2
|
405 |
* @lib ocrsrv.lib
|
williamr@2
|
406 |
* @since S60 3.1
|
williamr@2
|
407 |
*/
|
williamr@2
|
408 |
class OCREngineFactory
|
williamr@2
|
409 |
{
|
williamr@2
|
410 |
public:
|
williamr@2
|
411 |
/**
|
williamr@2
|
412 |
* OCR Engine Types
|
williamr@2
|
413 |
*/
|
williamr@2
|
414 |
enum TEngineType
|
williamr@2
|
415 |
{
|
williamr@2
|
416 |
/**
|
williamr@2
|
417 |
* OCR Engine with layout analysis feature:
|
williamr@2
|
418 |
* by selecting this type of engine, LayoutAnalysisL
|
williamr@2
|
419 |
* shall be called first before RecognizeL.
|
williamr@2
|
420 |
*/
|
williamr@2
|
421 |
EEngineLayoutRecognize,
|
williamr@2
|
422 |
|
williamr@2
|
423 |
/**
|
williamr@2
|
424 |
* Engine without layout analysis feature:
|
williamr@2
|
425 |
* Layout information shall be passed through TOCRLayoutBlockInfo
|
williamr@2
|
426 |
* or TRegionInfo to the interfaces
|
williamr@2
|
427 |
*/
|
williamr@2
|
428 |
EEngineRecognizeBlock
|
williamr@2
|
429 |
|
williamr@2
|
430 |
};
|
williamr@2
|
431 |
|
williamr@2
|
432 |
public:
|
williamr@2
|
433 |
|
williamr@2
|
434 |
/**
|
williamr@2
|
435 |
* Create the OCR engine instance
|
williamr@2
|
436 |
*
|
williamr@2
|
437 |
* @since S60 3.1
|
williamr@2
|
438 |
* @param aObserver Pointer to the call callback function
|
williamr@2
|
439 |
* @param aEngineEnv Engine environment settings @see TOcrEngineEnv
|
williamr@2
|
440 |
* @param aEngineType Select a type of engine to be created @see OCREngineFactory::TEngineType
|
williamr@2
|
441 |
* @return Pointer to the engine created @see MOCREngineInterface
|
williamr@2
|
442 |
*
|
williamr@2
|
443 |
* @leave KErrArgument aEngineEnv.iMaxHeapSize is lower(equal) than KMinHeapGrowBy*1000
|
williamr@2
|
444 |
* @leave KErrNotSupported aEngineType is not supported
|
williamr@2
|
445 |
*/
|
williamr@2
|
446 |
IMPORT_C static MOCREngineInterface* CreateOCREngineL(MOCREngineObserver& aObserver,
|
williamr@2
|
447 |
const TOcrEngineEnv aEngineEnv,
|
williamr@2
|
448 |
TEngineType aEngineType);
|
williamr@2
|
449 |
|
williamr@2
|
450 |
/**
|
williamr@2
|
451 |
* Release the OCR engine instance
|
williamr@2
|
452 |
*
|
williamr@2
|
453 |
* @since S60 3.1
|
williamr@2
|
454 |
* @param aEng Pointer to the instance of the Engine
|
williamr@2
|
455 |
* @return None
|
williamr@2
|
456 |
*/
|
williamr@2
|
457 |
IMPORT_C static void ReleaseOCREngine(MOCREngineInterface* aEng);
|
williamr@2
|
458 |
|
williamr@2
|
459 |
private:
|
williamr@2
|
460 |
|
williamr@2
|
461 |
/**
|
williamr@2
|
462 |
* Constructor
|
williamr@2
|
463 |
*/
|
williamr@2
|
464 |
OCREngineFactory();
|
williamr@2
|
465 |
};
|
williamr@2
|
466 |
|
williamr@2
|
467 |
#endif // OCRSRV_H
|
williamr@2
|
468 |
|
williamr@2
|
469 |
// End of file
|