如何使用 CIRawFilter 加载带有 CoreImage 的 RAW 图像文件?

问题描述 投票:0回答:0

我正在尝试将相机中的 RAW 文件(在本例中为 DNG 格式)加载到

CIRawFilter
中,以便对其进行调整。但是,我无法将文件成功加载到 CI 过滤器中。我目前正在 Xcode playground 中尝试这个,所以也许这就是问题所在,但我使用的代码是:

import Cocoa
import Foundation
import CoreImage

// Returns "/var/folders/8_/b823wmf15sz1445g07z22nw00000gn/T/com.apple.dt.Xcode.pg/resources/4EB47089-747B-4F7D-89F2-EE815F5C2F1F/rawSource.DNG"
let rawSourcePath = Bundle.main.paths(forResourcesOfType: "DNG", inDirectory: nil)[0]
// rawFilter is nil
let rawFilter = CIRAWFilter(imageURL: URL(string: rawSourcePath))

rawSourcePath
似乎返回指向 playground
Resources
文件夹中文件的有效文件路径,但尝试用它初始化
rawFilter
只会导致
nil
值。有谁知道如何将RAW文件加载到
CIRawFilter
中?在我能找到的任何地方几乎没有关于它的示例文档。

ios swift macos cocoa core-image
© www.soinside.com 2019 - 2024. All rights reserved.