I want to make a effect that a colored normal image to a scanned image.
like 2 pictures below, first image is the original image, second image is the adjusted image, effects should like the second image, the text on back of the page should also disappear:
First image:
Second image:
I want to use CoreImage and CIFilter to do this. besides contrast and brightness. I think should adjust level like photoshop. but how can adjust that? or other method?
I have tried to adjust it in photoshop, it seems that use photoshop’s level function can reach this effect, the value shows on picture below:
but I don’t know how to do this use CIFilter or other methods? I don’t want to import third part framework or sources. because iOS 11 Notes APP can reach this effect, I think system’s methods and frameworks can do this.
2
Answers
I believe in order to manually implement Photoshop-like level adjustment feature, you’ll need to understand some of the core knowledge on the field of Image Processing.
You may want to read this
Core Image Programming Guide
as a starting point:Or, you may simply end up using a third party framework, though you have already stated that you don’t want to use 3rd party libraries. If this is the case, I would like to recommend
GPUImage2
, just in case:Finally, I found a similar question to this so you may want to take a look:
Good luck.
Try below code.
You can call the above func like below.
Output: (Output from real Device)
For more understanding about
Core Image Filter
try below links and answers.Get UIImage from function and Convert UIImage to grayscale keeping image quality
Core Image Filter Reference from Apple Doc: https://developer.apple.com/library/content/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html
Note: For more specific requirement you need to create your own custom filter. Following link may helps https://spin.atomicobject.com/2016/10/20/ios-image-filters-in-swift/