On Sat, Jul 28, 2012 at 11:02 AM, Stefan Stavrev
<[email protected]> wrote:
> I propose API and usage for ImageBufAlgo::contrast_stretch.
>
> This function does the same thing as Levels in Photoshop:
> http://postimage.org/image/vre9umbqv/
> where min_in to max_in is the range of pixel values in
> the input image, min_out to max_out is the new range,
> values below min_in are mapped to below_min_in and
> values above max_in are mapped to above_max_in.
> You can see in the image above, Photoshop allows you
> to also change gamma, but I think we should have that
> as separate function.

It occurs to me that this is just the same underlying transform as contrast()
if we ignore below_min_in and above_max_in.  In particular, they're just two
different ways of doing a per-channel affine transformation:

x_out = a*x_in + b

where a and b are fixed coefficients (possibly different for each channel).


Given that they're basically the same thing, I'd expect we should implement
the above functionality only in oiiotool.  ImageBufAlgo can just have a
function which does affine transforms on the channels, and contrast() can call
through to that.  (I don't think we need a contrast_stetch in ImageBufAlgo.)

~Chris
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to