5YrsLaterDBA
5YrsLaterDBA

Reputation: 34840

Lookup table in JAI

I am looking at an existing Java CT image display program here. I try to understand how the Lookup Table works in JAI.

From the JAI guide, section 7.6, I read this:

The input pixel values acts as an address to the lookup table inputs. Each location in the lookup table stores the desired output value for that particular address.

We only need grey scale display, so we have a lookup table of size 256. But the input pixel values which are our original image pixels can be negative sometimes. Then how can I use them as index/address?

I can shift the data to make sure all values are positive but I will lose the original data values then.

Upvotes: 1

Views: 257

Answers (1)

Joni
Joni

Reputation: 111389

I would be surprised if JAI would actually try to use a negative pixel value directly as an index. I would expect it to at least use unsigned-conversion (i.e. pixel&255) when indexing.

If JAI doesn't do the right thing I think you can create the lookup table with a negative offset, like -128, so that negative pixels are looked up in the first half of the table and positive ones in the second half.

Upvotes: 1

Related Questions