Created
February 23, 2020 18:27
-
-
Save nbertagnolli/66402c10bf1f35acff7a10d0cb49997b to your computer and use it in GitHub Desktop.
Update image size in Xcode Model
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
func updateClassifications(for image: UIImage) { | |
classificationLabel.text = "Classifying..." | |
// Add this line before orientation to update the image size using the function in ResizeImage.swift | |
let resizedImage = resizeImage(image: image, targetSize: trainedImageSize) | |
// Previous: | |
// let orientation = CGImagePropertyOrientation(image.imageOrientation) | |
// The new line just has image changed to resizedImage | |
let orientation = CGImagePropertyOrientation(resizedImage.imageOrientation) | |
// Previous: | |
// guard let ciImage = CIImage(image: image) else { fatalError("Unable to create \(CIImage.self) from \(image).") } | |
// The new line just has the image variable changed to resizedImage | |
guard let ciImage = CIImage(image: resizedImage) else { fatalError("Unable to create \(CIImage.self) from \(resizedImage).") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment