Я использую GPUImageStillCamera, чтобы сфотографировать и загрузить изображение в GPUImageViewGPUImage применить фильтр к GPUImageView
Теперь, как я могу применить фильтр к неподвижному GPUImageView?
Единственные примеры, которые я вижу в Интернете, - это сначала создать GPUImagePicture (для чего требуется UIImage), но кажется довольно расточительным создание UIImage из GPUImageView, а затем загрузить его в GPUImagePicture, когда я могу просто применить фильтры к GPUImageView напрямую. Но я не знаю, как
Я пробовал:
GPUImageFilter *sepiaFilter [[GPUImageSepiaFilter alloc]init];
[sepiaFilter addTarget:gpuImageView];
//and then tried these in a bunch of different orders
[filter useNextFrameForImageCapture];
[currentFilter endProcessing];
[currentFilter imageFromCurrentFramebuffer];
EDIT: Вот как я загрузить изображение в GPUImageView
self.stillCamera = [[GPUImageStillCamera alloc]
initWithSessionPreset:AVCaptureSessionPresetPhoto
cameraPosition:AVCaptureDevicePositionFront];
self.stillCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
self.filterEmpty = [[GPUImageGammaFilter alloc] init];
[self.stillCamera addTarget:self.filterEmpty];
[self.filterEmpty addTarget:self.capturedImageView];
[self.stillCamera startCameraCapture];
[self.stillCamera capturePhotoAsJPEGProcessedUpToFilter:self.filterEmpty withCompletionHandler:^(NSData *processedJPEG, NSError *error){
[self.stillCamera stopCameraCapture];
//and then from here the gpuimageview is loaded with the taken picture
Как вы делаете снимок и загружаете его в GPUImageView? – Jack
@JackWu Я обновил свой вопрос – MobileMon