I am working with OpenImage Denoiser, which loads EXR files using OpenImageIO.
Images are loaded like so:
std::shared_ptr<ImageBuffer> loadImageOIIO(const std::string& filename, int channels)
{
auto in = OIIO::ImageInput::open(filename);
if (!in)
throw std::runtime_error("cannot open image file: " + filename);
const OIIO::ImageSpec& spec = in->spec();
if (channels == 0)
channels = spec.nchannels;
else if (spec.nchannels < channels)
throw std::runtime_error("not enough image channels");
auto image = std::make_shared<ImageBuffer>(spec.width, spec.height, channels);
if (!in->read_image(0, 0, 0, channels, OIIO::TypeDesc::FLOAT, image->getData()))
throw std::runtime_error("failed to read image data");
in->close();
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(in);
#endif
return image;
}
However, this crops the image to the bounding box of the data window. Because my image has 0 values, this image is smaller than the actual input image.
How can I get an ImageBuffer with the full resolution of the Display window?