ciimage

Interpret XMP-Metadata in ALAssetRepresentation

六眼飞鱼酱① 提交于 2019-12-18 10:13:33
问题 When a user makes some changes (cropping, red-eye removal, ...) to photos in the built-in Photos.app on iOS, the changes are not applied to the fullResolutionImage returned by the corresponding ALAssetRepresentation . However, the changes are applied to the thumbnail and the fullScreenImage returned by the ALAssetRepresentation . Furthermore, information about the applied changes can be found in the ALAssetRepresentation 's metadata dictionary via the key @"AdjustmentXMP" . I would like to

PNG/JPEG representation from CIImage always returns nil

坚强是说给别人听的谎言 提交于 2019-12-17 04:07:55
问题 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

Converting UIImage to CIImage Returns nil

穿精又带淫゛_ 提交于 2019-12-13 09:54:16
问题 I'm trying to convert the UIImage from an imageView into a CIImage for the purpose of filtering it. However, I cannot get the CIImage to have a value. In the simplest form, here's what I am trying: let ciInput = CIImage(image: imageView.image!) but the ciInput always is nil. I have also tried let ciInput = CIImage(cgImage: imageView.image!.cgImage) but also returns nil. (imageView.image is not nil, but imageView.image!.cgImage and imageView.image!.ciImage are both nil) I need to convert the

“CIImage initWithCVPixelBuffer:options:” failed because its pixel format p422 is not supported in iOS 10

喜欢而已 提交于 2019-12-12 13:15:42
问题 In ios10 , I want to get video capture, but get an error "[CIImage initWithCVPixelBuffer:options:] failed because its pixel format p422 is not supported." My code is this: func previewImage(handle: (image: UIImage?) -> Void) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in dispatch_async(dispatch_get_main_queue(), { () -> Void in guard let time = self.player?.currentTime() else { return } guard let pixelBuffer = self.output?

Convert a UIImage to a CIImage to crop to a CGRect. AVFoundation

社会主义新天地 提交于 2019-12-11 01:53:04
问题 So I have a UIImage which I want to crop. I looked and found imageByCroppingToRect method for CIImage. So, I converted the data to CIImage instead of UIImage, crop it using the specified method and then convert the resulting CIImage to UIImage and then display it in a UIImageView. My code is NSData *data = [[NSData alloc]initWithData:[def objectForKey:@"imageData"]]; //UIImage *normalImage = [[UIImage alloc]initWithData:data]; CIImage *originalImage = [CIImage imageWithData:data];

How to make use of kCIFormatRGBAh to get half floats on iOS with Core Image?

浪尽此生 提交于 2019-12-10 21:35:47
问题 I'm trying to get the per-pixel RGBA values for a CIImage in floating point. I expect the following to work, using CIContext and rendering as kCIFormatRGBAh , but the output is all zeroes. Otherwise my next step would be converting from half floats to full. What am I doing wrong? I've also tried this in Objective-C and get the same result. let image = UIImage(named: "test")! let sourceImage = CIImage(CGImage: image.CGImage) let context = CIContext(options: [kCIContextWorkingColorSpace: NSNull

Getting UIImage from CIImage does not work properly

夙愿已清 提交于 2019-12-10 17:19:18
问题 I am having trouble with getting a UIImage from and CIImage. The line of code below works fine on iOS6: (Output image is an CIImage) self.imageView = [UIImage imageWithCIImage:outputImage]; or [self.imageView setImage:[UIImage imageWithCIImage:outputImage]]; When I run this same line of code on a device that is running iOS 5 the imageView is blank. If I log the size property of the UIImage it is correct but the image never displays on the screen. When I use a CGImageRef (as shown below) it

iOS face detector orientation and setting of CIImage orientation

好久不见. 提交于 2019-12-09 07:00:14
问题 EDIT found this code that helped with front camera images http://blog.logichigh.com/2008/06/05/uiimage-fix/ Hope others have had a similar issue and can help me out. Haven't found a solution yet. (It may seem a bit long but just a bunch of helper code) I'm using the ios face detector on images aquired from the camera (front and back) as well as images from the gallery (I'm using the UIImagePicker - for both image capture by camera and image selection from the gallery - not using avfoundation

CIImage memory not released

橙三吉。 提交于 2019-12-08 07:16:32
问题 I am trying to take a sequence of images, blend X images at the time and produce a new image. This is the code I have to accomplish this: static func blendImages(blendFrames: Int, blendMode: CIImage.BlendMode, imagePaths: [URL], completion: @escaping (_ progress: Double) -> Void) { var currentIndex = 0 while currentIndex + blendFrames < imagePaths.count { let currentSubset = Array(imagePaths[currentIndex..<(currentIndex + blendFrames)]) var currentSubsetIndex = 0 var firstImage: CIImage?

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