[英]CIDetector: CIFaceFeature with always zero bounds
I have no idea why CIFaceFeature I get always returns zero Rectangle: 我不知道为什么我得到的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);
}
According to amount of NSLogs it seems CIDetector.featuresInImage works. 根据NSLogs的数量,似乎CIDetector.featuresInImage起作用。
You should use println
to log the info. 您应该使用
println
记录信息。 Or you can use the following, 或者您可以使用以下内容,
NSLog("%@ face", face.bounds.origin.x.description)
A few questions the might inform an answer: 一些问题可能会为您提供答案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.