IS CORE Image Cipersonsegentation Filter сбой в контексте. CreateCgimage с Exc_BAD_ACCESSIOS

Программируем под IOS
Anonymous
IS CORE Image Cipersonsegentation Filter сбой в контексте. CreateCgimage с Exc_BAD_ACCESS

Сообщение Anonymous »

У меня есть простой код для Cipersonsementation

Код: Выделить всё

if let image = UIImage(named: "demo9"), let editted = applyPersonFilter(to: image) {
imageView.image = editted
}

func applyPersonFilter(to image: UIImage) -> UIImage? {
guard let ciImage = CIImage(image: image) else { return nil }

let context = CIContext(options: nil)

let filter = CIFilter(name: "CIPersonSegmentation", parameters: [
kCIInputImageKey: ciImage,
"inputQualityLevel": 1.0
])

guard let outputImage = filter?.outputImage else {
return nil
}

print("outputImage: \(outputImage.extent)")

guard let cgImage = context.createCGImage(outputImage, from: outputImage.extent) else { return nil }

return UIImage(cgImage: cgImage)
}
Это просто сбои в CreateCgimage с:

Код: Выделить всё

Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)


ПРИМЕЧАНИЕ, что Печать перед контекстом. 384.0) .
Если я заменяю "циперссование" с некоторым другим именем фильтра, то он работает нормально.

Подробнее здесь: https://stackoverflow.com/questions/794 ... image-with

Вернуться в «IOS»