Chewie The Chorkie
Chewie The Chorkie

Reputation: 5234

Is there a setting for CIColorControls that leaves an image unaffected?

I'm using the CIFilter CIColorControls in Swift to alter camera input, but I can't find any setting to leave the image unaffected. I'm attempting to calibrate the saturation, brightness and contrast parameters in CIColorControls by adjusting UISliders.

The documentation states that inputSaturation and inputContrast's default values are 1.0. inputBrightness does not state an input value, but upon adjusting these values, I can't find a setting to start from that displays the image unaffected by all 3 of these settings, which makes me suspect there is something fundamentally wrong with this filter.

I'm passing my unaltered CIImage with applyingFilter:

image = image
    .applyingFilter("CIColorControls", parameters: [kCIInputImageKey: image,
                                                            kCIInputSaturationKey:debugSatVal,
                                                            kCIInputBrightnessKey:debugBrightVal,
                                                            kCIInputContrastKey:debugConVal])

debugSatVal, debugBrightVal and debugConVal are controlled by UISliders and I can observe the values of them in LLDB.

Upvotes: 4

Views: 2116

Answers (1)

Craig Siemens
Craig Siemens

Reputation: 13296

These are the values that should return the original image

kCIInputSaturationKey: 1.0
kCIInputBrightnessKey: 0.0
kCIInputContrastKey: 1.0

Upvotes: 10

Related Questions