Created
July 21, 2017 01:33
-
-
Save iherrera/5e5de3204b25cc0565e6e59d1f78a460 to your computer and use it in GitHub Desktop.
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
[Foundation.Export("imagePickerController:didFinishPickingMediaWithInfo:")] | |
public virtual void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info){ | |
picker.DismissViewController(true, ()=>{}); | |
classificationLabel.Text = "Analyzing Image..."; | |
correctedImageView.Image = null; | |
var originalImg = new NSString("UIImagePickerControllerOriginalImage"); | |
var uiImage = (UIImage)info[originalImg]; | |
var ciImage = new CIImage(uiImage); | |
var orientation = UIImageOrientationToCGImagePropertyOrientation(uiImage.Orientation); | |
inputImage = ciImage.CreateWithOrientation(orientation) | |
imageView.Image = uiImage; | |
//var handler = VNImageRequestHandler | |
} | |
public CGImagePropertyOrientation UIImageOrientationToCGImagePropertyOrientation(UIImageOrientation orientation){ | |
switch (orientation){ | |
case UIImageOrientation.Down: | |
return CGImagePropertyOrientation.Down; | |
case UIImageOrientation.DownMirrored: | |
return CGImagePropertyOrientation.DownMirrored; | |
case UIImageOrientation.Up: | |
return CGImagePropertyOrientation.Up; | |
case UIImageOrientation.UpMirrored: | |
return CGImagePropertyOrientation.UpMirrored; | |
case UIImageOrientation.Left: | |
return CGImagePropertyOrientation.Left; | |
case UIImageOrientation.LeftMirrored: | |
return CGImagePropertyOrientation.LeftMirrored; | |
case UIImageOrientation.Right: | |
return CGImagePropertyOrientation.Right; | |
case UIImageOrientation.RightMirrored: | |
return CGImagePropertyOrientation.RightMirrored; | |
default: | |
return CGImagePropertyOrientation.Up; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment