I know this is possible … I am trying to read in a 32bit monochrom tiff. This means that each pixel is a floating point number. OF usually treats 32bit images as RGBA so I am not sure how to exactly get the floats out as opposed to particular color channels.
I have tried this but received mostly garbage:
ofImage dem;
[...]
dem.loafImage("vulcano.tif");
//dem.type is recognized as RGBA
float* demdata = (float*)dem.getPixels();
float first = *demdata;
float second = *(demdata+1);
float thirdofsecondline = *(demdata+dem.width+2);
we currently treat all image coming in as G, RGB, and RGBA. unfortunately, because we try to keep the data you get back consistent across LSBF (least significant byte first) and MSBF platforms (RGB vs BRG), likely what is happening is the data is getting loaded in and the the first and third byte are getting swapped, which makes the floating point number incomprehensible. You could likely either (a) comment out the RGB/BGR swap, or (b)take the ofImage class from here (which we release later today) :
and “extend” it, because all of the code has been written to be extendable now (variables labeled as protected vs. private) and add another image type (FLOATING POINT) which skips the BGRA->RGBA transformation.