使用GPUImage Still Camera切换过滤器时闪烁

时间:2014-07-16 04:15:12

标签: ios objective-c filter gpuimage chain

处理GPUImageStillCamera时遇到一些过滤器问题。 在我的应用程序中,我使用2个预览视图,包含2个过滤器和一个stillCamera。 喜欢这个

[_stillCamera addTarget:_frontFilter]; [_frontFilter addTarget:_frontView];
[_stillCamera addTarget:_backFilter]; [_backFilter addTarget:_backView];

一切都很好,但是当我更换过滤器时我遇到了问题

- (void)switchFilter
{
    [_stillCamera removeTarget:_frontFilter];
    [_stillCamera removeTarget:_backFilter];
    [_frontFilter removeTarget:_frontView];
    [_backFilter removeTarget:_backView];

    // Make sure everything is removed
    [_stillCamera removeAllTargets];

    // Get new filter
    _frontFilter = _arrGPUImageFilter[0];
    _backFilter = _arrGPUImageFilter[1];

    // Add target
    [_stillCamera addTarget:_frontFilter];
    [_frontFilter addTarget:_frontView];
    [_stillCamera addTarget:_backFilter];
    [_backFilter addTarget:_backView];
}

当我切换过滤器时,前视图中有一些闪烁,一周后我仍然卡住;我试图解决,但没有希望。

PS:当我在此链接中使用GPUImageFilterPipeline时:Switching between filter chains using GPUImage Framework

- (void)switchFilter
{
    if (!_piplineFront)
    {
        GPUImageFilter *emptyFilter = [[GPUImageFilter alloc] init];
        NSArray *emptyArray = @[emptyFilter];

        _piplineFront = [[GPUImageFilterPipeline alloc] initWithOrderedFilters:emptyArray input:_stillCamera output:_frontView];
    }
    if (!_piplineBack)
    {
        GPUImageFilter *emptyFilter = [[GPUImageFilter alloc] init];
        NSArray *emptyArray = @[emptyFilter];

        _piplineBack = [[GPUImageFilterPipeline alloc] initWithOrderedFilters:emptyArray input:_stillCamera output:_backView];
    }

    // Get filter
    _frontFilter = _arrGPUImageFilter[frontIndex];
    _backFilter = _arrGPUImageFilter[backIndex];

    [_piplineBack replaceAllFilters:@[_backFilter]];
    [_piplineFront replaceAllFilters:@[_frontFilter]];
}

我不能一起使用两个GPUImagePipelines。 backView或frontView没有显示。

我想要进一步的帮助。请。

0 个答案:

没有答案