我只想捕获视频预览层中的图像。目前,我这样设置:
[self setCaptureManager:[[[CaptureSessionManager alloc] init] autorelease]];
[[self captureManager] addVideoInputFrontCamera:YES]; // set to YES for Front Camera, No for Back camera
[[self captureManager] addStillImageOutput];
[[self captureManager] addVideoPreviewLayer];
CGRect layerRect = [[[self view] layer] bounds];
[[[self captureManager] previewLayer] setBounds:CGRectMake(0, 0, 320, 400)];//was layerRect
[[[self captureManager] previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect),CGRectGetMidY(layerRect))];// was CGPointMake(CGRectGetMidX(layerRect),CGRectGetMidY(layerRect))
[[[self view] layer] addSublayer:[[self captureManager] previewLayer]];
就目前而言,预览层代表了我想要捕捉的内容,但相机也捕捉到了超出这些范围的任何内容。我无法拍照并事后裁剪它,因为图像没有朝上,所以CGImageRef
不起作用。无论如何要捕获预览层中的内容吗?