UIImage *imageOri = [UIImage imageNamed:@"2"];
//原图片
UIImageView *imageOriView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 20, 150, 90)];
imageOriView.image = imageOri;
[self.view addSubview:imageOriView];
//亮度
GPUImageBrightnessFilter *passthroughFilter = [[GPUImageBrightnessFilter alloc]init];
passthroughFilter.brightness = - 0.2;
[passthroughFilter forceProcessingAtSize:imageOri.size];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc]initWithImage:imageOri];
[stillImageSource addTarget:passthroughFilter];
[stillImageSource processImage];
UIImage *nearestNeighborImage = [passthroughFilter imageFromCurrentlyProcessedOutput];
UIImageView *imageView = [[UIImageView alloc]initWithImage:nearestNeighborImage];
imageView.frame = CGRectMake(160, 20, 150, 90);
[self.view addSubview:imageView];
//曝光
GPUImageExposureFilter *passthroughFilter2 = [[GPUImageExposureFilter alloc]init];
passthroughFilter2.exposure = 2;
[passthroughFilter2 forceProcessingAtSize:imageOri.size];
GPUImagePicture *stillImageSource2 = [[GPUImagePicture alloc]initWithImage:imageOri];
[stillImageSource2 addTarget:passthroughFilter2];
[stillImageSource2 processImage];
UIImage *nearestNeighborImage2 = [passthroughFilter2 imageFromCurrentlyProcessedOutput];
UIImageView *imageView2 = [[UIImageView alloc]initWithImage:nearestNeighborImage2];
imageView2.frame = CGRectMake(5, 120, 150, 90);
[self.view addSubview:imageView2];
//色度
GPUImageHueFilter *passthroughFilter3 = [[GPUImageHueFilter alloc]init];
passthroughFilter3.hue = 5;
[passthroughFilter3 forceProcessingAtSize:imageOri.size];
GPUImagePicture *stillImageSource3 = [[GPUImagePicture alloc]initWithImage:imageOri];
[stillImageSource3 addTarget:passthroughFilter3];
[stillImageSource3 processImage];
UIImage *nearestNeighborImage3 = [passthroughFilter3 imageFromCurrentlyProcessedOutput];
UIImageView *imageView3 = [[UIImageView alloc]initWithImage:nearestNeighborImage3];
imageView3.frame = CGRectMake(160, 120, 150, 90);
[self.view addSubview:imageView3];
//混合
GPUImagePicture *finalyOne = [[GPUImagePicture alloc]initWithImage:nearestNeighborImage];
[finalyOne addTarget:passthroughFilter2];
[finalyOne processImage];
[finalyOne addTarget:passthroughFilter3];
[finalyOne processImage];
1
|
UIImage *nearestNeighborImage4 = [finalyOne imageFromCurrentlyProcessedOutput] |
; //这句nearestNeighborImage4 为 null
imageView4.frame = CGRectMake(5, 220, 150, 90);
[self.view addSubview:imageView4];
不懂ios开发 帮顶
不懂ios开发 帮顶
不懂ios开发 帮顶
因为少了一个步骤吧,没有把CIImage转成UIImage