Wednesday, November 28, 2012

Matlab: map an image with lookup table

Suppose we have a lookup table (lut.txt) look like (two columns):

0     0
1     0.0005
2     0.0006
3     0.002
.
.
254   0.981
255   1

Only save the 2nd column to LUT0.txt:

0
0.0005
.
.
0.981
1

matlab code:

load LUT0.txt;
img_gamma = LUT0(im2uint8(InputImage)+1);

No comments:

Post a Comment