Text Capture
Defined in namespace Scandit.DataCapture.Text.Capture
- TextCapture
class TextCapture : IDataCaptureMode
Added in version 6.16.0
Deprecated since version 6.26.0.
Capture mode for reading text.
- Create()
static TextCapture Create(DataCaptureContext context, TextCaptureSettings settings)
Added in version 6.16.0
Construct a new text capture mode with the provided context and settings. Then the context is not null, the capture mode is automatically added to the context.
- Enabled
bool
Enabled { get;set; }Added in version 6.16.0
Implemented from IDataCaptureMode. See IDataCaptureMode.Enabled.
- PointOfInterest
PointWithUnit PointOfInterest { get;set; }
Added in version 6.16.0
The point of interest overwriting the point of interest of the data capture view. By default, this overwriting point of interest is not set and the one from the data capture view is used.
The overwriting point of interest is used to control the center of attention for the following subsystems:
Location selection. When no location selection is set, the point of interest defines the location at which the recognition optimizes for reading barcodes.
Rendered viewfinders.
- ApplySettingsAsync()
Task ApplySettingsAsync(TextCaptureSettings settings)
Added in version 6.16.0
Asynchronously apply the new settings to the text capture mode. If text capture is currently running, the task will complete when the next frame is processed, and will use the new settings for that frame. If text capture is currently not running, the task will complete as soon as the settings have been stored and won’t wait until the next frame is going to be processed.
- Feedback
TextCaptureFeedback Feedback { get;set; }
Added in version 6.16.0
Instance of TextCaptureFeedback that is used by text capture to notify users about Success events.
The default instance of the Feedback will have both sound and vibration enabled. A default beep sound will be used for the sound.
To change the feedback emitted, the TextCaptureFeedback can be modified as shown below, or a new one can be assigned.
TextCapture textCapture = ...; textCapture.Feedback.Success = new Feedback(Vibration.DefaultVibration, Sound.DefaultSound);
- AddListener()
void
AddListener(ITextCaptureListener listener)Added in version 6.16.0
Add the listener to observe this text capture instance.
In case the same listener is already observing this instance, calling this method will not add the listener again.
- RemoveListener()
void
RemoveListener(ITextCaptureListener listener)Added in version 6.16.0
Remove a previously added listener from this text capture instance.
In case the listener is not currently observing this instance, calling this method has no effect.
- RecommendedCameraSettings
static CameraSettings RecommendedCameraSettings { get; }
Added in version 6.16.0
Returns the recommended camera settings for use with text capture.
- Context
DataCaptureContext Context { get; }
Added in version 6.16.0
Implemented from IDataCaptureMode. See IDataCaptureMode.Context.
- TextCaptured
event EventHandler<TextCaptureEventArgs> TextCaptured
Added in version 6.16.0
Occurs when at least one text has been captured. The newly captured texts can be retrieved from TextCaptureSession.NewlyCapturedTexts.
This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first.
Inside this event handler method, you will typically want to start processing the captured texts somehow, e.g. by validating the text captured. Depending on the application, you will want to pause, or stop recognition, or continue reading texts:
To pause the capture session, but keep the camera (frame source) running, just set the text capture’s enabled property to false.
textCapture.Enabled = false;
To stop the capture session, you will need to do both disable the capture mode and stop the frame source. While it is possible to only stop the camera and keep the capture mode enabled, this may lead to additional capture events being delivered, which is typically not desired. The following lines of code show how to disable the capture mode and stop the frame source as well:
// No more TextCaptured events will occur after this call textCapture.Enabled = false; // Asynchronously turn off the camera textCapture.Context?.FrameSource?.SwitchToDesiredStateAsync(FrameSourceState.Off);