Outils pour utilisateurs

Outils du site


openexr

Ceci est une ancienne révision du document !


http://www.openexr.com/downloads.html

on doit pouvoir installer depuis les paquets

apt-cache search exr | grep open
  libopenexr-dev - Fichiers de développement pour la bibliothèque d'images OpenEXR
  libopenexr22 - Fichiers d'exécution pour la bibliothèque d'images OpenEXR
  openexr-doc - documentation and examples for the OpenEXR image format
  libopenimageio-dev - Bibliothèque pour lire et écrire des images - développement
  libopenimageio1.6 - Bibliothèque pour lire et écrire des images - binaires
  openexr - command-line tools for the OpenEXR image format
  openexr-viewers - visualiseur pour images au format OpenEXR
  openimageio-tools - Library for reading and writing images - command line tools
  libopenimageio-doc - Library for reading and writing images - documentation
  python-openimageio - Library for reading and writing images - Python bindings
  

a la main

pour compiler le viewer

ajouter -lGL a la ligne link qui foire car il n'a pas trouvé cg

dans bvandepo@rapid:~/Téléchargements/blenderjessica/openexr_viewers-2.2.0/exrdisplay

./exrdisplay ../../scene_synthetique/openEXR_depth/image_depth/out.exr0001.exr

./exrdisplay ../../scene_synthetique/openEXR_depth/image_depth/Image0001.exr

image qui marche mais il faut réduire l'exposure à 6.5

le plan le plus proche est à 6.9

 ./exrdisplay ../../scene_synthetique/openEXR_depth/Image0001.exr 

doc sur l'utilisation de la librairie (exemples…):

evince ~/Téléchargements/blenderjessica/openexr-2.2.0/doc/ReadingAndWritingImageFiles.pdf 

programme de test simple

test.cpp
#include <ImfRgbaFile.h>
#include <ImfTiledRgbaFile.h>
#include <ImfArray.h>
#include <stdio.h>
#include <assert.h>
 
 
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<Rgba> &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<width;u++)
for (int v=0;v<height;v++)
{
pixels[u+v*width].r=(half)u;
pixels[u+v*width].g=(half)v;
pixels[u+v*width].b=(half)0;
pixels[u+v*width].a=(half)0;
}
 
Array2D<Rgba> 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<width;u++)
for (int v=0;v<height;v++)
{
pixels[u+v*width].r=pixelsA[v][u].r;
pixels[u+v*width].g=(half)v;
pixels[u+v*width].b=(half)0;
pixels[u+v*width].a=(half)0;
}
//affiche dans la console la valeur du pixel central
cout <<"val: "<< pixelsA[1080/2][1920/2].r << endl;
//écrit le fichier modifié
writeRgba1 ("titi.exr",pixels,width,height );
}

pour compiler

rm test
g++ -o test.o -c  test.cpp -I /usr/include/OpenEXR/
g++ -o test test.o -L/usr/lib/x86_64-linux-gnu/ -lIlmImf -lHalf
../openexr_viewers-2.2.0/exrdisplay/exrdisplay ./titi.exr 
openexr.1474037800.txt.gz · Dernière modification : 2016/09/16 16:56 de bvandepo