gpt4 book ai didi

ios - CIDetector : CIFaceFeature with always zero bounds

转载 作者:行者123 更新时间:2023-11-28 13:18:55 27 4
gpt4 key购买 nike

我不知道为什么我得到的 CIFaceFeature 总是返回零矩形:

import Cocoa
import QuartzCore

let url = NSURL(string:"http://cs620522.vk.me/v620522149/12b59/ijvZ6XJWrw0.jpg");
let ciimg:CIImage = CIImage(contentsOfURL:url);
let cid:CIDetector = CIDetector(ofType:CIDetectorTypeFace, context:nil, options:[CIDetectorAccuracy: CIDetectorAccuracyHigh]);
let results:NSArray = cid.featuresInImage(ciimg, options: NSDictionary());
for r in results {
let face:CIFaceFeature = r as CIFaceFeature;
NSLog("Face found at (%f,%f) of dimensions %fx%f", face.bounds.origin.x, face.bounds.origin.y, face.bounds.width, face.bounds.height);
}

enter image description here

根据 NSLog 的数量,CIDetector.featuresInImage 似乎有效。

最佳答案

您应该使用println 来记录信息。或者您可以使用以下内容,

NSLog("%@ face", face.bounds.origin.x.description)

关于ios - CIDetector : CIFaceFeature with always zero bounds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27363172/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com