Ah yes, sorry.

This is the signature:

ImageBufAlgo::contrast (ImageBuf &R, const ImageBuf &A, float contrast,
                                           ROI roi, int nthreads)

and this is what it does for grayscale images:

r[0] = clamp (a[0] * contrast, 0.0f, 1.0f);

where r is iterator over R, and a over A. Dead simple.

The algorithm for color images is:

r = (r-128) * contrast + 128;
g = (g-128) * contrast + 128;
b = (b-128) * contrast + 128;

This assumes we work with unsigned char in range 0-255, but
I can remap to other range if needed.
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to