0

私はアプリに取り組んでおり、を使用して画像をキャプチャしていUIImagePickerControllerます。アプリケーションがのオブジェクトを起動するUIImagePickerControllerと、デフォルトの選択としてバックカメラがあります。すべてがバックカメラで正常に動作します。

ただし、カメラソースをfrontFacingCameraimagePickerのトグルカメラボタンからに変更して画像をキャプチャすると、鏡像が得られます。私の左腕は画像の右腕として表示されます。この問題を解決するにはどうすればよいですか?

  1. それで、この問題をで解決することは可能UIImagePickerControllerですか?
  2. そうでない場合、通常の画像を取得するために画像処理を行う方法はありますか?
  3. AVFoundationこの問題のクラスを学ぶことは必須ですか?
  4. はいの場合は3番目。このための良いチュートリアルに私をナビゲートしてください。

残念ながら、私は非常に弱いですAVFoundation

4

2 に答える 2

1

私は同じ問題を抱えていて、この方法を使用して画像を逆にミラーリングしました。

- (UIImage *) flipImageLeftRight:(UIImage *)originalImage {
    UIImageView *tempImageView = [[UIImageView alloc] initWithImage:originalImage];

    UIGraphicsBeginImageContext(tempImageView.frame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();

     //CGAffineTransformMake(<#CGFloat a#>, <#CGFloat b#>, <#CGFloat c#>, <#CGFloat d#>, <#CGFloat tx#>, <#CGFloat ty#>)
     CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0,  tempImageView.frame.size.height);
     CGContextConcatCTM(context, flipVertical);

     [tempImageView.layer renderInContext:context];

     UIImage *flipedImage = UIGraphicsGetImageFromCurrentImageContext();
     flipedImage = [UIImage imageWithCGImage:flipedImage.CGImage scale:1.0 orientation:UIImageOrientationDown];
     UIGraphicsEndImageContext();

     [tempImageView release];

     return flipedImage;
}
于 2012-10-18T08:27:12.470 に答える
0

以下のコードを試してください

- (UIImage *)PictureFlipe:(UIImage *)picture
{
    UIImage * flippedImage = [UIImage imageWithCGImage:picture.CGImage scale:picture.scale orientation:UIImageOrientationLeftMirrored];

    return flippedImage;
}
于 2014-05-14T23:52:51.543 に答える