clear
clc
in = imread('lena.jpg');
tmp = input('增强灰度值:');
gama = input('增强γ值:');
out1 = in + tmp;
out_1 = (double(in)/255).^gama;
out2 = uint8(255*out_1);
tmp_1 = num2str(tmp);
gama_1 = num2str(gama);
figure('NumberTitle', 'off', 'Name', '原图'),imshow(in);
figure('NumberTitle', 'off', 'Name', '线性增强效果图'),imshow(out1);
figure('NumberTitle', 'off', 'Name', '非线性增强效果图'),imshow(out2);
str1 = strcat(gama_1,'.bmp');
str12 = 'γ值';
str11 = strcat(str12,str1);
imwrite(out2,str11);
tt = num2str(tmp);
ttt = strcat(tt,'.bmp');
imwrite(out1,ttt);