我创建了一组GPUImageToneCurveFilter
并存储在一个数组中。
首先,我在选择任何过滤器后使用 GPUImageVideoCamera 为所有过滤器创建预览视频视图,我试图添加该过滤器详细视图(GPUImageStillCamera)。但是我为此遇到了黑屏。
如果我重新创建新过滤器而不是重用然后添加到 GPUImageStillCamera 它工作正常。对此的任何解决方案。
预览视图创建代码:
-(void)setUpUI{
self.videoView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill;
}
-(void)addFilter:(id)filter
{
// For thumbnails smaller than the input video size, we currently need to make them render at a smaller size.
// This is to avoid wasting processing time on larger frames than will be displayed.
// You'll need to use -forceProcessingAtSize: with a zero size to re-enable full frame processing of video.
self.filter = filter;
[filter forceProcessingAtSize:self.videoView.sizeInPixels];
[[CameraProvider sharedProvider] addTarget:filter];
[filter addTarget:self.videoView];
[[CameraProvider sharedProvider] startCameraCapture];
self.titleLabel.text = [filter fliterName];
}
-(void)stopCamera
{
[self.filter removeAllTargets];
[[CameraProvider sharedProvider] removeTarget:self.filter];
[[CameraProvider sharedProvider] stopCameraCapture];
}
-(IBAction)selectionDone:(id)sender {
[[CameraProvider sharedProvider] removeInputsAndOutputs];
self.selectedFilter(self.filter);
}
// Adding to detail view (GPUImageStillCamera0:
- (void)didSelectFilter:(id)newfilter;
{
NSLog(@"fliter");
// newfilter = [[GPUImageToneCurveFilter alloc] initWithACV:@"california-gold-rush.acv"];
[newfilter prepareForImageCapture];
[stillCamera addTarget:newfilter];
[newfilter addTarget:self.imageView];
[stillCamera startCameraCapture];
}