数字图像处理_图像的点运算和直方图课后习题

实现密茨变换,调整gamma数值,观察图像变化,分析lena图像在不同gamma数值下,图像灰度变化的特点

%幂次变换公式----C*(img .^ X)


A1 = imread('D:\Program\test_matlab\lena.jpg'); 
A = im2double(A1);

subplot(2,2,1);
imshow(A1);
title('raw');

C = 1
X = 0.5
A2 = C*(A .^ X)

% 图像加亮,减暗

subplot(2,2,2);
imshow(A2);
title(['C:',num2str(C),'  X:',num2str(X)])

C = 1
X = 1.5
A3 = C*(A .^ X)

subplot(2,2,3);
imshow(A3);
title(['C:',num2str(C),'  X:',num2str(X)])

% 图像减亮,加暗

C = 1
X = 2
A4 = C*(A .^ X)

subplot(2,2,4);
imshow(A4);
title(['C:',num2str(C),'  X:',num2str(X)])

% 图像减亮,加暗

 


%imadjust()

B = A1;

G = 1
B1 = imadjust(B,[0.3,0.5],[0,1],G)  %<255*0.3的置为0;>255*0.5的置为255,garmma=1
figure;subplot(2,2,1);              %图片对比度增大,灰度扩展
imshow(B1);
title(['G:',num2str(G)])

G=2
B2 = imadjust(B,[0.3,0.5],[0,1],G)  %图片相对B1,降低亮度
subplot(2,2,2);
imshow(B2);
title(['G:',num2str(G)])

G=0.5
B3 = imadjust(B,[0.3,0.5],[0,1],G)     %图片相对B1,增加亮度
subplot(2,2,3);
imshow(B3);
title(['G:',num2str(G)])


%直方图  imhist()

imshow(A1);
title('source');

figure;
subplot(221);imhist(A1,2);   %n缺省的话默认255
subplot(222);imhist(A1,5);
subplot(223);imhist(A1,10);
subplot(224);imhist(A1);

figure;
subplot(121); imhist(A1,10)
[count,x] = imhist(A1,10)
subplot(122);stem(x,count);

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值