所以CIFilter
需要一张 RAW DNG 图像。有没有办法可以将图像输出为RAW?
我正在尝试混合以 as 加载的 RAW 图像CIFilter
,然后将它们作为 RAW 输出。这是缓冲区 RAW 值的简单插值。是的,我知道 RAW 照片没有像素。我只是想在这里使用底层的 BAYER 过滤器表示。有没有办法使用CIFilter
. 使用第三方库怎么样?
编辑:我正在尝试做的事情:
所以我正在尝试混合(类似于曝光堆叠)使用Bracketed Photo Capture 拍摄的多张图像。所以我有多张 RAW 照片的像素缓冲区,我试图将它们的像素值平均出来。
在此之前,我试图确认我的像素值是正确的。所以我拍了一张红色绿色或蓝色纸的照片,这样它都是一种纯色(ish),然后我尝试查看像素缓冲区值是否符合我的预期。iPhone 具有RGGB 拜耳布局,因此我希望非常纯正的红色图片具有以下布局:
Col0 Col1 Col3 Col4...
Row 0: [HIGH LOW HIGH LOW ....]
Row 1: [LOW LOW LOW LOW ....]
Row 2: [HIGH LOW LOW LOW ....]
我有以下代码:
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
guard error == nil else { print("Error capturing photo: \(error!)"); return }
guard let pixelBuffer = photo.pixelBuffer else {return}
guard let baseAddress = CVPixelBufferGetBaseAddress(pixelBuffer) else {return}
let bufferHeight = Int(CVPixelBufferGetHeight(pixelBuffer))
let uint16Buffer = baseAddress.assumingMemoryBound(to: UInt16.self)
for row in 0..<bufferHeight {
let col0 = uint16Buffer[row*bufferWidth + 0]
let col1 = uint16Buffer[row*bufferWidth + 1]
let col2 = uint16Buffer[row*bufferWidth + 2]
let col3 = uint16Buffer[row*bufferWidth + 3]
print(col0, col1, col2, col3) // See pixel values
if (row > 3) {break} // don't print more than 4 rows for debugging
}
}