|
From: | David Kuťák |
Subject: | [Openexr-devel] OpenEXR - lossless compression problems |
Date: | Sat, 3 Dec 2016 20:40:10 +0100 |
Hello, I am currently working on my bachelor thesis in which I am comparing image compression algorithms (available in different image file formats). For my work, only file formats supporting lossless compression and 16 bit depth are appropriate. During my exploration of possible formats, I found an OpenEXR and decided to include it in my tests. However, I am not able to make it work properly. The input image and output image (created during compression) are not same – the colors seem to be different (shifted). I thought it might be gamma problem but even after gamma correction, I am not able to retrieve correct output image. Although visually the image seems to be very close to the input one (after gamma correction), there is still a minor difference which is unacceptable. So I’d like to ask you for a help – what I am doing is written below (some undefined wars like imageWidth, etc. are correct for sure). 1) I create my output file RgbaOutputFile outputFile(argv[3], imageWidth, imageHeight, WRITE_RGB, 1.0f, V2f(0, 0), 1.0f, INCREASING_Y, compressionType, globalThreadCount()); 2) Then I create a pixelData vector std::vector<Rgba> pixelData(imageWidth * imageHeight); 3) I fill this vector with data retrieved from my test images (these data are pixel values (i.e. numbers from interval <0,255/65535> – depending on bit depth – which I normalize to inverval <0,1.0> and pass to half ctor and then as an Rgba struct to appropriate pos in pixelData vector). 4) Then I set framebuffer and write pixels to file (shown in code below). I think that my problem occurs somewhere in those two methods (EXR must be doing some operations with pixel data). outputFile.setFrameBuffer(pixelData.data(), 1, imageWidth); outputFile.writePixels(imageHeight); To sum up my problem – is this the correct way to pass image data to OpenEXR and retrieve the same image (but in EXR format)? I really don’t know why the color problem appears. Another question I’d like to ask is that I got the idea that the compression is done in writePixels method. Is that’s right? If it’s true, is there any possibility to compress image in memory without writing it to file? Thank you for your help! David |
[Prev in Thread] | Current Thread | [Next in Thread] |