FAQ Database Discussion Community


Using CILanczosScaleTransform Core Image Filter to resize an image

ios,swift,core-image
I am trying to use the CILanczosScaleTransform Core Image Filter to resize an image, but I am running into problems. Here is my code: var imageView: UIImageView = UIImageView() var image: UIImage? imageView.frame = CGFrameMake(10,10,200,300) dispatch_async(dispatch_get_main_queue(), { let nsurl = NSURL(string:"http://...") var err: NSError? var getImageData = NSData(contentsOfURL: nsurl!, options:...

How could you stretch a face image to simulate added weight?

ios,uiimage,core-image,cifilter
I am attempting to simulate adding weight to a person's face by taking a still UIImage and applying some effect that widens the cheeks/jawline areas, without affecting the rest of the face. I have tried various approaches but haven't been successful. How could this be accomplished, without using an OpenGL...

Why iOS Core Image QR Code generator is not working?

ios,swift,core-image
I am trying to generate QR Code using iOS Core Image API: func createQRForString(#data : NSData)->CIImage!{ var qrFilter = CIFilter(name: "CIQRCodeGenerator") qrFilter.setValue(data, forKey: "inputMessage") qrFilter.setValue("H", forKey:"inputCorrectionLevel") return qrFilter.outputImage } func createNonInterpolatedImageFromCIImage(image : CIImage,withScale scale:CGFloat)->UIImage{ let cgImage = CIContext(options: nil).createCGImage(image, fromRect: image.extent())...

CIFilter output image nil

ios,swift,core-image,cifilter
I am using core image and I am applying a CIFilter sepia tone to my image. I run a filter once in viewDidLoad and then immediately call another function that adds the filter again. For some reason, when I try to access the output image, the app crashes and says...

passing video frame to Core Image on osx

osx,avfoundation,core-image
Hi all you awesome coders! I've put together this thing from various helpful sources over the last couple of weeks (including a lot of posts from stackoverflow), trying to create something that will take a webcam feed and detect smiles when they occur (might as well draw boxes around the...

Unexpected result of CISourceOverCompositing when alpha is involved

ios,alpha,core-image
When trying to place a image with 60% alpha channel over another image with 100% alpha channel on iOS using CoreImage I got a result I didn't expect. If I take the two images and place scene_2_480p over scene_480p like this: let back: CIImage = loadImage("scene_480p", type: "jpg"); let front:...

iOS app working without essential frameworks linked

ios,xcode,frameworks,core-graphics,core-image
i am working on an iOS app which is able to make videos out of single screenshots. I therefore need things like CVPixelBufferRef, CGContextRef and AVAssetWriter. Currently the app is working fine but there is one thing I do not understand: For example, CVPixelBufferRef is a reference to a Core...

How to achieve adaptive threshold filter with color

image-processing,gpuimage,core-image,imagefilter,adaptive-threshold
I'm looking for a algorithm similar adaptive thresholding, but that keeps color. I'm trying take an image like this: And make it look like this: If it matters, I'm working in ios....

Setting auto dimension on core-image causes it not to render

html,css,polymer,core-image,web-component
I have a core-image component in my page that I'm sizing to fit the width of the div it is within. <div class="content"> <core-image class="sized gray" sizing="contain" preload fade src="Koala.jpg"> </core-image> </div> Sizing this with absolute dimensions is fine, eg .sized { width: 200px; height: 200px; } However, sizing with...

Save image with the correct orientation - Swift & Core Image

ios,swift,uiimage,core-image,photo-gallery
I'm using Core Image in Swift for editing photos and I have a problem when I save the photo. I'm not saving it with correct orientation. When I get the picture from the Photo Library I'm saving the orientation in a variable as UIImageOrientation but I don't know how to...

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

ios,swift,core-image,ciimage
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...

Apply Core Image Filter to Video on OS X using Swift

swift,cocoa,avfoundation,core-image,core-video
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...

CIPerspectiveCorrection filter returns image flipped and inverted

ios,swift,core-image,cifilter
I'm using the CIPerspectiveCorrection Filter and my problem is that my returned image results are mirrored, upside down, and the points used for the perspective correction seem to be referencing the wrong axis, or axis direction. In order to isolate the issue I have been working with a test image...

NSView with masked CIFilter for OS X app

objective-c,calayer,nsview,core-image,cifilter
I am developing an app that contains lots of custom NSView objects being moved around. I have implemented a gaussian blur background filter for one of the custom NSView subclasses like so: - (id)init { self = [super init]; if (self) { ... CIFilter *saturationFilter = [CIFilter filterWithName:@"CIColorControls"]; [saturationFilter setDefaults];...

Background color for drawing CIImage

ios,core-image,glkit
I use some of CIFilters to do some image processing. I've found UIImageView too slow to display output image in real-time. I've followed documentation and built GLKView. Now the performance is perfect, but image is rendered in black rect when rotated. How to set that color to background (green in...

CITransform vs CATransforms which and when to use?

ios,core-graphics,core-animation,core-image
I need to draw an overlay over camera, which on every frame draws an arrow with a different direction. Now as I understand, because of processing every frame, I should be using the Core graphics drawing, but besides just drawing the arrow I need to give it a perspective effect...