IOS: Ambiguous Use of init(CGImage)

两盒软妹~` 提交于 2019-12-07 03:23:36

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/45177678/ios-ambiguous-use-of-initcgimage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!