I am changing the image brightness for an indexed image in MATLAB. For that I created m
, a 3x256 ones matrix, then I multiply it with a number, then I add m
to x
(the map for my image). My question now how to return one if the result is bigger than one.
[im3,x]=imread('corn.tif');
m=ones(256,3)
m=m.*50
[im33 c]=deal(im3,x+m)
Setting values in the array
x
larger than the valuea
toa
is variously called clamping, clipping or saturating. The simplest method is usingmin
:For example, given your color map
x
: