LookupOp.filter

I'm working on RGB BufferedImage objects. From what I've seen the filter method in LookupOp only operates on all three channels. Is it possible to apply the filter to one channel (e.g. red) only?Thanks,Dane
[229 byte] By [east75th] at [2007-9-27 20:57:18]
# 1

According to the API documentation of LookupOp, if there are as many bands (channels) in the LookupTable as there are color components (not including alpha), LookupOp applies each of the bands of the LookupTable to the corresponding color channel.

Hence if you'd like to filter only one channel, just construct a multi-channel LookupTable in which the irrelevant channels have identity mappings (i.e., output the same values as inputs). For example,

byte[][] table = new byte[3][256];

for (int i = 0; i < 256; i++) {

table[0][i] = mapRed(i); // Your red channel mapping here

table[1][i] = i; // Don't alter green channel

table[2][i] = i; // Don't alter blue channel

}

ByteLookupTable lookupTable = new ByteLookupTable(0, table);

...

jccwei at 2007-7-7 2:37:11 > top of Java-index,Security,Cryptography...