My recommendation for all of these ImageBugAlgo implementations (contrast, histogram adjust, box filters, etc) is to completely ignore color space.
I have reviewed the book referenced by Stefan, and I agree that it makes a strong case that many image processing operations achieve superior results when applied in alternate color representations. However, there is no single color workflow that is superior for all situations, and as such any assumption we make will hamper re-use, and likely cause more trouble than it's worth. To summarize, when writing ImageBufAlgos, the minimum number of assumptions we place on the user's data, and the more limited in scope we make each operation, will allow the greatest flexibility. Consider the box filter Stefan references. The HSIcolor space he recommends is similar to HSV, but where I is the average (1/3 1/3 1/3) instead of V=MAX(r,g,b). (I== intensity) For denoising operation (as outlined in the book) it is common to filter the chromatic channels independent of luminance. But what if the user is interested in using a alternate weighted average to compute the luminance? (Which is common). What if they want to filter in HSL? Or in L*a*b*? Or YIQ? There is no reason to presume that we know better than the user. What if the user wants to apply a box filter to a random set of channels which do not correspond to color? Providing all of these options, to all of the image processing operators, will quickly explode out of control I would suggest that by keeping the ImageBufAlgo operations lightweight operations, we will allow for the maximum re-use and flexibility. I.e., a filtering implementation should not do *anything* color related. And contrast operators -- except in certain cases where the algorithm is inseparable from the color encoding -- should be color space neutral as well! So in the box filter case, if the user was interested in processing in non RGB space, they would 1) convert RGB->YIQ. 2) apply filter 3) convert back. The only recommendation I would suggest for this filtering case is to allow optionally for per-channel filter sizes. So if the user wanted to convert to a luma/chroma space, and apply filtering only to the chroma channels (perhaps with different radaii), it was convenient for them to do so. -- Jeremy _______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org