zoukankan      html  css  js  c++  java
  • iOS人脸识别核心代码(备用)

    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];

                }

  • 相关阅读:
    标准输入/输出通道
    不要在纠结负数的表示了
    Coursera公开课-Machine_learing:编程作业7
    Heap堆
    广义表的实现
    二叉树的实现
    模拟实现strstr和strrstr
    栈和队列常考面试题(二)
    栈和队列常考面试题(一)
    vector迭代器失效的几种情况
  • 原文地址:https://www.cnblogs.com/isItOk/p/4872515.html
Copyright © 2011-2022 走看看