Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS: Ambiguous Use of init(CGImage)

I am trying to convert a CGImage into a CIImage; however, it is not working.

This line of code:

let personciImage = CIImage(CGImage: imageView.image!.CGImage!)

throws the following error

Ambiguous use of 'init(CGImage)'

I'm really confused as to what this error means.

I need to do this conversion because CIDetector.featuresInImage() from the built in CoreImage framework requires a CIImage

like image 735
James Dorfman Avatar asked Jul 18 '17 21:07

James Dorfman


1 Answers

I solved it on my own.

It turns out, I was capitalizing CGImage wrong. The code should really read:

let personciImage = CIImage(cgImage: imageView.image!.cgImage!)

This throws no errors.

like image 81
James Dorfman Avatar answered Nov 01 '22 18:11

James Dorfman