I tried binarizing the image captured the phone camera with the sample codes at:
https://developer.apple.com/documentation/coreimage/ciimageprocessorkernel
The result is an all white image. Help!
By the way, there is a typo in the page where a 'r' is missing in 'ThresholdImageProcessorKernel' in the following line...
let result = try? ThesholdImageProcessorKernel.apply...
which should be:
let result = try? ThresholdImageProcessorKernel.apply...