I'd like to capture only the image within the video preview layer. Currently, I set it like this:
[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]];
As it stands, the preview layer represents what I want to be captured, but the camera captures whatever is outside those bounds as well. I can't take a picture and crop it afterwards because the image isn't orientation up, so CGImageRef
doesn't work. Is there anyway to capture just what's in the preview layer?