Ios GPUImageAlphaBlendFilter-不完整的过滤器FBO:36054

Ios GPUImageAlphaBlendFilter-不完整的过滤器FBO:36054,ios,objective-c,gpuimage,fbo,Ios,Objective C,Gpuimage,Fbo,我试图根据GPUImage示例中的FilterShowcase应用程序使用GPUImageChromaKeyFilter,但显然我遗漏了一些东西,因为它崩溃了 这是我的密码: videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; videoCamera.ou

我试图根据GPUImage示例中的FilterShowcase应用程序使用GPUImageChromaKeyFilter,但显然我遗漏了一些东西,因为它崩溃了

这是我的密码:

    videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
    videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;


    GPUImageChromaKeyFilter *filter = [[GPUImageChromaKeyFilter alloc] init];
    [filter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
    [filter prepareForImageCapture];


    videoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0, 0, 640, 480)];
    [self.view addSubview:videoView];


    UIImage *inputImage = [UIImage imageNamed:@"bedroom.jpeg"];
    GPUImagePicture *sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
    [sourcePicture processImage];
    [sourcePicture addTarget:filter];





    [sourcePicture removeTarget:filter];
    [videoCamera removeTarget:filter];
    [videoCamera addTarget:filter];

    GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
    blendFilter.mix = 1.0;
    [sourcePicture addTarget:blendFilter];
    [filter addTarget:blendFilter];





    [blendFilter addTarget:videoView];
    [videoCamera startCameraCapture];
当我运行它时,它只告诉我:

2013-06-24 15:24:45.369 GPUImage测试[1284:1703]*断言失败 在-[GPUImageAlphaBlendFilter CreateFilterBoofsize:]中, /Users/hello/Desktop/xcode/GPUImage-Test/GPUImage/framework/Source/GPUImageFilter.m:369

2013-06-24 15:24:45.383 GPUImage测试[1284:1703]*终止应用程序 由于未捕获的异常“NSInternalInconsistencyException”,原因: “不完整的过滤器固定基地运营商:36054”

*第一次抛出调用堆栈:

(0x3134f3e7 0x391d9963 0x3134f29d 0x31c25fa3 0xc9563 0xd608d 0xc8b3d 0xc9885 0xdaa63 0xcc11f 0xdb39f 0xca07b 0xcc153 0xd266f 0xd2dbb 0xd3f35 0x395f3793 0x395f6b3b 0x395f467d 0x395f7613 0x395f77d9 0x3961b7f1 0x3961b684)

libc++abi.dylib:terminate调用引发异常

有人知道我做错了什么吗


提前感谢。

-processImage
是异步的。当您调用它时,它不会运行到完成,因此您需要维护过滤器结构,直到它完成处理

这意味着您不能立即调用
-removeTarget:
,也意味着您需要将
sourcePicture
实例作为实例变量挂起,直到处理完成。否则,它将在该方法结束时被解除分配,并因此中断其输出


当一切配置正确时,您需要设置过滤器链并运行
-processImage
。只要需要过滤结果,您就需要维护源图片。

-processImage
是异步的。当您调用它时,它不会运行到完成,因此您需要维护过滤器结构,直到它完成处理

这意味着您不能立即调用
-removeTarget:
,也意味着您需要将
sourcePicture
实例作为实例变量挂起,直到处理完成。否则,它将在该方法结束时被解除分配,并因此中断其输出


当一切配置正确时,您需要设置过滤器链并运行
-processImage
。只要需要过滤结果,您就需要维护源图片。

问题可能是过滤器设置为混合过滤器的源。问题可能是过滤器设置为混合过滤器的源