Demo entry 6354421

oc

   

Submitted by anonymous on Apr 06, 2017 at 18:58
Language: Objective-C. Code size: 2.3 kB.

if(faceFeature.hasLeftEyePosition) {
            UIView* leftEyeView = [[UIView alloc] initWithFrame:
                                   CGRectMake(faceFeature.leftEyePosition.x-faceWidth*0.15,
                                              faceFeature.leftEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
            [leftEyeView setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
            
            CGPoint position =  faceFeature.leftEyePosition;
            position.y = detectImage.size.height -  position.y;
            
            [leftEyeView setCenter: [self convertToShowPoint:position forImage:detectImage]];
            leftEyeView.layer.cornerRadius = faceWidth*0.15;
            [self.photoView  addSubview:leftEyeView];
        }
        
        if(faceFeature.hasRightEyePosition) {
            UIView* leftEye = [[UIView alloc] initWithFrame:
                               CGRectMake(faceFeature.rightEyePosition.x-faceWidth*0.15,
                                          faceFeature.rightEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
            [leftEye setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
            CGPoint position =  faceFeature.rightEyePosition;
            position.y = detectImage.size.height -  position.y;

            [leftEye setCenter: [self convertToShowPoint:position forImage:detectImage]];
            leftEye.layer.cornerRadius = faceWidth*0.15;
            [self.photoView  addSubview:leftEye];
        }
        
        if(faceFeature.hasMouthPosition) {
            UIView* mouth = [[UIView alloc] initWithFrame:
                             CGRectMake(faceFeature.mouthPosition.x-faceWidth*0.2,
                                        faceFeature.mouthPosition.y-faceWidth*0.2, faceWidth*0.4, faceWidth*0.4)];
            [mouth setBackgroundColor:[[UIColor greenColor] colorWithAlphaComponent:0.3]];
            CGPoint position =  faceFeature.mouthPosition;
            position.y = detectImage.size.height -  position.y;

            [mouth setCenter:[self convertToShowPoint:position forImage:detectImage]];
            mouth.layer.cornerRadius = faceWidth*0.2;
            [self.photoView  addSubview:mouth];
        }

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).