-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in reading / writing multichannel EXR in python? #1471
Comments
Hi @tatue64 Could you provide us with a reproducer?? import mitsuba as mi
mi.set_variant('cuda_ad_rgb')
scene = mi.load_dict(mi.cornell_box())
path_integrator = mi.load_dict({
'type': 'path',
'max_depth': 2
})
integrator = mi.load_dict({
'type': 'aov',
'aovs': 'p:position',
'my_image': path_integrator
})
mi.render(scene, integrator=integrator)
bmp = scene.sensors()[0].film().bitmap()
out = bmp.split()
bmp.write("test.exr")
reloaded = mi.Bitmap('test.exr')
out = reloaded.split() |
yes. The problem occurs, when the import drjit as dr
import mitsuba as mi
mi.set_variant('cuda_rgb')
cbox = mi.cornell_box()
film = {
'type': 'hdrfilm',
'pixel_format': 'rgba',
'component_format': 'float32',
'file_format': 'openexr',
'filter': {
'type': 'gaussian',
'stddev': 0.5
},
'width': 256,
'height': 256,
'sample_border': True,
'compensate': True
}
cbox['sensor']['film'] = film
scene = mi.load_dict(cbox)
path_integrator = mi.load_dict({
'type': 'path',
'max_depth': 2
})
integrator = mi.load_dict({
'type': 'aov',
'aovs': 'albedo:albedo,normals:sh_normal,uv:uv,shape:shape_index,prim:prim_index,dpu:dp_du,dpv:dp_dv,dx:duv_dx,dy:duv_dy,depth:depth',
'my_image': path_integrator
})
mi.render(scene, integrator=integrator)
bmp = scene.sensors()[0].film().bitmap()
out = bmp.split()
bmp.write("test.exr")
reloaded = mi.Bitmap('test.exr')
out = reloaded.split()' |
I can reproduce this bug. Here is the direct cause of the bug. The following reported result only uses depth aov for simplicity.
After write to
Later in the Aside: It's not clear to me why the multi-channel RGBA are all marked as premultiplied alpha. If we don't use AOV integrator, the alpha channel is labeled as "alpha". |
I rendered a multichannel image
aov
. For this imageaov.split()
works as expected. After saving the image withaov.write("test.exr")
and afterwards reading it withaovx = mi.Bitmap("test.exr")
the image is loaded without problems, butaovx.split()
does no longer work but returns the error `RuntimeError: [StructConverter] Internal error: source and target alpha have mismatched names!'. Apparently, the image structure is changed in the process of writing and reading the image (see below). The different channels of the image can be read and displayed with the Tev app, and this suggests that the problem occurs during reading.The original image has the following structure
whereas the structure after reading the saved file is
Obviously, the first four channels are different and also Integrator A. Presumably, the change from 'premultiplied alpha' to 'alpha' leads to the error.
The text was updated successfully, but these errors were encountered: