In the previous post, I
discussed the 'color' image blend mode as used by GIMP and my efforts in
Matlab to make a more useful variation. To recap, methods such as HSV, HSI, and HSL in general offer poor separation of color and brightness information. Of these methods, HSL tends to be the most useful for color adjustment and blending due to the symmetry of its saturation space, despite the fact that L is a poorer representation of image brightness than I. Unconstrained operation in other color spaces (LAB, LUV, YPbPr) leaves us with the problem of how to deal with out-of-gamut conditions on conversion back to RGB. Calculating boundary chroma and performing data truncation prior to RGB conversion can solve the problems caused by out-of-gamut points, resulting in good retention of background brightness.
When I had originally approached the use of LCH for image blending operations, I began by using a constrained and normalized version of LCH known originally as
HuSL (now called HSLuv). For a speed increase I also used a normalized polar version of YPbPr I refer to as
HSY. In these variations, saturation is normalized to the chroma range of the projected RGB space. This is convenient and solves most of the same issues which a constrained LCH method solves. It offers a few conveniences and features, but it has some weaknesses as well. The normalization of C causes colors of constant S to no longer have a uniformity of appearance, but repeated hue adjustments do not cause chroma compression as with LCH truncation.
|
The projection of RGB in CIELAB and YPbPr as the extent of HuSLab and HSY |
One of the drawbacks of normalizing or bounding chroma to the extent of the projected RGB space in LCH is that only a fraction of the projected RGB space lies on continuous locus of constant chroma. There exists only a small subset of the RGB space wherein color points can be subject to arbitrary hue rotation without leaving the gamut and having their chroma changed by truncation. This maximal rotationally-symmetric boundary defines the normalizing chroma used for HuSLp, a variation of HuSL wherein the uniformity of the parent space (LAB or LUV) is retained. As HuSLp and HSYp are subsets of the projected RGB space, they obviously
cannot specify the full range of RGB colors. Specifically, they are
restricted to colors near the neutral axis, hence the suffix denoting
pastel.
Compared to HuSLp, HSYp is not as uniform, but it has access to a
greater fraction of the RGB space than HuSLp in either CIELAB or CIELUV
modes.
|
Maximal biconic subsets of RGB in CIELUV, CIELAB, YPbPr |
|
Uniformity in HuSLp (LAB): surfaces of 100% S and 50% L |
|
Uniformity in HSYp: surfaces of 100% S and 50% Y |
While this makes HuSLp and HSYp useful for color selection tasks, they
are also useful for
image editing so long as the chroma limiting is
acceptable. Consider a color blending task with highly saturated
foreground. With its larger color range, let us compare a color blend
in HSYp and LCHab.
|
Extreme test foreground and background |
|
Color blends in CIELCHab and HSYp |
While the limitations of HSYp are noticeable, the benefits are far more striking in this case. The blue, red, and green stripes are moderated and the image regains its depth.
To be realistic, this use-case is impractical but for testing. A foreground with moderated colors would be less influenced by the limited range of HSYp. For a sufficiently desaturated foreground, HSYp blending would produce results similar to a LCH blend, but it may still be quite a bit faster. The major convenience of HSYp color blending is simply that the chroma is always compressed to the maximal uniform boundary. There is no need to tweak foreground saturation to prevent uneven results.
Obviously, using stripes makes it difficult to produce a pleasing blend in any case, but that's kind of the point when testing. In general, image editing operations need to consider content as much as method. Blending a broad range of saturated hues with a photographic scene tends to create results which defy a viewer's expectations of reality. Seeing a person with a purple face or a wood table lit with rainbow light doesn't make any sense to a pattern-recognition machine built on earth.
The image manipulation
toolbox I've posted contains HSYp and HuSLp conversion tools, as well as support for these methods in the related image blending function (imblend) and the color adjustment function (imtweak).
No comments:
Post a Comment