因此,我正在使用 CvVideo 相机:
- (void)viewDidLoad
{
[super viewDidLoad];
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
self.videoCamera.delegate = self;
self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionBack;
self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPresetiFrame960x540;
self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
self.videoCamera.defaultFPS = 30;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.videoCamera start];
}
我的故事板如下所示:
当视图加载时,该栏短暂可见,而视图的其余部分为白色。然后当相机启动时,它会填满整个屏幕。为什么要这样做?