How do i add this 'Scanned Effect' on my CIImage Swift - ios

The first image is the image using my phone. The one under it is the Photoshopped version of the first one. I adjusted some levels on that image. Any idea how I can do this in Swift?

Welcome!
Since iOS 13, Core Image provides a new CIDocumentEnhancer filter that basically does what Notes does when scanning a document.
If you want more control, you can probably also use a simple CIColorControls filter for adjusting contrast and brightness.

Related

replacing an existing color by a new one in an image with iOS

Let's say I have an image with a few colors.
I would like to replace programmatically a specific existing color by a new one.
(something simple, no need to support gradients, like I saw elsewhere).
E.g. I have an image showing a green circle and I want to display it as a red circle (every pixel initially defined with a given (R,G,B) is now displayed with a new (R,G,B).
Any idea of how to do that with the Apple ios SDK ? (or open source ...)
And btw what would be the best image file format to make this easier (png, jpg ....) ?
Thanks !
You should be able to do this using Core Image filters. the Color Cube CI filter lets you map a source color range to destination colors. You should be able to define a source color range and map it to different colors.
That's one CI Filter I didn't figure out how to use however. If you do a search on "Color Cube" in the Xcode help system there is sample code that does a "chromakey" effect that knocks out green shades to transparent. You should be able to adapt that to your needs.
I have a project on Github called CIFilterTest that shows how to use Core Image filters to process images. It's written as a general-purpose system that lets you try a wide variety of filters that use a standard set of parameters (points, colors, 1 or 2 source images, and floating-point values.) I never did take the time to generate the 3D color mapping "cube" that the color cube filter needs as input, so it doesn't allow you to use that particular filter. You'll have to look at the color Cube sample code in the Xcode docs to generate inputs for the Color Cube filter, but my sample app should help a great deal with the basic setup for doing CI based image processing.
answered similar question here:
Replace particular color of image in iOS
in short: I would suggest using CoreImage filter.

iOS, Objective C auto image processing filters

I'm doing a photo app and sometimes the lighting is off in certain areas and the picture isn't clear. I was wondering if there was a feature that can auto adjust the brightness, contrast, exposure, saturation of a picture like in photoshop.
I don't want to manually adjust images like the sample code given by apple:
https://developer.apple.com/library/ios/samplecode/GLImageProcessing/Introduction/Intro.html
I want something that will auto adjust or correct the photo
As an alternative you could use AVFoundation to make your implementation of the camera and set the ImageQuality to high and the autofocus or tap to focus feature. Otherwise, I am almost certain you cannot set this properties, The UIImagePicker controller included in the SDK is really expensive memory wise and gives you an image instead of raw data (another benefit of using AVFoundation). This is a good tutorial for this in case you would like to check it out:
http://www.musicalgeometry.com/?p=1297
Apparently someone has created it on Github: https://github.com/proth/UIImage-PRAutoAdjust
Once imported, I used it the following:
self.imageView.image = [self.imageView.image autoAdjustImage];

iOS Sdk: UIImage Hue Cycle

I'm new to developing and I am trying to figure out how I could create a simple method to change an image HUE cyclically and programmatically. A sort of image effect that scan all the frequencies of the color spectrum, like this one, for example. I know I could create a set of images to animate this, but that would require memory space I don't want to waste. I know there is a way to create a loop cycle that allows me to scan all the colors of an image.
Thank you in advance for help.
The CIHueAdjust CoreImage filter is available on iOS 5 and later. It should do what you want.

How to replicate CIDarkenBlendMode on iOS5

Does anyone know how to replicate CIDarkenBlendMode (Core Image filter) on iOS? I need to simulate an old paper by combining two images ...
Why do you need to replicate CIDarkenBlendMode? It's a supported filter in Core Image as of iOS 5.0, so you can use it directly.
If you don't want to use Core Image for this, my GPUImage framework also has a darken blend mode in its GPUImageDarkenBlendFilter.

Invert all colors from within the application

Is it possible to replicate the white on black feature that the iphone has from within an application.
I am trying to set up a toggle and when turned on the application will invert all of it's colors. Essentially creating a 'night time mode'
You could use Core Image. There is a filter called CIColorInvert which inverts the colors in an image. You can find out more about Core Image filters here.
If you want some help with Core Image, you could check out this tutorial by Ray Wenderlich: Beginning Core Image in iOS 5 Tutorial
Hope this helps!

Resources