【发布时间】:2014-03-18 16:39:06
【问题描述】:
我可以把脸倒过来或正常吗?我已经完成了人脸检测的代码,
如下:
// turn on/off face detection
- (IBAction)toggleFaceDetection:(id)sender
{
detectFaces = [(UISwitch *)sender isOn];
[[videoDataOutput connectionWithMediaType:AVMediaTypeVideo] setEnabled:detectFaces];
if (!detectFaces) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
// clear out any squares currently displaying.
[self drawFaceBoxesForFeatures:[NSArray array] forVideoBox:CGRectZero orientation:UIDeviceOrientationPortrait];
});
}
}
附苹果示例代码:https://developer.apple.com/library/ios/samplecode/SquareCam/Introduction/Intro.html
我能知道脸是倒立的还是正常的?
我已经尝试得到左眼位置和右眼位置,嘴巴位置,但是当脸倒置时,位置返回不正确。
midPoint 是两只眼睛之间的中点。 当脸朝上时 位置记录
leftEyePoistion -------------------{160, 199}
rightEyePosition ------------------{270, 262}
midPoint----------------------------------- {215, 230.5}
mouthEyePostion ---------------------------- {297, 112}
当脸倒置时 位置记录
leftEyePoistion -------------------{192, 200}
rightEyePosition ------------------{274, 270}
midPoint----------------------------------- {233, 235}
mouthEyePostion ---------------------------- {288, 159}
所以我认为这个位置不适合我来确定面部是否朝上。
【问题讨论】:
标签: ios