4

Using the code below (in viewDidLoad), when I first segue from another view to this still camera view (a button press), everything works fine. Then I send out a delegate and have this view dismissed from the previous view.

But, when I press that button on the first view again to show the camera view again, the screen is black. I've changed properties to instance variables, made sure the preview view existed at every step, etc.

But, when I take a picture (even when the screen is black and it's registering focus and exposure activity and responsive to touch) and display a modal view displaying the image for review, I do indeed see what I should have been seeing. And when I dismiss the modal, the camera view works just fine again with NO black.

So, what am I missing here? It's got to be something simple in the framework, IB, storyboard, etc. Thanks!

stillCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPresetPhoto cameraPosition:AVCaptureDevicePositionBack];
stillCamera.outputImageOrientation = UIInterfaceOrientationLandscapeLeft;

UIImage *inputImage = [UIImage imageNamed:@"blank-1x1.png"];
sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePicture processImage];

filter = [[GPUImageChromaKeyBlendFilter alloc] init];
[(GPUImageChromaKeyBlendFilter *)filter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
[(GPUImageChromaKeyBlendFilter *)filter setThresholdSensitivity:0.37f];

[stillCamera addTarget:filter];
[sourcePicture addTarget:filter];

[filter addTarget:videoPreviewView];
[stillCamera startCameraCapture];
4

1 回答 1

0

我建议仔细阅读这个帖子和这个评论:https ://github.com/BradLarson/GPUImage/issues/130#issuecomment-5936685 。希望对你也有帮助。

于 2013-04-23T10:29:41.473 回答