I am beginning to work in Core Image and applying some filters. Most that I have encountered are fairly easy to understand but a few are confusing me.
As I need a mono image I came across two: CIMaximumComponent and the corresponding CIMinimumComponent. There are others too but the description of these two is pretty sparse. Can someone expand just a little so I can understand the difference? It mentions max(r,g,b) and min of the same, what is the source of r,g,b and how is the result applied?
For Core Image documentation in general, I can recommend cifilter.io, though it does not list the newest filters. You can also check out the Filter Magic app, which lets you play with most CIFilters and has a lot of documentation.
As for CIMaximumComponent
and CIMinimumComponent
: They will take the max/min values of R, G, and B and return a pixel with all channels set to this value.
Some examples:
RGB(1.0, 0.0, 0.0) -> max: RGB(1.0, 1.0, 1.0) | min: RGB(0.0, 0.0, 0.0)
RGB(0.5, 0.7, 0.3) -> max: RGB(0.7, 0.7, 0.7) | min: RGB(0.3, 0.3, 0.3)
So yes, they turn the image into grayscale, but I might not be what you want since the value doesn't represent perceived lightness of the color.
You might want to check out CIPhotoEffectMono
, CIPhotoEffectNoir
, and CIPhotoEffectTonal
for a more natural grayscale conversions.