数字图像处理 -灰度变换 之 gamma变换(gamma transformation)

Reference: https://blog.csdn.net/zhoufan900428/article/details/12709361 

The gamma transformation is different from log transformation. Its code is similar to that of the last blog. Its figure is as follows: 

Figure :


gamma transformation  Matlab code:

f = imread('2.jpg');  
I=rgb2gray(f);
f = mat2gray(I);

gamma1 = 0.1;
g_0_1 = f.^gamma1; 
gamma2 = 0.2;
g_0_2 = f.^gamma2; 
gamma3 = 0.4;
g_0_4 = f.^gamma3;
gamma4 = 0.6;
g_0_6 = f.^gamma4;
gamma5 = 0.8;
g_0_8 = f.^gamma5; 
gamma6 = 1;
g_1 = f.^gamma6;  
gamma7 = 2.5;
g_2_5 = f.^gamma7; 
gamma8 = 5;
g_5 = f.^gamma8; 
  
figure();  
subplot(3,3,1);  
imshow(f,[0 1]);  
xlabel('a).Original Image');  

subplot(3,3,2);  
imshow(g_0_1,[0 1]);  
xlabel('b).\gamma =0.1'); 

subplot(3,3,3);  
imshow(g_0_2,[0 1]);  
xlabel('c).\gamma =0.2'); 

subplot(3,3,4);  
imshow(g_0_4,[0 1]);  
xlabel('d).\gamma=0.4'); 

subplot(3,3,5);  
imshow(g_0_6,[0 1]);  
xlabel('e).\gamma=0.6'); 

subplot(3,3,6);  
imshow(g_0_8,[0 1]);  
xlabel('f).\gamma=0.8');  
  
subplot(3,3,7);  
imshow(g_1,[0 1]);  
xlabel('g).\gamma=1 i.e. original image');  
  
subplot(3,3,8);  
imshow(g_2_5,[0 1]);  
xlabel('h).\gamma=2.5'); 

subplot(3,3,9);  
imshow(g_5,[0 1]);  
xlabel('i).\gamma=5'); 

Figure :


we can see that if gamma <1, the gray level becomes brighter, otherwise, it is darker. It is obvious to know if we connect this figure with the last figure, namely, the gamma image.  

I make some improvements on the basis of the original blog. https://blog.csdn.net/zhoufan900428/article/details/12709361 Thanks again.

Due to level constraint, please comment if you ave any questions about this blog. I would greatly appreciate it if you kindly give me some feedback.
^_^


  

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值