ios: Adding real time filter effects to photos

后端 未结 2 1432
时光说笑
时光说笑 2021-01-07 05:04

I want to program an ios app that takes photos but I would like to filter the photo preview in real time. What I mean is implemented in the app called \"CamWow\" (here is a

相关标签:
2条回答
  • 2021-01-07 05:46

    I'm looking for the same kind of info (its a pretty hot sector so some devs may not be willing to give up the goods just yet). I came across this, which may not be exactly what you want, but could be close. Its a step by step tutorial to process live video feed.

    Edit: I've tried the code that was provided in that link. It can be used to provide filters in real time. I modified the captureOutput method in ViewController.m , commented out the second filtering step ("CIMinimumCompositing") and inserted my own filter (I used "CIColorMonochrome").

    It worked. My first few attempts failed because not all filters in Core Image Filter reference are available for iOS apparently. There is some more documentation here.

    Not sure if this code is the best performance wise, but it does work.

    Edit #2: I saw some other answers on SOverflow that recommended using OpenGL for processing which this sample code does not do. OpenGL should be faster.

    0 讨论(0)
  • 2021-01-07 05:59

    As Fraggle points out, on iOS 5.0, you can use the Core Image framework to do image filtering. However, Core Image is limited to the filters they ship with the framework, and I've found that it is not able to process video in realtime in many cases.

    As a result, I created my BSD-licensed open source GPUImage framework, which encapsulates the OpenGL ES 2.0 code you need to do GPU-accelerated processing of images and video. I have some examples of the kind of filtering you can do with this in this answer, and you can easily write your own custom filters using the OpenGL Shading Language. The sample applications in the framework show how to do filtering of images with live previews, as well as how to filter and save them out to disk.

    0 讨论(0)
提交回复
热议问题