Thank you for your reply.
In fact I noticed a color problem that occurs after correcting the orientation of the image (the captured image is in landscape format)...
The corrected image has slightly different colors from the uncorrected version.
Here is the code I use to correct the orientation:
let pixelBufferRef = frame.capturedImage
let resolution = frame.camera.imageResolution
var image = CIImage(cvPixelBuffer: pixelBufferRef)
let viewportSize = CGSize(width: resolution.height, height: resolution.width)
let transform = frame.displayTransform(for: .portraitUpsideDown, viewportSize: viewportSize)
image = image.transformed(by: transform)
let context = CIContext()
if let imageRef = context.createCGImage(image, from: image.extent) {
let png = context.pngRepresentation(of: image, format: .BGRA8, colorSpace: image.colorSpace!)
try? png?.write(to: documentsURL.appending(component: "captured-image-corrected.png"))
}
Did I miss something?
Topic:
Spatial Computing
SubTopic:
ARKit
Tags: