我正在使用https://github.com/liovch/GPUImage中定义的GPUImageColorBalanceFilter。但过滤后的图像在显示时根本没有从原始图像改变!代码运行良好,没有错误。我做错了什么?
CGImageRef cgimg = [context createCGImage:beginImage
fromRect:[beginImage extent]];
BOOL preserveLuminosity = NO;
GPUVector3 shadows= (GPUVector3){1,0.0,1};
GPUVector3 midtones = (GPUVector3){-1,-1,0.13};
GPUVector3 highlights = (GPUVector3){0.0,-1,1};
UIImage *img1 = [UIImage imageWithCGImage:cgimg];
GPUImagePicture *pic1 = [[GPUImagePicture alloc] initWithImage:img1];
GPUImageColorBalanceFilter *filter1 = [[GPUImageColorBalanceFilter alloc] init];
[filter1 setShadows:shadows];
[filter1 setMidtones:midtones];
[filter1 setHighlights:highlights];
[filter1 setPreserveLuminosity:preserveLuminosity];
[pic1 addTarget:filter1];
[pic1 processImage];
UIImage *new= filter1.imageFromCurrentlyProcessedOutput;
self.imageView.image = new;
CGImageRelease(cgimg);
注意:由于我已经在使用bradlarson的GPUImage库,因此我将https://github.com/liovch/GPUImage中的GPUImageColorBalanceFilter.h,GPUImageColorBalanceFilter.m,GPUImageOpenGLESContext.h,GPUImageOpenGLESContext.m添加到我的代码库中。