相关疑难解决方法(0)

使用AVCaptureSession sessionPreset = AVCaptureSessionPresetPhoto拉伸捕获的照片

重要提示:如果我使用: session.sessionPreset = AVCaptureSessionPresetHigh;我的预览图像没有拉伸!! 如果我将照片保存到设备中,UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);则图像正常,只有在预览中才会拉伸.

我正在使用AVFoundation捕捉照片.

session = [[AVCaptureSession alloc] init];
session.sessionPreset = AVCaptureSessionPresetHigh;

CALayer *viewLayer = vImagePreview.layer;
NSLog(@"viewLayer = %@", viewLayer);

AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];

captureVideoPreviewLayer.frame = vImagePreview.bounds;
[vImagePreview.layer addSublayer:captureVideoPreviewLayer];

AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
if (!input) {
    // Handle the error appropriately.
    NSLog(@"ERROR: trying to open camera: %@", error);
}
[session addInput:input];

stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
NSDictionary *outputSettings = …
Run Code Online (Sandbox Code Playgroud)

avfoundation ios avcapturesession

7
推荐指数
1
解决办法
8983
查看次数

AVCam不是全屏

我在我的iOS应用程序中集成了AVCam.问题是在iPhone 4预览框架不是全屏,它有空边框...

我怎么解决这个问题?

谢谢.

border fullscreen ios avcam

7
推荐指数
1
解决办法
1903
查看次数

标签 统计

ios ×2

avcam ×1

avcapturesession ×1

avfoundation ×1

border ×1

fullscreen ×1