2012-10-05 4 views
0

이 코드로 IOS 5IOS 6 얼굴 인식 작동하지 않음

CIImage *cIImage = [CIImage imageWithCGImage:image.CGImage]; 
      CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]]; 
      NSArray *features = nil; 
      features = [detector featuresInImage:cIImage]; 
      if ([features count] == 0) 
      { 
       NSDictionary* imageOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:6] forKey:CIDetectorImageOrientation]; 
       features = [detector featuresInImage:cIImage options:imageOptions]; 
      } 

의 얼굴을 검출하기 위해 다음 코드를 사용하고, 나는 IOS 5에서 얼굴을 감지 할 수 있어요,하지만 최근에 우리는 우리를 업그레이드 한 엑스 코드 4.4 IOS 6 시스템은, 이제, 얼굴 인식 기능은 제대로 작동하지 않습니다 내가 IOS에서 얼굴을 검출 할 필요가 어떤 변화

6. 도움말 Anykind 높게 평가되어

+0

, 확인합니다 샘플 code..i을 보내 그것 – Rajneesh071

+0

난 내 프로젝트에 – iYahoo

+0

당신이 문제의 샘플을 만들 수 있습니다 그것을 보내려면 어려운 코드를 구현했습니다 .... – Rajneesh071

답변

0

내가

CoreImage.framework

-(void)faceDetector 

{ 

// Load the picture for face detection 

UIImageView* image = [[UIImageView alloc] initWithImage: 

[UIImage imageNamed:@"facedetectionpic.jpg"]]; 

// Draw the face detection image 

[self.window addSubview:image]; 

// Execute the method used to markFaces in background 

[self markFaces:image]; 

} 


-(void)faceDetector 

{ 

// Load the picture for face detection 

    UIImageView* image = [[UIImageView alloc] initWithImage:[UIImage 
imageNamed:@"facedetectionpic.jpg"]]; 


    // Draw the face detection image 
    [self.window addSubview:image]; 

    // Execute the method used to markFaces in background 
    [self performSelectorInBackground:@selector(markFaces:) withObject:image]; 

    // flip image on y-axis to match coordinate system used by core image 
    [image setTransform:CGAffineTransformMakeScale(1, -1)]; 

    // flip the entire window to make everything right side up 
    [self.window setTransform:CGAffineTransformMakeScale(1, -1)]; 


} 

를 추가하고이 두 링크를 확인 ... U이 도움이 희망도

http://maniacdev.com/2011/11/ 가이드 쉬운 얼굴 검출-가진 코어 - 이미지 인 IOS-5/

http://i.ndigo.com.br/2012/01/ios-facial-recognition/

1

나는 iOS6에서의 얼굴 탐지가 iOS5에서만큼 좋지 않다는 것을 알아 챘다. 이미지를 선택하여 시도해보십시오. iOS6에서는 이미지가 많지만 전부는 아니지만 OK 일 것입니다.

다음과 같은 이미지 세트를 테스트했습니다 : 1. iOS6을 실행하는 에뮬레이터. 2. iPhone 5 (iOS6) 3. iPhone 3GS (iOS5).

3GS는 다른 두 가지 옵션보다 더 많은 얼굴을 감지합니다. 여기

는 iOS6의에 그냥뿐만 아니라 그것을 모두에서 작동, 코드,하지만 :

- (void)analyseFaces:(UIImage *)facePicture { 
// Create CI image of the face picture 
CIImage* image = [CIImage imageWithCGImage:facePicture.CGImage]; 

// Create face detector with high accuracy 
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace 
              context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]]; 

// Create array of detected faces 
NSArray* features = [detector featuresInImage:image]; 

// Read through the faces and add each face image to facesFound mutable 
for(CIFaceFeature* faceFeature in features) 
{ 
    CGSize parentSize = facePicture.size; 

    CGRect origRect = faceFeature.bounds; 
    CGRect flipRect = origRect; 
    flipRect.origin.y = parentSize.height - (origRect.origin.y + origRect.size.height); 

    CGImageRef imageRef = CGImageCreateWithImageInRect([facePicture CGImage], flipRect); 
    UIImage *faceImage = [UIImage imageWithCGImage:imageRef]; 
    CGImageRelease(imageRef); 

    if (faceImage) 
     [facesFound addObject:faceImage]; 
} 

}

내가이 문제가 일어날 것이라고 생각하지 말아