/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions Copyright (C) 2013 Inria This file is part of ALTA. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef EXR_IO_H_ #define EXR_IO_H_ /* * Author: Cyril Soler */ #include #include #include template class t_EXR_IO { public: static bool LoadEXR(const char *filename,int& W,int& H, FType *& pix,int nC=3) { Imf::RgbaInputFile file(filename); Imath::Box2i dw = file.dataWindow(); W = dw.max.x - dw.min.x + 1; H = dw.max.y - dw.min.y + 1; Imf::Array2D pixels; pixels.resizeErase(H, W); file.setFrameBuffer (&pixels[0][0] - dw.min.x - dw.min.y * W, 1, W); file.readPixels (dw.min.y, dw.max.y); pix = new FType[W*H*3] ; switch(nC) { case 3: for(int i=0;i pixels(H,W); /* Convert separated channel representation to per pixel representation */ switch(nC) { case 3: for (int row=0;row EXR_IO ; #endif