Search code examples
objective-ciosfilterphotoimaging

Objective C unsharp mask filter Xcode


What would be the most efficient way to create an unsharp mask filter in Objective C targeting iOS? Would it be best to implement some open source like ImageMagick or build from scratch.

I think the basic formula is generally as follows (please comment if I have not gotten it right).

  1. Duplicate original
  2. Blur duplicate (Gaussian)
  3. blend with original via "difference"
  4. use result to mask original
  5. Increase contrast in the unmasked areas of the original.

Solution

  • Core Image has the CIUnsharpMask filter built-in, although I'm not sure if it's available on iOS yet. Brad Larson's GPUImage framework also has an unsharp mask filter.

    Both methods should be very fast and much easier to implement than cross-compiling ImageMagick or writing your own.