How would I create a function to return a Look-up table containing the transfer function for increasing/decreasing the brightness of an image in a given amount?

I am trying to create a function that returns a Look-up table containing the transfer function for increasing/decreasing brightness as follows;
if inputvalue < -c
outputvalue = 0
else if inputvalue > 255 - c
outputvalue = 255
else
outputvalue = inputvalue + c
Here is my attempt...
function Lut = brightnessLUT(c)
Lut = 1:256;
if c < 0
Lut = 0;
else if c > 255
Lut = 1:256;
else
Lut = 1:c;
end
Lut = uint8(Lut);
end
Would this be correct? When I use another function I to enhance an inputted image with the amount of c it doesn't seem to affect the brightness at all and the inputted image just stays the same. Any help would be great.
function Iout = enhanceBrightness(Iin,c)
Lut = brightnessLUT(c);
Iout = intlut(Iin,Lut);
end

Answers (0)

Products

Asked:

on 20 Feb 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!