Showcases different approaches to scan data matrix code from a metal surface. The project hoighlights scanning using three different techniques:
- AVCaptureMetadataOutput()
- Vision
- Vision + Pre Processor which converts the CoreVideoImageBuffer (CVImageBuffer) to GrayScale
private func preprocessImagePipeLine1(_ ciImage: CIImage?) -> CIImage? {
guard let ciImage else { return nil }
let filter = CIFilter(name: "CIColorControls")
filter?.setValue(ciImage, forKey: kCIInputImageKey)
filter?.setValue(0.0, forKey: kCIInputBrightnessKey)
filter?.setValue(0.0, forKey: kCIInputSaturationKey)
filter?.setValue(1.1, forKey: kCIInputContrastKey)
guard let intermediateImage = filter?.outputImage else { return nil }
let filter1 = CIFilter(name:"CIExposureAdjust")
filter1?.setValue(intermediateImage, forKey: kCIInputImageKey)
filter1?.setValue(0.7, forKey: kCIInputEVKey)
return filter1?.outputImage
}