CIFilter Combination

661 views Asked by At

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

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: enter image description hereenter image description here

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

There are 1 answers

0
Code Different On BEST ANSWER

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:

enter image description here