GPUImageStillCamera を使用して写真を撮り、その写真を GPUImageView に読み込みます
静止画の GPUImageView にフィルターを適用するにはどうすればよいですか?
私がオンラインで見た唯一の例は、最初に GPUImagePicture を作成することです (これには UIImage が必要です) が、GPUImageView から UIImage を作成し、それを GPUImagePicture にロードする必要があるのはかなり無駄に思えます。でも方法がわからない
私はもう試した:
GPUImageFilter *sepiaFilter [[GPUImageSepiaFilter alloc]init];
[sepiaFilter addTarget:gpuImageView];
//and then tried these in a bunch of different orders
[filter useNextFrameForImageCapture];
[currentFilter endProcessing];
[currentFilter imageFromCurrentFramebuffer];
編集: 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