Apply color transformation on images containing a single channel


Jeremy Selan <jeremy...@...>
 

If your image is packed separately per channel (ex:  RRRRRRR... GGGGG... BBBB.... ), the Planar ImageDesc is probably what you're looking for. Give that a try?


PlanarImageDesc(float * rData, float * gData, float * bData, float * aData,
                        long width, long height,
                        ptrdiff_t yStrideBytes = AutoStride);

Note that the float * for alpha is optional, so if you are only loading RGB you can pass a NULL ptr for that.

-- Jeremy




On Wed, Apr 10, 2013 at 8:36 PM, Mark Boorer <mark...@...> wrote:
Hi,

In my application, images are split into their separate channels, and operations are performed per channel. I have individual float arrays for each channel (obtained via openimageio), and I would like to perform a colorspace transformation to each, preferably without joining them together.
I noticed that the PackedImageDesc docs say it ignores channels > 4, is there an easy way in the c++ library to provide a float array, and specify which channel it contains to perform the transformation?

Something like:

OCIO::PackedImageDesc img(data, w, h, 1, "R");

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Mark Boorer <mark...@...>
 

Hi Jeremy,

Thanks for your quick reply!

Unfortunately, it seems that PlanarImageDesc also requires at least 3 channels of data. I tried passing it NULL pointers for the other, non existing channels, though it complains at runtime that "Valid ptrs must be passed for all 3 image rgb color channels".

I guess I can construct dummy 0 arrays for the other channels, but that seems like a waste of resources. Do you have any other ideas?

Thanks,
Mark





On Thursday, April 11, 2013 1:59:55 PM UTC+10, Jeremy Selan wrote:
If your image is packed separately per channel (ex:  RRRRRRR... GGGGG... BBBB.... ), the Planar ImageDesc is probably what you're looking for. Give that a try?

PlanarImageDesc(float * rData, float * gData, float * bData, float * aData,
                        long width, long height,
                        ptrdiff_t yStrideBytes = AutoStride);

Note that the float * for alpha is optional, so if you are only loading RGB you can pass a NULL ptr for that.

-- Jeremy




On Wed, Apr 10, 2013 at 8:36 PM, Mark Boorer <mar...@...> wrote:
Hi,

In my application, images are split into their separate channels, and operations are performed per channel. I have individual float arrays for each channel (obtained via openimageio), and I would like to perform a colorspace transformation to each, preferably without joining them together.
I noticed that the PackedImageDesc docs say it ignores channels > 4, is there an easy way in the c++ library to provide a float array, and specify which channel it contains to perform the transformation?

Something like:

OCIO::PackedImageDesc img(data, w, h, 1, "R");

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Jeremy Selan <jeremy...@...>
 

>Unfortunately, it seems that PlanarImageDesc also requires at least 3 channels of >data. I tried passing it NULL pointers for the other, non existing channels, though it >complains at runtime that "Valid ptrs must be passed for all 3 image rgb color >channels".
>I guess I can construct dummy 0 arrays for the other channels, but that seems like >a waste of resources. Do you have any other ideas?

Yah, OCIO assumes that you always have at least the 3 R,G,B channels available for simultaneously processing.  The reason is that OCIO allows for channel 'crosstalk' in  colorspace definitions, so it's impossible in the general case to compute any single output channel without access to each input at the same time.  If life were only 1-D luts, this would work but with 3-D or matricies...

If there is a way to structure your code to have all 3 channels available at once I'd highly recommend it.  Otherwise, you can create dummy '0' channels but know that your implementation will silently fail (ugh!) for transforms with crosstalk. (which is queryable from the processor, fyi).

-- Jeremy



On Wed, Apr 10, 2013 at 11:55 PM, Mark Boorer <mark...@...> wrote:
Hi Jeremy,

Thanks for your quick reply!

Unfortunately, it seems that PlanarImageDesc also requires at least 3 channels of data. I tried passing it NULL pointers for the other, non existing channels, though it complains at runtime that "Valid ptrs must be passed for all 3 image rgb color channels".

I guess I can construct dummy 0 arrays for the other channels, but that seems like a waste of resources. Do you have any other ideas?

Thanks,
Mark






On Thursday, April 11, 2013 1:59:55 PM UTC+10, Jeremy Selan wrote:
If your image is packed separately per channel (ex:  RRRRRRR... GGGGG... BBBB.... ), the Planar ImageDesc is probably what you're looking for. Give that a try?

PlanarImageDesc(float * rData, float * gData, float * bData, float * aData,
                        long width, long height,
                        ptrdiff_t yStrideBytes = AutoStride);

Note that the float * for alpha is optional, so if you are only loading RGB you can pass a NULL ptr for that.

-- Jeremy




On Wed, Apr 10, 2013 at 8:36 PM, Mark Boorer <mar...@...> wrote:
Hi,

In my application, images are split into their separate channels, and operations are performed per channel. I have individual float arrays for each channel (obtained via openimageio), and I would like to perform a colorspace transformation to each, preferably without joining them together.
I noticed that the PackedImageDesc docs say it ignores channels > 4, is there an easy way in the c++ library to provide a float array, and specify which channel it contains to perform the transformation?

Something like:

OCIO::PackedImageDesc img(data, w, h, 1, "R");

Thanks,
Mark

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/groups/opt_out.