CIImageAccumulator 是做什么的?

What does CIImageAccumulator do?

问题

Apple 文档说明了何时可以使用 CIImageAccumulater,但不幸的是它没有说明它的实际作用。

The CIImageAccumulator class enables feedback-based image processing for such things as iterative painting operations or fluid dynamics simulations. You use CIImageAccumulator objects in conjunction with other Core Image classes, such as CIFilter, CIImage, CIVector, and CIContext, to take advantage of the built-in Core Image filters when processing images.

我必须修复使用 CIImageAccumulator 的代码。在我看来,尽管它的名字如此,但它要做的就是 return 一个 CIImage 并将所有 CIFilter 应用于图像。但是,添加第一张图像会使输出变暗。这不是我对累加器或任何其他支持基于反馈的图像处理的运算符的期望。

问题

任何人都可以回答在 CIImageAccumulator

中设置和获取图像时使用的逻辑/算法吗

CIImageAccumulater 的最大优点是 在不同的渲染步骤之间存储 其内容(与 CIFilterCIImage 相比) .这允许您使用先前渲染步骤的状态,将其与新的东西混合并将结果再次存储在累加器中。

A​​pple 的主要用例是交互式绘画:您从累加器中检索当前图像,将用户刚刚绘制的新笔画与上面的手势混合,然后将生成的图像存储回累加器。然后显示累加器的内容。你可以阅读它 here.