Image 人脸检测后如何旋转图像?网间网操作系统

Image 人脸检测后如何旋转图像?网间网操作系统,image,ios7,detection,Image,Ios7,Detection,我尝试了旋转图像和视图,仅旋转视图或仅旋转图像,但我没有得到我需要的视图。我只需要在屏幕顶部有面的图像,我可以旋转窗口,但我不在AppDelegate中使用我的代码,也不想旋转其他元素,我的代码在这里,它旋转所有视图 -(void)markFaces:(UIImageView *)facePicture { // draw a CI image with the previously loaded face detection picture CIImage* image = [CIImage

我尝试了旋转图像和视图,仅旋转视图或仅旋转图像,但我没有得到我需要的视图。我只需要在屏幕顶部有面的图像,我可以旋转窗口,但我不在AppDelegate中使用我的代码,也不想旋转其他元素,我的代码在这里,它旋转所有视图

 -(void)markFaces:(UIImageView *)facePicture
{
// draw a CI image with the previously loaded face detection picture
CIImage* image = [CIImage imageWithCGImage:facePicture.image.CGImage];

// create a face detector - since speed is not an issue we'll use a high accuracy
// detector
CIDetector* detector = [CIDetector detectorOfType:CIDetectorTypeFace
                                          context:nil options:[NSDictionary dictionaryWithObject:CIDetectorAccuracyHigh forKey:CIDetectorAccuracy]];

// create an array containing all the detected faces from the detector
NSArray* features = [detector featuresInImage:image];

// we'll iterate through every detected face.  CIFaceFeature provides us
// with the width for the entire face, and the coordinates of each eye
// and the mouth if detected.  Also provided are BOOL's for the eye's and
// mouth so we can check if they already exist.
for(CIFaceFeature* faceFeature in features)
{
    // get the width of the face
    CGFloat faceWidth = faceFeature.bounds.size.width;

    // create a UIView using the bounds of the face
    UIView* faceView = [[UIView alloc] initWithFrame:faceFeature.bounds];

    // add a border around the newly created UIView
    faceView.layer.borderWidth = 1;
    faceView.layer.borderColor = [[UIColor redColor] CGColor];
    faceView.backgroundColor = [UIColor blackColor];
    // add the new view to create a box around the face
    //[faceView setTransform:CGAffineTransformMakeScale(-1, -1)];

    [self.view addSubview:faceView];
    [self.view setTransform:CGAffineTransformMakeScale(-1, -1)]; // !!!!
}


-(void)faceDetector
{
// Load the picture for face detection
UIImageView* image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"test1.jpeg"]];
// Draw the face detection image
[self.view 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)];//!!
}