-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philipp Müller
committed
May 13, 2019
1 parent
09990b4
commit b7b02cd
Showing
214 changed files
with
1,586 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...es Source/ContainerScannerVertical/ViewController/ALVerticalContainerScanViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
// | ||
// ALContainerScanScanViewController.h | ||
// AnylineExamples | ||
// | ||
// Created by Daniel Albertini on 09.04.18. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import "ALBaseScanViewController.h" | ||
|
||
@interface ALVerticalContainerScanViewController : ALBaseScanViewController | ||
|
||
@end |
142 changes: 142 additions & 0 deletions
142
...es Source/ContainerScannerVertical/ViewController/ALVerticalContainerScanViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
// | ||
// ALShippingContainerScanViewController.m | ||
// AnylineExamples | ||
// | ||
// Created by Daniel Albertini on 09.04.18. | ||
// | ||
|
||
#import "ALVerticalContainerScanViewController.h" | ||
#import <Anyline/Anyline.h> | ||
#import "ALAppDemoLicenses.h" | ||
#import "ALResultEntry.h" | ||
#import "ALResultViewController.h" | ||
|
||
// This is the license key for the examples project used to set up Aynline below | ||
NSString * const kVerticalContainerScannerLicenseKey = kDemoAppLicenseKey; | ||
@interface ALVerticalContainerScanViewController ()<ALOCRScanPluginDelegate, ALInfoDelegate> | ||
|
||
// The Anyline plugin used for OCR | ||
@property (nonatomic, strong) ALOCRScanViewPlugin *containerScanViewPlugin; | ||
@property (nonatomic, strong) ALOCRScanPlugin *containerScanPlugin; | ||
@property (nullable, nonatomic, strong) ALScanView *scanView; | ||
|
||
@end | ||
|
||
@implementation ALVerticalContainerScanViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
// Set the background color to black to have a nicer transition | ||
self.view.backgroundColor = [UIColor blackColor]; | ||
self.title = @"Vertical Shipping Container"; | ||
// Initializing the module. Its a UIView subclass. We set the frame to fill the whole screen | ||
CGRect frame = [[UIScreen mainScreen] applicationFrame]; | ||
frame = CGRectMake(frame.origin.x, frame.origin.y + self.navigationController.navigationBar.frame.size.height, frame.size.width, frame.size.height - self.navigationController.navigationBar.frame.size.height); | ||
|
||
ALOCRConfig *config = [[ALOCRConfig alloc] init]; | ||
|
||
config.scanMode = ALAuto; | ||
|
||
NSString *containerAny = [[NSBundle mainBundle] pathForResource:@"USNr" ofType:@"any"]; | ||
[config setLanguages:@[containerAny] error:nil]; | ||
|
||
NSString *cmdFile = [[NSBundle mainBundle] pathForResource:@"container_scanner_vertical" ofType:@"ale"]; | ||
config.customCmdFilePath = cmdFile; | ||
|
||
NSError *error = nil; | ||
|
||
self.containerScanPlugin = [[ALOCRScanPlugin alloc] initWithPluginID:@"ANYLINE_OCR" | ||
licenseKey:kVerticalContainerScannerLicenseKey | ||
delegate:self | ||
ocrConfig:config | ||
error:&error]; | ||
NSAssert(self.containerScanPlugin, @"Setup Error: %@", error.debugDescription); | ||
[self.containerScanPlugin addInfoDelegate:self]; | ||
|
||
NSString *confPath = [[NSBundle mainBundle] pathForResource:@"vertical_container_scanner_capture_config" ofType:@"json"]; | ||
ALScanViewPluginConfig *scanViewPluginConfig = [ALScanViewPluginConfig configurationFromJsonFilePath:confPath]; | ||
|
||
self.containerScanViewPlugin = [[ALOCRScanViewPlugin alloc] initWithScanPlugin:self.containerScanPlugin | ||
scanViewPluginConfig:scanViewPluginConfig]; | ||
NSAssert(self.containerScanViewPlugin, @"Setup Error: %@", error.debugDescription); | ||
|
||
self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.containerScanViewPlugin]; | ||
|
||
//Enable Zoom Gesture | ||
[self.scanView enableZoomPinchGesture:YES]; | ||
|
||
// After setup is complete we add the scanView to the view of this view controller | ||
[self.view addSubview:self.scanView]; | ||
[self.view sendSubviewToBack:self.scanView]; | ||
|
||
//Start Camera: | ||
[self.scanView startCamera]; | ||
[self startListeningForMotion]; | ||
|
||
//Enable Zoom Gesture for the scanView | ||
[self.scanView enableZoomPinchGesture:YES]; | ||
|
||
self.controllerType = ALScanHistoryContainer; | ||
} | ||
|
||
/* | ||
This method will be called once the view controller and its subviews have appeared on screen | ||
*/ | ||
-(void)viewDidAppear:(BOOL)animated { | ||
[super viewDidAppear:animated]; | ||
|
||
// We use this subroutine to start Anyline. The reason it has its own subroutine is | ||
// so that we can later use it to restart the scanning process. | ||
[self startAnyline]; | ||
} | ||
|
||
/* | ||
Cancel scanning to allow the module to clean up | ||
*/ | ||
- (void)viewWillDisappear:(BOOL)animated { | ||
[self.containerScanViewPlugin stopAndReturnError:nil]; | ||
} | ||
|
||
/* | ||
This method is used to tell Anyline to start scanning. It gets called in | ||
viewDidAppear to start scanning the moment the view appears. Once a result | ||
is found scanning will stop automatically (you can change this behaviour | ||
with cancelOnResult:). When the user dismisses self.identificationView this | ||
method will get called again. | ||
*/ | ||
- (void)startAnyline { | ||
NSError *error; | ||
BOOL success = [self.containerScanViewPlugin startAndReturnError:&error]; | ||
if( !success ) { | ||
// Something went wrong. The error object contains the error description | ||
NSAssert(success, @"Start Scanning Error: %@", error.debugDescription); | ||
} | ||
} | ||
|
||
|
||
#pragma mark -- AnylineOCRModuleDelegate | ||
|
||
/* | ||
This is the main delegate method Anyline uses to report its results | ||
*/ | ||
- (void)anylineOCRScanPlugin:(ALOCRScanPlugin *)anylineOCRScanPlugin | ||
didFindResult:(ALOCRResult *)result { | ||
// We are done. Cancel scanning | ||
[self anylineDidFindResult:result.result barcodeResult:@"" image:result.image scanPlugin:anylineOCRScanPlugin viewPlugin:self.containerScanViewPlugin completion:^{ | ||
//Display the result | ||
NSMutableArray <ALResultEntry*> *resultData = [[NSMutableArray alloc] init]; | ||
[resultData addObject:[[ALResultEntry alloc] initWithTitle:@"Shipping Container Number" value:result.result]]; | ||
|
||
ALResultViewController *vc = [[ALResultViewController alloc] initWithResultData:resultData image:result.image]; | ||
[self.navigationController pushViewController:vc animated:YES]; | ||
}]; | ||
} | ||
|
||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { | ||
NSError *error = nil; | ||
BOOL success = [self.containerScanViewPlugin startAndReturnError:&error]; | ||
|
||
NSAssert(success, @"We failed starting: %@",error.debugDescription); | ||
} | ||
|
||
@end |
30 changes: 30 additions & 0 deletions
30
...e Examples Source/ContainerScannerVertical/vertical_container_scanner_capture_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"viewPlugin" : { | ||
"cutoutConfig" : { | ||
"style": "rect", | ||
"maxWidthPercent": "10%", | ||
"alignment": "top_half", | ||
"ratioFromSize": { | ||
"width": 9, | ||
"height": 62 | ||
}, | ||
"outerColor": "000000", | ||
"outerAlpha": 0.3, | ||
"strokeWidth": 1, | ||
"strokeColor": "FFFFFF", | ||
"cornerRadius": 2, | ||
"feedbackStrokeColor": "0099FF", | ||
}, | ||
"scanFeedback" : { | ||
"animation": "traverse_multi", | ||
"animationDuration" : 250, | ||
"style": "contour_rect", | ||
"strokeWidth": 2, | ||
"strokeColor": "0099FF", | ||
"beepOnResult": true, | ||
"vibrateOnResult": true, | ||
"blinkAnimationOnResult": true | ||
}, | ||
"cancelOnResult" : true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.