Re: Pixel Iterator

Larry Gritz

Not sure if maybe this was meant for the OIIO list rather than OCIO, but if you already have OpenImageIO in the mix, then I think you can very efficiently do this using a combination of ImageBufAlgo.computePixelStats (to find the per-channel min and max values) and ImageBufAlgo.contrast_remap (to stretch the input range to [0,1]).

I guess, actually, I'm not sure from your description whether you want to normalize (stretch or shrink the range to [0,1]) or simply to clamp (make sure no values are outside [0,1] but not change any values that were already ok). If you really meant clamping, then there is also ImageBufAlgo.clamp should do what you want.

On Aug 12, 2022, at 11:16 AM, max.shooster@... wrote:

Hi! I am writing an application in Python. I have a function that normalizes pixel values in an image to ensure the values do not exceed 1 or are below 0. At the moment I am using OpenImageIO's get_pixels() and set_pixels(), but it is very slow. Are there any pixel iterators in OCIO that may have better performance?

Larry Gritz

Join to automatically receive all group messages.