core-image

Using GPUImage to Recreate iOS 7 Glass Effect

杀马特。学长 韩版系。学妹 提交于 2019-11-27 10:11:13
问题 I am trying to use the iOS 7 style glass effect in my glass by applying image effects to a screenshot of a MKMapView . This UIImage category, provided by Apple, is what I am using as a baseline. This method desaturates the source image, applies a tint color, and blurs heavily using the input vals: [image applyBlurWithRadius:10.0 tintColor:[UIColor colorWithRed:229/255.0f green:246/255.0f blue:255/255.0f alpha:0.33] saturationDeltaFactor:0.66 maskImage:nil]; This produces the effect I am

How to merge the perspective image(3D Transform)?

天大地大妈咪最大 提交于 2019-11-27 08:48:33
问题 How to merge these two images(see attached image).I am using the below code. Its working for ordinary images not for 3D transform images. How to handle this issue. I have searched lot of times still not getting the proper result. Please help me. Thanks in advance. UIImage *mergedImage; UIGraphicsBeginImageContext(backgroundImageView.frame.size); [backgroundImageView.layer renderInContext:UIGraphicsGetCurrentContext()]; //bacgroundImageView here mergedImage =

CIImage display MTKView vs GLKView performance

喜你入骨 提交于 2019-11-27 07:03:41
问题 I have a series of UIImages (made from incoming jpeg Data from server) that I wish to render using MTKView. Problem is it is too slow compared to GLKView. There is lot of buffering and delay when I have a series of images to display in MTKView but no delay in GLKView. Here is MTKView display code: private lazy var context: CIContext = { return CIContext(mtlDevice: self.device!, options: [CIContextOption.workingColorSpace : NSNull()]) }() var ciImg: CIImage? { didSet { syncQueue.sync {

CIGaussianBlur and CIAffineClamp on iOS 6

风流意气都作罢 提交于 2019-11-27 05:59:43
问题 I am trying to blur an image using CoreImage on iOS 6 without having a noticeable black border. Apple documentation states that using a CIAffineClamp filter can achieve this but I'm not able to get an output image from the filter. Here's what I tried, but unfortunately an empty image is created when I access the [clampFilter outputImage]. If I only perform the blur an image is produced, but with the dark inset border. CIImage *inputImage = [[CIImage alloc] initWithCGImage:self.CGImage];

Correct crop of CIGaussianBlur

微笑、不失礼 提交于 2019-11-27 05:13:41
问题 As I noticed when CIGaussianBlur is applied to image, image's corners gets blurred so that it looks like being smaller than original. So I figured out that I need to crop it correctly to avoid having transparent edges of image. But how to calculate how much I need to crop in dependence of blur amount? Example: Original image: Image with 50 inputRadius of CIGaussianBlur (blue color is background of everything): 回答1: Take the following code as an example... CIContext *context = [CIContext

How to apply a Vignette CIFilter to a live camera feed in iOS?

喜你入骨 提交于 2019-11-26 23:09:44
While trying to apply a simple vignette filter to the raw camera feed of an iPhone6, with the help of Metal and Core Image, I see a lot of lag between the frames being processed and rendered in an MTKView The approach which I have followed is (MetalViewController.swift): Get raw camera output using AVCaptureVideoDataOutputSampleBufferDelegate Convert CMSampleBuffer > CVPixelBuffer > CGImage Create an MTLTexture with this CGImage . Point no. 2 and 3 are inside the method named: fillMTLTextureToStoreTheImageData Apply a CIFilter to the CIImage fetched from the MTLTexture in the MTKViewDelegate

How can I generate a barcode from a string in Swift?

依然范特西╮ 提交于 2019-11-26 22:36:56
问题 I am a new iOS developer. I was wondering how can I generate a barcode in Swift. I have the code already, there are multiple resources from where to learn how to read a barcode, but I didn't find any that talks about generating one from a string. Thanks a lot! P.S. I know there is a similar question about this, but it's for Objective-C. I don't know Obj-C and I find it difficult coming from .NET. 回答1: You could use a CoreImage ( import CoreImage ) filter to do that! class Barcode { class func

Why can't I invert my image back to original with CIFilter in my Swift iOS app

旧街凉风 提交于 2019-11-26 18:42:16
问题 I'm working on a simple app. It has an image view with pre-loaded image and a button. When pressed the button should invert the image in the image view. It works the first time, but I expect it to invert the image back to its original form when I press the button again. However it crashes on this second press of the button. Here is the relevant code from ViewController.swift : @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var invertButton: UIButton! @IBAction func

How can I convert an UIImage to grayscale in Swift using CIFilter?

和自甴很熟 提交于 2019-11-26 16:48:11
问题 I am building a scanner component for an iOS app so far I have the result image cropped and in the correct perspective. Now I need to turn the color image into Black and white "Scanned" document. I tried to use - "CIPhotoEffectNoir" but it more grayscale then totally black and white. I wish to get a full contrast image with 100% black and 100% white. How can I achieve that? Thanks 回答1: You can use CIColorControls and set Contrast Key kCIInputContrastKey to increase the black/white contrast as

What is the best Core Image filter to produce black and white effects?

家住魔仙堡 提交于 2019-11-26 10:22:11
问题 I am using Core Image and would like to produce a black and white effect on the chosen image. Ideally I would like to have access to the same sort of options that are available on Photoshop i.e. Reds, Cyan, Greens, Blues and Magenta. The goal being to create different types of the black and white effect. Does anyone know what filter would be best to manipulate these sort of options? If not does anyone know of a good approach to creating the black and white effect using other filters? Thanks