core-image

“This class is not key value coding-compliant” using CoreImage

醉酒当歌 提交于 2019-12-08 15:53:47
问题 I'm working on a simple MacOS command-line application in Swift. I created a custom CoreImage filter and having troubles to use it. The code compiles just fine but when it runs it exits with the following error: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inputImage.' Any help with this issue would be greatly appreciated. Tried searching for an answer on SO but since my

UIGraphicsBeginImageContext must be Retina-aware?

拟墨画扇 提交于 2019-12-08 15:49:05
问题 I've read some posts which recommend the use of: UIGraphicsBeginImageContextWithOptions((image.size), NO, 0.0f) instead of: UIGraphicsBeginImageContext(image.size). Because the first one uses Retina-scale when drawing, otherwise you get blocky images. I'm a little confused about when to use or not the retina-scale option. If i have a photograph which is 1000x1000 px, and i call UIGraphicsBeginImageContext passing those dimensions, am i not specifying exactly how many points i want to draw? Is

Core Image and memory leak, swift 3.0

拜拜、爱过 提交于 2019-12-08 12:23:03
问题 i have problem i try use filter at some images which have extension 3000x2000 , when i do it RAM upper and app have fatal error the "didReceiveMemoryWarning". func setFilters(images: [UIImage]) -> [UIImage] { let filter = CIFilter(name: "CIColorControls")! filter.setValue(2.0, forKey: kCIInputContrastKey) let context = CIContext(options: nil) var result = [UIImage]() for img in images { let newImage = autoreleasepool(invoking: { () -> UIImage in filter.setValue(CIImage(image: img)!, forKey:

Memory leak for CoreImage

牧云@^-^@ 提交于 2019-12-08 11:58:53
问题 I have created blur image as below: //Blur the UIImage CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage]; CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"]; [gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"]; [gaussianBlurFilter setValue:[NSNumber numberWithFloat: 2] forKey: @"inputRadius"]; CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"]; CIImage *finalImage = [resultImage imageByCroppingToRect:CGRectMake(0, 10,

Get UIImage from function

我怕爱的太早我们不能终老 提交于 2019-12-08 11:20:51
问题 I wrote a function to apply the filter to a photo. Why the function always returns nil? func getImage() -> UIImage? { let openGLContext = EAGLContext(api: .openGLES2) let context = CIContext(eaglContext: openGLContext!) let coreImage = UIImage(cgImage: image.cgImage!) filter.setValue(coreImage, forKey: kCIInputImageKey) filter.setValue(1, forKey: kCIInputContrastKey) if let outputImage = filter.value(forKey: kCIOutputImageKey) as? CIImage { let output = context.createCGImage(outputImage, from

CIHueAdjust core image filter setup

狂风中的少年 提交于 2019-12-08 10:02:42
问题 I am getting an error when I try to implement CIHueAdjust. The app terminates with an error like: -[CIImage doubleValue]: unrecognized selector sent to instance 0xd6606d0 Here is the whole project:owolf.net/uploads/StackOverflow/HueAdjustProject.zip Here is the .m code: - (void)viewDidLoad { context = [CIContext contextWithOptions:nil]; hueFilter = [CIFilter filterWithName:@"CIHueAdjust"]; inputCGImage = imageView.image.CGImage; [super viewDidLoad]; } - (IBAction)hueSliderValueChanged:(id

CIDetctor always remains nil, Cant read QRCode

ε祈祈猫儿з 提交于 2019-12-08 09:46:12
问题 I cannot initialize CIDetector for reading QRCOde , It always remains nil. Here is my code : let options = [CIDetectorAccuracy: CIDetectorAccuracyHigh] self.detector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: options) If I replace CIDetectorTypeQRCode with CIDetectorTypeRectangle it get initialized but I need to read QRCode I am trying from last two days, Please help 回答1: Finally got that working: Follow the steps: Select XcodeProject Select Target Select BuildSettings

When applying a filter to a UIImage the result is upside down

折月煮酒 提交于 2019-12-08 07:09:15
问题 This is really annoying me. When I convert a UIImage to a CIImage, apply a filter then convert back the image is upside down (for landscape) or rotated anticlockwise 90 degrees (for portrait). var image:UIImage? var index:Int? @IBOutlet weak var photo: UIImageView! @IBAction func editImage(sender: UIBarButtonItem) { println("editImage") let beginImage = CIImage(image: self.image) let filter = CIFilter(name: "CISepiaTone") filter.setValue(beginImage, forKey: kCIInputImageKey) filter.setValue(0

Apply Core Image Filter to Video on OS X using Swift

早过忘川 提交于 2019-12-08 05:57:42
问题 I am planning to build an NSOpenGLView for an OS X app using SWIFT which can be used to apply Core Image Filter and effects to a video, so far I have worked on the code for the video Controller to add video playback, but I am not sure how to apply the filter to the video: class VideoMediaViewController: NSViewController { weak var mainView : DTMainViewController? @IBOutlet weak var aVPlayerView: AVPlayerView! var url:NSURL?{ didSet{ // this is the setter } } var observer:AnyObject? var player

Unable to Decrease CIVignette effect using UISlider

北战南征 提交于 2019-12-08 04:37:57
问题 I have used CIVignette effect for My Photo Editing app. It applying based on Slider's Changing event. I have used following code and my issue is whenever I increased slider's value Vignette effect is appeared but whenever I decrease slider's value the Vignette effect does not decrease. Please Help. @IBAction func slider(_ sender: UISlider) { let startImage = CIImage(image: imgEdited!)! let vignetteFilter = CIFilter(name: "CIVignette")! let radius = 5 vignetteFilter.setValue(startImage, forKey