【发布时间】:2015-01-27 18:37:48
【问题描述】:
我不知道为什么我得到的 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);
}
根据 NSLogs 的数量,CIDetector.featuresInImage 似乎有效。
【问题讨论】:
-
你能把你的代码作为实际文本而不是图像放在你的问题中吗?
-
@dpassage 非常感谢!
标签: ios swift core-image