There is an ImageBufALgo.over(). Would that solve your problem?

I'm not 100% sure I understand what you mean by "merging". Do you mean 
"compositing?" Or are you implying that you are taking two incomplete renders 
and trying to combine the pixels or tiles rendered in one with a disjoint set 
from the other render?


On Jun 19, 2014, at 8:59 AM, Fredrik Averpil <[email protected]> wrote:

> Hi,
> 
> I’m currently merging EXR tile renders using OIIO, as seen below, using 
> ImageBufAlgo.add. This works fine as long as the EXR background/canvas of 
> each tile is completely black.
> 
> However, for some V-Ray AOVs (or “Render elements” as they are called in 
> V-Ray), the background is not always black. So an “add” would produce wrong 
> results when merging the tiles.
> 
> Is it possible to “over” the tiles on top of each other rather than using 
> “add” and without knowing the tile sizes?
> …or do you have any other suggestions?
> The tiles do not always have an alpha channel.
> 
> import os
> import OpenImageIO as oiio
> from OpenImageIO import ImageInput, ImageOutput
> from OpenImageIO import ImageBuf, ImageSpec, ImageBufAlgo
> 
> folder = '/some/folder'
> merged_buf = ImageBuf()
> buffers = []
> 
> for filename in os.listdir( folder ):
>   filepath = os.path.join(folder, filename)
>   buffers.append( ImageBuf( filepath ) )
> 
> for i in range(0, len(buffers)):
>   if i == 0:
>     ImageBufAlgo.add( merged_buf, buffers[i], buffers[i+1])
>   if (i > 1) and (i <= len(buffers) ):
>     ImageBufAlgo.add( merged_buf, merged_buf, buffers[i])
> 
> merged_buf.write( os.path.join(folder, 'merged.exr') )
> Regards,
> Fredrik
> 
> ​
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
[email protected]



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

Reply via email to