To demonstrate most of Document Scanning SDK features and the way how they should be used in real application we prepared demo application available in source codes available by request.
⚠️ Important Note.
Demo application source code provided “as is” without warranties of any kind. It could be freely used in commercial product only in case of commercial DSSDK license purchase.
To assist user in getting best possible document scan a Smart Camera module with live document boundaries detection mode been implemented.
In camera mode application searching for Document boundaries and if been detected draw preview frame around detected document. Also Smart Camera controls Effective Document area (the area the document occupies in the viewfinder) and Document trapezoid distortion.
In case of Auto Shot enabled in Settings
(default value) time out counter will start. If during timeout delay (set in Settings
with default of 0.7 sec) document boundaries will not change shot will be taken automatically without user intervention.
If Document boundaries were not found or their detection quality is not sufficient than a text message displayed (“Looking for document
”).
In case if document been placed too far from camera (Effective Document area too small) Bring camera closer to document
message will appear.
When user making shots holding camera with significant angle to document then specific trapezoid distortion will appear. DSSDK will correct this, but quality loss is probable (e.g. some document areas could be out of focus or blured). In such cases Smart Camera will ask user to Hold camera parallel to document
.
Main purpose of these measures is to minimize human factor and enforce user to take a shot only when document properly placed and detected in viewfinder.
User could reposition camera over document, place document to more contract background or increase lighting to achieve better results.
Live mode has only assistance purpose since user still has possibility to make a shot at any moment manually by tapping on camera button or anywhere on camera viewfinder.
This could be suitable when he can't change environment conditions or limited in time and ready for further manual correction.
Importing from Album relies on SmartCrop setting located in Settings
menu.
If been enabled than document boundaries manual correction will be offered only if border detection quality was not good enough. In case of well detected boundaries document will be cropped, perspective correction and chosen color profile applied. If switched off, then manual correction will always be offered.
Chosen color profile will be applied to next imported image.
Below brief description of color profiles.
Image will be retained as is (cropping and perspective correction will be applied according document borders detected or manually set).
Image will be processed as black and white. Recommended for document archiving and situations when document size is critical (e.g. weak network connection).
Image will be processed as grayscale. Good for comfortable eye reading or further OCR processing (depends on exact OCR engine image preprocessing).
Image will be processed as color. Recommended for situation when document colors retention is critical.
Switches ON and OFF document boundary detection in Smart Camera
Activate or disable Smart Camera Autoshot feature. When switched OFF user will have initiate shot manually.
Set time interval when all Smart Camera features should be met to initiate automatic shot.
Defines document output format.
Added to demonstrate how to create multi-page PDF and TIFF files. When enabled write same page in same file three time in row.
Opens standard iOS Sharing dialogue. Saves document in format set in Settings