Skip to main content

Handling negative values in LookupTableJAI

2 replies [Last post]
shrieky
Offline
Joined: 2007-11-26
Points: 0

Hi All,
I am trying to enhance images using LookupTableJAI. It is working perfectly for 8bit data (BYTE images).
When it comes to FLOAT (32 bit images) , iam confused how to make a lookuptable , as they may contain negative values (Ex : -29.348).
My understanding of a lookup table is
Lookup[grey_value_pixel] = mapping_grey_val ;
So i cannot make a lookup for the above cases Viz Lookup[-29.348] is not possible. I have also used offset option given for float in LookupTableJAI , but that dint work either.

My code looks like

if(this.dataType == DataBuffer.TYPE_FLOAT) {
float[][] lookupFloat = new float[srcHistogram.getNumBands()][];
for (int j = 0; j < srcHistogram.getNumBands(); j++) {
lookupFloat(j) = new float[srcHistogram.getNumBins(j)];
for (int i = val; i < srcHistogram.getNumBins(j); i++) {
lookupFloat(j)(i) = (float)TempBins(j)(i); (used () instead [] as html takes it other way)
}
}
int[] offset=new int[srcHistogram.getNumBands()];
for(int i=0;i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Fork Labs

Hello Shrieky,

You could always rescale the float image between [0 .. max] and then
change the type to BYTE, SHORT, USHORT, INT or LONG before applying
the lookup table.

Regards,

Daniel Léonard

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

shrieky
Offline
Joined: 2007-11-26
Points: 0

Hi Leonard,
Thanks, that is a very good solution for it. But doesn't JAI handle this type of cases. What is the purpose of offset provided for int and float value.

As my architecture is designed to display the data from the original image itself , i find it little difficult to handle both bytescaled data and original data from image.

Thanks,
Shrieky