码迷,mamicode.com
首页 > 移动开发 > 详细

iOS人脸识别核心代码(备用)

时间:2015-10-12 20:41:54      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:

for (int i = 0; i < 1; i++) { //< [arr count]; i++) {

                CIFaceFeature *feature = [arr objectAtIndex:i];

                double xPosition = (feature.leftEyePosition.x + feature.rightEyePosition.x+feature.mouthPosition.x)/(3*image.size.width) ;

                double yPosition = (feature.leftEyePosition.y + feature.rightEyePosition.y+feature.mouthPosition.y)/(3*image.size.height);

                

                double dist = sqrt(pow((feature.leftEyePosition.x - feature.rightEyePosition.x),2)+pow((feature.leftEyePosition.y - feature.rightEyePosition.y),2))/image.size.width;

                

                yPosition += dist;

                CGSize size = [[CCDirector sharedDirector] winSize];

                pumpkin.opacity = 255;

                pumpkin.scale = 5*(size.width*dist)/256.0;

                

                //int randomPumpkin = ((arc4random() % 10) + 5);

                [pumpkin setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSStringstringWithFormat:@"pumpkin%d.png", pumpkin_count + 4]]];

                CCMoveTo *moveAction = [CCMoveTo actionWithDuration:0 position:ccp((size.width * (xPosition)), (size.height * ((yPosition))))];

                [pumpkin runAction:moveAction];

            }

 

iOS人脸识别核心代码(备用)

标签:

原文地址:http://www.cnblogs.com/isItOk/p/4872515.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!