I creating set of GPUImageToneCurveFilter
and storing in an array.
First i am creating preview video view for all filters using GPUImageVideoCamera after selecting any filter i am trying to add that filter detail view (GPUImageStillCamera ). But i am getting black screen for this.
If i recreate new filter instead of reusing and then add to GPUImageStillCamera it work fine. any solution to this.
Preview view creating code:
-(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];
}