How to apply chroma key filter with any color to live camera feed ios?

混江龙づ霸主 提交于 2019-12-23 19:58:46

问题


Basically I want to apply chroma key filter to ios live camera feed but I want user to pick the color which will be replaced by another color.

I found some examples using green screen but I don't know how to replace color dynamically instead of just green color.

Any idea how can I achieve that with best performance?


回答1:


You've previously asked about my GPUImage framework, so I assume that you're familiar with it. Within that framework are two filters, a GPUImageChromaKeyFilter and a GPUImageChromaKeyBlendFilter. Both will key off of whatever color you specify via the -setColorToReplaceRed:green:blue: method, with a threshold set using the thresholdSensitivity property.

The former filter merely turns areas matching the color within the threshold to an alpha of 0, with the latter actually doing a blend against another image or video source based areas of the input image or video that match. The FilterShowcase example application shows how to do this for green, but you can set the keying color to anything you want.



来源:https://stackoverflow.com/questions/24948886/how-to-apply-chroma-key-filter-with-any-color-to-live-camera-feed-ios

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