Document Processing Settings
Processing Modes
- Set the scanning mode:
DocumentReader.Instance().Functionality().Edit().SetCaptureMode(CaptureMode.CaptureVideo).Apply();
RGLDocReader.Shared.Functionality.CaptureMode = RGLCaptureMode.CaptureVideo;
- Set the frame resolution, i.e. camera preview size:
DocumentReader.Instance().Functionality().Edit().SetCameraSize(1920, 1080).Apply();
RGLDocReader.Shared.Functionality.VideoSessionPreset = AVFoundation.AVCaptureSession.Preset1920x1080;
- Adjust a zoom level using the pinch gesture (in a range from 1x to 10x):
DocumentReader.Instance().Functionality().Edit().SetZoomEnabled(true).Apply();
RGLDocReader.Shared.Functionality.IsZoomEnabled = true;
- Set the zoom level (in a range from 1x to 10x):
DocumentReader.Instance().Functionality().Edit().SetZoomFactor(2.0F).Apply();
RGLDocReader.Shared.Functionality.ZoomFactor = 2.0F;
- Control in the multipage processing mode:
DocumentReader.Instance().Functionality().Edit().SetManualMultipageMode(true).Apply();
RGLDocReader.Shared.Functionality.ManualMultipageMode = true;
Warning
Do not use multipageProcessing and this one at the same time.
- Define the orientation of activities:
Danger
Make sure that the selected orientation corresponds to your application’s orientation. Otherwise, it may lead to unexpected behavior.
DocumentReader.Instance().Functionality().Edit().SetOrientation(DocReaderOrientation.Portrait).Apply();
RGLDocReader.Shared.Functionality.Orientation = UIInterfaceOrientationMask.Portrait;
- Specify the position of a capture device for video sessions:
RGLDocReader.Shared.Functionality.CameraPosition = AVFoundation.AVCaptureDevicePosition.Back;
Record Processing
To record the scanning process, use:
//implementation:
private class VideoEncoderCompletion : IVideoEncoderCompletion { ... }
private VideoEncoderCompletion videoEncoderCompletion = new VideoEncoderCompletion();
// set up completion
DocumentReader.Instance().SetVideoEncoderCompletion(videoEncoderCompletion);
RGLDocReader.Shared.Functionality.RecordScanningProcess = true;
RGLDocReader.Shared.Functionality.RecordScanningProcessDelegate = this;
NSUrl recordingOutputFileURL()
Asks the delegate for a URL to use for the output file:
NSUrl recordingOutputFileURL()
{
NSUrl[] paths = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User);
return paths[0].Append("video.mov", false);
}
didFinishRecordingToFile(NSUrl fileURL)
Tells the delegate that the recording is finished and a URL of the output file can be obtained:
void didFinishRecordingToFile(NSUrl fileURL)
{
Console.WriteLine("didFinishRecording: " + fileURL.AbsoluteUrl);
}
didFailWithError(NSError error)
Tells the delegate that an error has appeared:
void didFailWithError(NSError error)
{
Console.WriteLine("didFailWithError: " + error.LocalizedDescription);
}
Frame Processing
- You can assing a scenario that will be used upon tapping the Capture button:
DocumentReader.Instance().ProcessParams().CaptureButtonScenario = Scenario.ScenarioLocate;
RGLDocReader.Shared.ProcessParams.CaptureButtonScenario = Constants.RGL_SCENARIO_LOCATE;
- To manually set the document's bounds, invoke:
DocumentReader.Instance().ProcessParams().ManualCrop = (Java.Lang.Boolean)true;
RGLDocReader.Shared.ProcessParams.ManualCrop = true;
- Set the following option to true if you know for sure that the image you provide contains an already cropped by edges document:
DocumentReader.Instance().ProcessParams().AlreadyCropped = (Java.Lang.Boolean)true;
RGLDocReader.Shared.ProcessParams.AlreadyCropped = true;
Barcode Recognition
There are documents that contain barcodes with data that can be parsed only if the document type verification is performed.
Use the following property to set up the barcode parser type which should be used during the recognition. In this case, the barcode data will be parced without performing the document type verification:
DocumentReader.Instance().ProcessParams().BarcodeParserType = (Java.Lang.Integer)123;
RGLDocReader.Shared.ProcessParams.BarcodeParserType = 123;
Metadata
Display the metadata over the camera preview during the document processing, namely the perspective angle value:
DocumentReader.Instance().Functionality().Edit().SetDisplayMetadata(true).Apply();
RGLDocReader.Shared.Functionality.ShowMetadataInfo = true;
Custom Params
Set a custom JSON that should be processed along with other process params:
// allows you to depersonalize the document's data
DocumentReader.Instance().ProcessParams().CustomParams = new Org.Json.JSONObject("{\"dePersonalize\":[{\"allTextFields\":true},{\"allGraphicFields\":true}]}");
// allows you to depersonalize the document's data
var dict1 = new NSDictionary("allTextFields", true);
var dict2 = new NSDictionary("allGraphicFields", true);
var data = NSArray.FromObjects(dict1, dict2);
RGLDocReader.Shared.ProcessParams.CustomParams = new NSDictionary("dePersonalize", data);