首页新闻找找看学习计划

GPUImage混合滤镜的使用

0
悬赏园豆:30 [已解决问题] 解决于 2014-09-18 16:40

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];

苏丝娆的主页 苏丝娆 | 初学一级 | 园豆:184
提问于:2014-09-18 15:01
< >
分享
最佳答案
0

不懂ios开发  帮顶

收获园豆:10
nil | 小虾三级 |园豆:660 | 2014-09-18 15:04
其他回答(3)
0

不懂ios开发  帮顶

收获园豆:10
undefined | 园豆:698 (小虾三级) | 2014-09-18 15:14
0

不懂ios开发  帮顶

收获园豆:10
单恋 | 园豆:678 (小虾三级) | 2014-09-18 15:36
0

因为少了一个步骤吧,没有把CIImage转成UIImage

GeorgeHoo | 园豆:202 (菜鸟二级) | 2016-03-11 10:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册