Applying CIFiler to a masked portion of an image

别来无恙 提交于 2019-12-23 22:46:00

问题


I'm looking for a way to apply a CIFilter to a portion of an image defined by a mask. Something like this, given an image:

Source http://imageshack.us/scaled/landing/213/browserpreviewtmp1p.jpg

And a mask:

I apply some variation of

CIFilter *filter = [CIFilter filterWithName:@"CIColorControls" keysAndValues: kCIInputImageKey, beginImage,@"inputSaturation", @0, @"inputContrast", @1, @"inputBrightness", @0, nil];

And get this:

Result http://imageshack.us/a/img689/5297/browserpreviewtmpd.jpg

How can I do this?


回答1:


You can use another couple CIFilters! You can take the top image and multiply it by the mask using CIMultiplyBlendMode, then add it to the bottom image using CIAdditionCompositing.



来源:https://stackoverflow.com/questions/13999751/applying-cifiler-to-a-masked-portion-of-an-image

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