Metal Custom CIFilter different return value

折月煮酒 提交于 2019-12-06 05:11:54

Core Image performs color matching two times when you process an image: From the color space if the input image to the working color space of the CIContext and, in the final rendering step after all filters were applied, from the working color space to the output color space of the context.

Those color spaces are configured with default values that, in my experience, depend on the device (and its display) you are running on. However, you can define both color spaces using the kCIContextWorkingColorSpace and kCIContextOutputColorSpace options when creating your CIContext.

If you set both values to NSNull(), Core Image won't perform any color matching, treating all color values as they are in the image buffers. However, your filter probably has some assumptions on the color space of the input samples. So keep that in mind when you are dealing with inputs from sources like the camera that might have different color spaces depending on the device and camera configuration.

Another way to ensure the input samples are always in the color space you need is to set the kCISamplerColorSpace option when creating a CISampler that serves as input to your custom kernel.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!