Skip to content

Bilateral filter, implemented as a CoreImage kernel (CIKernel)

License

Notifications You must be signed in to change notification settings

notjosh/NTJBilateralCIFilter

Repository files navigation

NTJBilateralCIFilter

Ever wanted to play with bilateral filtering inside of Core Image? Well you've come to the right place.

Inside you'll find a basic toolkit for switching images, and tinkering around with parameters:

It's almost certainly not the fastest/best implementation out there, but for small images (< 1000px square, give or take) it's capable of running in real time.

Library Usage

Inside of the project is the class NTJBilateralCIFilter. It extends CIFilter, so feel free to use it in other projects like you would any other CIFilter. Or take a look at NTJBilateralFilterRunner in the demo app for some ideas on how to load content in.

If you're manually including the code into your project, make sure to also bring NTJBilateralCIFilter.cikernel into your project.

The three parameters are:

  • inputImage: A CIImage to filter
  • sigma_R: The range of blur. Higher value = more blur. (Default value: 15)
  • sigma_S: The spatial parameter. Higher value = more features getting flattened. (Default value: 0.2)

TODO

  • Make it work properly on iOS. The image gets darker instead of blurring, perhaps a different shader language somehow? Or CoreImage works differently? Not sure.

About

Bilateral filter, implemented as a CoreImage kernel (CIKernel)

Resources

License

Stars

Watchers

Forks

Packages

No packages published