ciimage

Cropping CIImage

孤街醉人 提交于 2019-11-28 01:33:40
问题 I have a class that takes an UIImage , initializes a CIImage with it like so: workingImage = CIImage.init(image: baseImage!) Then the image is used to cut out 9 neighbouring squares in a 3x3 pattern out of it - in a loop: for x in 0..<3 { for y in 0..<3 { croppingRect = CGRect(x: CGFloat(Double(x) * sideLength + startPointX), y: CGFloat(Double(y) * sideLength + startPointY), width: CGFloat(sideLength), height: CGFloat(sideLength)) let tmpImg = (workingImage?.cropping(to: croppingRect))! } }

Getting a CGImage from CIImage

爷,独闯天下 提交于 2019-11-27 23:09:41
问题 I have a UIImage which is loaded from a CIImage with: tempImage = [UIImage imageWithCIImage:ciImage]; The problem is I need to crop tempImage to a specific CGRect and the only way I know how to do this is by using CGImage . The problem is that in the iOS 6.0 documentation I found this: CGImage If the UIImage object was initialized using a CIImage object, the value of the property is NULL. A. How to convert from CIImage to CGImage? I'm using this code but I have a memory leak (and can't

Creating a blur effect in iOS7

↘锁芯ラ 提交于 2019-11-27 11:22:44
I have been searching for an answer to this question in a few hours now, and I just can't figure it out. I want to add a gaussian blur effect to the image when i press the button "Button". The user is the one that is adding the image. I have created an action for the "Button" based on sources from SO and other places on the web. It will not work. What am I doing wrong? Any code would be greatly appreciated. Here is my "Button" action: - (IBAction)test:(id)sender { CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"]; [gaussianBlurFilter setValue:imageView.image forKey: @

Swift Cannot remove CIFIlter from UIImage

牧云@^-^@ 提交于 2019-11-27 08:28:14
问题 been working on swift for a bit now and having trouble tackling this Core Image Framework. I was able to successfully create a CIFilter over an image however I'm not sure how to delete it. The Image Is placed over a UIView which resembles that of snapchat's camera screen and then there is an imageview which is a subview of the uiview that the image is previewed on. BTW Using The most up to date version of Xcode and iOS as well. Here is the code for when the black and white filter is applied:

CIDetector isn't releasing memory

偶尔善良 提交于 2019-11-27 06:53:12
问题 I'm using CIDetector as follows multiple times: -(NSArray *)detect:(UIImage *)inimage { UIImage *inputimage = inimage; UIImageOrientation exifOrientation = inimage.imageOrientation; NSNumber *orientation = [NSNumber numberWithInt:exifOrientation]; NSDictionary *imageOptions = [NSDictionary dictionaryWithObject:orientation forKey:CIDetectorImageOrientation]; CIImage* ciimage = [CIImage imageWithCGImage:inputimage.CGImage options:imageOptions]; NSDictionary *detectorOptions = [NSDictionary

Unable to convert CIImage to UIImage in Swift 3.0

拜拜、爱过 提交于 2019-11-27 03:17:40
问题 I am making image form QR Code by using following code: func createQRFromString(str: String) -> CIImage? { let stringData = str.dataUsingEncoding(NSUTF8StringEncoding) let filter = CIFilter(name: "CIQRCodeGenerator") filter?.setValue(stringData, forKey: "inputMessage") filter?.setValue("H", forKey: "inputCorrectionLevel") return filter?.outputImage } And Then I am adding to UIImageView Like this: if let img = createQRFromString(strQRData) { let somImage = UIImage(CIImage: img, scale: 1.0,

PNG/JPEG representation from CIImage always returns nil

左心房为你撑大大i 提交于 2019-11-26 17:59:21
I'm currently making a photo editing app. When a photo is selected by the user, it is automatically converted into black and white using this code: func blackWhiteImage(image: UIImage) -> Data { print("Starting black & white") let orgImg = CIImage(image: image) let bnwImg = orgImg?.applyingFilter("CIColorControls", withInputParameters: [kCIInputSaturationKey:0.0]) let outputImage = UIImage(ciImage: bnwImg!) print("Black & white complete") return UIImagePNGRepresentation(outputImage)! } The problem I am having with this code is that I keep getting this error: fatal error: unexpectedly found nil