Hello i’m trying to composite an alpha onto a rgb image from a different file.
fillholes_pushpull seems to work as expected on 8bit images but on float images
the values go over the roof.
Also I think i’m composing a correct rgba imagebuf but the output is always
black that way.
So I don’t know what’s wrong. Here’s the code:
I can send you the test images if needed.
Thank you.
import OpenImageIO as oiio
from OpenImageIO import ImageInput, ImageOutput
from OpenImageIO import ImageBuf, ImageSpec, ImageBufAlgo
fg = oiio.ImageBuf(‘/name.Diffuse.exr’) # exr or jpeg same problem
bg = oiio.ImageBuf(‘/name.Opacity.exr’)
al = oiio.ImageBufAlgo.channels (bg, (0, ))
al = ImageBufAlgo.contrast_remap (al, black=0.4, white=0.6)
temp = oiio.ImageBufAlgo.channel_append (fg, al)
outbuf = oiio.ImageBufAlgo.fillholes_pushpull(temp)
#outbuf = oiio.ImageBufAlgo.channels (outbuf, (0, 1, 2 )) #write complain about
a missing alpha channel here
image = outbuf.get_pixels()
print(image.shape)
alpha = al.get_pixels()
print(alpha.shape)
def write_image (image, filename, format=oiio.UNKNOWN) :
if not image.has_error :
image.write (filename, format)
if image.has_error :
print ("Error writing", filename, ":", image.geterror())
write_image (outbuf, ‘/name/test.tif’) #extension doesnt change anything
# Window name in which image is displayed
window_name = 'image'
cv2.imshow(window_name, alpha)
cv2.waitKey(0)
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org