美文网首页相机相关
相机相关备注

相机相关备注

作者: _风雨 | 来源:发表于2017-02-28 12:36 被阅读3次

    获取 AVCaptureSession

    在获取

    - (AVCaptureDevice*)backCamera

    {

    NSArray*devices = [AVCaptureDevicedevicesWithMediaType:AVMediaTypeVideo];

    for(AVCaptureDevice*deviceindevices) {

    if(device.position==AVCaptureDevicePositionBack) {

    returndevice;

    }

    }

    returnnil;

    }

    [_avSessionbeginConfiguration];

    _avSession.sessionPreset=AVCaptureSessionPreset640x480;

    //通过capture对象创建输入设备对象

    NSError*error =nil;

    _backCameraDevice= [selfbackCamera];

    [_backCameraDevicelockForConfiguration:&error];

    //_backCameraDevice.focusMode = AVCaptureFocusModeLocked;

    [_backCameraDeviceunlockForConfiguration];

    [_avSessioncommitConfiguration];

    [_backCameraDevice setFocusModeLockedWithLensPosition:slider.value completionHandler:nil]; 此方法是设置对焦,position为0到1;

    [_backCameraDevicelockForConfiguration:&error];

    _backCameraDevice.videoZoomFactor= sender.value; 此方法可以实现镜头放大缩小,最小为1.0

    [_backCameraDeviceunlockForConfiguration];

    相关文章

      网友评论

        本文标题:相机相关备注

        本文链接:https://www.haomeiwen.com/subject/qfiiittx.html