简体   繁体   English

UIImage imagenamed:到CIImage不一致的结果

[英]UIImage imagenamed: to CIImage inconsistent results

I am having trouble with the following code; 我在使用以下代码时遇到麻烦;

//get a CIImage
UIImage *origImage  = [UIImage imageNamed:imageName];
CIImage *inputImage = [[CIImage alloc] initWithImage:origImage];

NSLog(@"the inputImage is %@", imageName);

imageName is an NSString property, and always logs correctly. imageName是一个NSString属性,并且始终正确记录。 In my project, if I put a breakpoint just following the CIImage line, I get the UIImage, but not the CIImage. 在我的项目中,如果我在CIImage行之后放置一个断点,则会得到UIImage,而不是CIImage。 Also, I've noticed some of the uiimage properties look odd (scale always tiny, eg 0.0000002 and _imageFlags seems empty). 另外,我注意到一些uiimage属性看起来很奇怪(比例总是很小,例如0.0000002和_imageFlags似乎是空的)。 I've recently built the code in a separate project, and it works fine (CIImage is created and can be used for CIFiltering etc), but not in this project. 我最近在一个单独的项目中构建了代码,并且工作正常(创建了CIImage并可以用于CIFiltering等),但是在该项目中却没有。 The only difference between the projects is the original (problematic) one had an OpenGLES implementation, whereas the new one just uses CoreImage. 项目之间的唯一区别是原始(有问题的)项目使用OpenGLES实现,而新项目仅使用CoreImage。 Also the old project was created from the iOS 6 SDK, the new one from the iOS 8 SDK. 同样,旧项目是从iOS 6 SDK创建的,新项目是从iOS 8 SDK创建的。 I've tried a few other methods of creating the CIImage (origimage.ciimage and via origimage.cgimage) but none work. 我尝试了其他几种创建CIImage的方法(origimage.ciimage和通过origimage.cgimage),但是没有任何效果。

Any ideas appreciated. 任何想法表示赞赏。

Thanks, dunga. 谢谢,粪便

I have resolved the issue. 我已经解决了这个问题。 The LLVM 6.0 Code Generation settings of the project, if any optimisation level was set (ie > none), then the CIImages failed to get assigned. 项目的LLVM 6.0代码生成设置,如果设置了任何优化级别(即>无),则CIImages无法分配。 Hence it worked in one project, but not the other. 因此,它在一个项目中起作用,而在另一个项目中却没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM