Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created September 1, 2018 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/e20888eb814b64f8e817b68caba9215c to your computer and use it in GitHub Desktop.
Save fitomad/e20888eb814b64f8e817b68caba9215c to your computer and use it in GitHub Desktop.
let request = VNCoreMLRequest(model: model) { [weak self] (request, error) -> Void in
self?.handleModelRequest(request: request, forIndex: index)
}
// Como escalamos la imagen para adecuarla al
// tamaño esperado por el modelo.
request.imageCropAndScaleOption = .scaleFit
let handler = VNImageRequestHandler(ciImage: image)
do
{
try handler.perform([ request ])
}
catch let error
{
print("No se puede ejecutar la operación con Vision. \(error.localizedDescription)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment