Assigning luminance Y to color R for writing single-channel EXR files with OpenCV-Python

90 Views Asked by At

I am processing texture maps for Unreal Engine 5 with OpenCV-Python, but I've encountered a problem with single-channel 16-bit EXR images, e.g. opacity mask maps, that are saved with only a Y luminance channel. UE5 does not read the Y channel, which results in a black image. However, it will read single-channel EXRs with just an R, G, or B channel. I want to convert the Y channel of these EXRs and save them with only R without storing G and B channels in the metadata. If only a single channel is loaded, imwrite() will save an EXR with just Y in the metadata.

I have tried merging empty numpy arrays for G and B, and while this is better than copying R into G and B, this still results in a larger file than just storing a single channel. Are there any ways to achieve writing an EXR with just R with OpenCV?

0

There are 0 best solutions below