IOS: Ambiguous Use of init(CGImage)
Asked Answered
M

1

6

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

Monge answered 18/7, 2017 at 21:48 Comment(0)
M
21

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.

Monge answered 18/7, 2017 at 21:51 Comment(2)
seems to be an artifact of conversion between Swift versions. Why would the compiler not flag this as an unknown?Sarabia
I was stuck on this for a bit. Thank you.Fen

© 2022 - 2024 — McMap. All rights reserved.