#include #include #include #include #include using namespace OPENEXR_IMF_NAMESPACE; using namespace std; using namespace IMATH_NAMESPACE; struct Rgbap { half r; half g; half b; half a; }; void writeRgba1 (const char fileName[],const Rgbap *pixels,int width,int height) { RgbaOutputFile file (fileName, width, height, WRITE_RGBA); file.setFrameBuffer (( Rgba *)pixels, 1, width); file.writePixels (height); } void readRgba1 (const char fileName[],Array2D &pixels,int &width,int &height) { RgbaInputFile file (fileName); Box2i dw = file.dataWindow(); width = dw.max.x - dw.min.x + 1; height = dw.max.y - dw.min.y + 1; pixels.resizeErase (height, width); file.setFrameBuffer (&pixels[0][0] - dw.min.x - dw.min.y * width, 1, width); file.readPixels (dw.min.y, dw.max.y); } int main (int argc, char *argv[]) { int width=1920; int height=1080; //Rgbap pixels[ height* width]; // ->segfault Rgbap* pixels=new Rgbap[ width*height]; for (int u=0;u pixelsA(height,width); //lit une image readRgba1 ("../scene_synthetique/openEXR_depth/Image0001.exr",pixelsA,width,height); //recopie le canal r et génère un dégradé sur le canal g for (int u=0;u