Filmroom, an image process playground
Swift 4 + iOS 11 or macOS 10.13
Mainly working on iOS
iOS Part include
- Image adjustment
- Exposure
- Shadow & highlight
- Saturation
- Contrast
- HSL for Orange
- Real-Time Rendering via MTKView
- ★★★ The implementation of Low Light Enhancement Algorithm - LIME ★★★
macOS parts included
- Gamma Correction
- Gaussian Blur
- Transforms between NSImage, CIImage and CGImage.
- Real-Time Rendering via MTKView
Rendering Features
- Real-Time Rendering via MTKView
- Adapted aspect radio
- Lower CPU cost because fewer data type conversion
- This way is much more faster than DispatchQueue method.
- It decreases the CPU usage because of taking use of argument Buffer of Metal . (macOS only)
Computation Kernels
These algorithms are written in computation kernels (of Metal API):
- 2D FFT in Apple Metal by a Iterative Way
- 1st: Rearrangement of element (shader is here)
- 2nd: Calculate FFT from beginning to final stage. (shader of early stage, shader of full stage)
- 3rd: Complex to modulus.
- Illumination Map in mean way
- Shrinkage
- Gradient
- Low Light Enhancement Algorithm - LIME
Computational Kernel can be found both in macOS project and iOS project. These two kernels are not identical, please focus on iOS one.
Core Image kernels
Core Image kernels locate in CustomKernel functions from CustomFilter.swift, you can also find them in Kernels.cikernel for Core Image Kernel with comments under the iOS directory.
Test
You can test these filters by images supported by Core Image. Output is available.
Note: FFT algorithm only support image size like 1024x1024 or 4096x4096.
FFT Result
Case 1:
Low-Light Image Enhancement (LIME)
Reference of LIME
Guo, X., Li, Y., & Ling, H. (2017). LIME: Low-Light Image Enhancement via Illumination Map Estimation. IEEE TRANSACTIONS ON IMAGE PROCESSING, 26(2), 982–993.