I'm using OpenEXR to write an exr image of size (256, 256) to a display window of (896, 1280). However, I get the error of Segmentation Fault:
I've already increased the stack memory using ulimit -s 32768
. It's been a few hours now and I can't find the solution. Here is my code:
channel_names ] ['R', 'G', 'B']
header = openexr.Header(img.shape[1], img.shape[0])
try:
exr_channel_type = Imath.PixelType(_np_to_exr[values.dtype.type])
except KeyError:
raise TypeError('Unsupported numpy type: %s' % str(values.dtype))
header['channels'] = {
n: Imath.Channel(exr_channel_type) for n in channel_names
}
min_and_max_points = Imath.Box2i((0, 0), (dw_height, dw_width))
# header['dataWindow'] = min_and_max_points
header['displayWindow'] = min_and_max_points
print(header)
channel_data = [values[..., i] for i in range(values.shape[-1])]
exr = openexr.OutputFile(filename, header)
exr.writePixels(
dict((n, d.tobytes()) for n, d in zip(channel_names, channel_data)))
exr.close()