CIFilter Combination

吃可爱长大的小学妹 提交于 2021-02-08 06:22:12

问题


I'm trying to achieve the same effect that appears when you enter the menu in the Read Dead Redemption (RDR) game:

After browsing the CIFilter library I found that the filter I'm looking for is CIColorMonochrome. After applying the filter on a sample image I get the following result:

This looks great, however not quite the same effect as in the RDR picture. I'm going to have a number over the image and it needs to be clearly visible. Therefore, I was wondering if the is a filter that will help me achieve the black, comic-bookish style of RDR picture. I tried using CIEdgeWork, but it didn't seem to work.

Any ideas?


回答1:


CIColorMonochrome is not the best filter for your sitatution since the output image will be shaded between white and a color of your choice. If you look at the sample RDR image, there's no white anywhere.

Instead, remove the green and blue channels, leaving only the red channel for a red tinted color. You can also apply a CISharpenLuminace filter to give a it high-contrast and grittier look:

let zeroVector = CIVector(x: 0, y: 0, z: 0, w: 0)
let outputImage = inputImage
    .applyingFilter("CIColorMatrix", parameters: ["inputGVector": zeroVector, "inputBVector": zeroVector])
    .applyingFilter("CISharpenLuminance", parameters: ["inputSharpness": NSNumber(value: 2)]) 

Result:



来源:https://stackoverflow.com/questions/45927329/cifilter-combination

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