Load an hdr image

Hi forum,

Do i have to do something specific to load an .hdr (High Dynamic Range) image. I did as follows:

//--------------------------------------------------------------
void ofApp::setup()
{
   image.loadImage("Newport_Loft_Ref.hdr");
}

//--------------------------------------------------------------
void ofApp::draw()
{
   ofBackground(128,128,128);

   image.draw(100,50);
}

But i am getting the following warning

[warning] ofGLRenderer: drawing an unallocated texture

and i do not get to see the image.

Is there anything missing in the process ?

Thanks

FreeImage should be able to load 48-bit HDR Images. Is your Image not corrupted? Can you open it with an Image Viewer? Have you put it in the bin/data folder? Is the Filename correct?

I already tried to open it with the display command in Ubuntu and i can see the image. I also did already put the image in the correct path , but the problem still persists.

Shot in the dark - don’t you have to apply a tone mapping in order to display HDR images (see appendix p.39 of FreeImage documentation; also see this old discussion)?

Thanks !

Am i supposed to get the following error if i just try to load the hdr image ?

 [ error ] ofImage: putBmpIntoPixels(): unable to set ofPixels from FIBITMAP 

I am doing the following to load an hdr image:

void ofApp::setup()
{
   image.loadImage("Newport_Loft_Ref.hdr");
}

Am i missing anything ?

Thanks

Going of off @asper suggestions, have you tried downloading alternative HDR images from the web and then trying to load those? Do they all report and ofImage error?

No, I would not expect that loading an HDR image would break ofImage.

I tried with several images from the following link :

http://www.pauldebevec.com/Probes/

And all of them returns the same error while loading them.

Maybe try another source for images, not just one website. If the problem persists, you know something is wrong with the code.

@sajjad, hmm. My machine had similar problems with that source and with another source I tried.

It might be the way ofImage is set up to interface with FreeImage. You could try hacking ofImage to see if you can map any progress that way. I’d take a look at the FreeImage documentation if you decide to go that route. And I’d point you towards that old discussion again, to give you an idea of what functions to use.

Or, you might try playing around with image conversions or googling tone mapping. I was able to load an HDR that was tone mapped into a 16bit PNG. I used Photoshop to tone map, though I’m sure there’s software out there better suited for tone mapping.