AVLayerVideoGravityResizeAspectFill在哪里裁剪

时间:2012-11-30 10:53:04

标签: iphone ios camera

我正在使用AVCaptureSession AVCaptureVideoPreviewLayer AVLayerVideoGravityResizeAspectFill重力。

self.captureSession =[[AVCaptureSession alloc] init];
captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
[self.previewLayer setVideoGravity: AVLayerVideoGravityResizeAspectFill];

如何知道如何调整视频大小以适应AVLayerVideoGravityResizeAspectFill的预览区域?在预览区域中可以看到图像的哪一部分?

来自the doc

  

AVLayerVideoGravityResizeAspectFill:这会保留宽高比,但会填充可用的屏幕区域,必要时裁剪视频

基本上,如何准确获取previewLayer中显示的内容?

1 个答案:

答案 0 :(得分:1)

AVCaptureVideoPreviewLayer

中的iOS 6 SDK I can use the following
(CGPoint)captureDevicePointOfInterestForPoint:(CGPoint)pointInLayer