How do I quantize a three-band color image into a color image using logarithmic function in MATLAB

184 views Asked by At

The logarithmic function is I' =C*ln (I+1) (for each band), where I is the original value (0~255), I' is the quantized value, and C is a constant to scale I' into (0~255), and ln is the natural logarithm.

I tried this so far:

C1 = double(C1);
C = 0;
I = (C*log(1+C1));
image(I);
figure;

And the result is a black image.

1

There are 1 answers

0
jodag On BEST ANSWER

You have set C=0 then multiplied by C. Instead, compute C by considering the maximum value the resulting image and making sure it scales to 1.

I = log(C1+1);
C = 1/max(I(:));
I = C*I;
image(I);