By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,835 Members | 1,951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,835 IT Pros & Developers. It's quick & easy.

Adjusting brightness in images using JAI lookup tables

P: n/a
Amy
Hi,

I have written a program using JAI for a project I am doing which can
be used to adjust the brightness of an image. It all works fine but I
now need to write it all up and am not entirely sure what it is doing.

The code is below:

public void adjustLight(int ipParam){ // ipParam = 18
pb = new ParameterBlock();
pb.addSource(image);
byte lookUpTableData[];
lookUpTableData = new byte[256];
for(int j = 0; j < 256; j++){
lookUpTableData[j] = clampByte(j + ipParam);
}

LookupTableJAI lookUp = new LookupTableJAI(lookUpTableData);
pb.add(lookUp);

image = JAI.create("lookup", pb, null);
tellObservers();
}

private final byte clampByte(int i){
if(i > 255)
return -1;
if(i < 0)
return 0;
else
return (byte)i;
}

I am unsure about what the clampByte method is doing and was a bit
confused by the lookup operation.

If anyone could help I would be very grateful. Thank you.

Amy
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.