精华内容
下载资源
问答
  • MATLAB非线性灰度变换,只要是对数变换,以增强图像的显示效果
  • Matlab 图像增强(对数变换

    万次阅读 多人点赞 2019-03-21 11:30:46
    图像对数变换: 通过灰度变换函数,调整输入低质图像灰度值范围。将图像的低灰度值部分扩展,高灰度值部分压缩。借此强调图像灰度部分,达到增强图像的目的。 该法用于图像增强的原理: 显示器无法显示...

    图像的对数变换:

    通过灰度变换函数,调整输入低质图像的灰度值范围。将图像的低灰度值部分扩展,高灰度值部分压缩。借此强调图像低灰度部分,达到增强图像的目的。

    该法用于图像增强的原理:

    显示器无法显示大范围灰度值时,许多灰度细节会被丢失掉,

    对数变换可将其动态范围变换到一个合适的区间,就可以显示更多细节。

    下面先介绍冈萨雷斯《数字图像处理》中设计的方法,我认为对图像的灰度提高的过于明显。

    对数变换公式:S=c log(1+r) , c为常数。

    f = imread('lena.png');  
    
    G=mat2gray(log(1+double(f))); 
    % matlab中数值一般采用double型(64位)存储和运算。mat2gray对图像灰度进行归一化处理
    
    subplot(1,2,1);  
    imshow(f);  
    xlabel(' a). 原始图像');  
    subplot(1,2,2);  
    imshow(I2,[]);   % 自动调整数据的范围以便于显示 
    xlabel(' b). 对数变换');  
    end
    

    运行结果:

    下面介绍另一种方法,参考:[数字图像处理]灰度变换

    对数变换公式:, c为常数,

    v越大,灰度提高越明显,r为灰度归一化后的输入图像。

    f = imread('lena.png');  
    
    v=10;
    r=mat2gray(double(I));
    S=log(1+v*r)/(log(v+1));
    
    subplot(1,2,1);  
    imshow(I);  
    xlabel('a). 原始图像');  
    subplot(1,2,2);  
    imshow(S,[]);  
    xlabel('b). 对数变换');  
    end
    

    运行结果:

    这个感觉比较自然一点。

     

    展开全文
  • 本文参考了 以下这篇文章[数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割 https://blog.csdn.net/zhoufan900428/article/details/12709361并进行了一下改进。以上为上述文章 的...
    本文参考了 以下这篇文章

    [数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割 

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

    并进行了一下改进。



    以上为上述文章 的原话,这里展示出对数变换的code 和 figure,

    Matlab Code:

    f = 0:0.01:1;
    v1 = 1;
    y1 = log2(1 + v1*f)/log2(v1+1); 
    v2 = 10;
    y2 = log2(1 + v2*f)/log2(v2+1); 
    v3 = 50;
    y3 = log2(1 + v3*f)/log2(v3+1); 
    v4 = 100;
    y4 = log2(1 + v4*f)/log2(v4+1); 
    v5 = 200;
    y5 = log2(1 + v5*f)/log2(v5+1); 
    plot(f,y1,'g',f,y2,'r',f,y3,'b',f,y4,'c',f,y5,'y');
    xlabel('Input gray level');
    ylabel('Output gray level');
    title('Log transformation: g = log(1+v*r)/log(1+v)');
    
    lgd = legend('Log(v=1)','Log(v=10)','Log(v=50)','Log(v=100)','Log(v=200)');
    legend('Location','southeast');
    title(lgd,'The Legend Title')

    Figure:


    从图中我们可以很直观的看出,由于对数本身上凸的性质,它可以把低灰度(较暗)部分的亮度提高,v 越大,灰度提高越明显,即图像越来越亮。

    以下是改进后的对数变换代码,将4个对比图形放在同一张图内,看起来更直观。

    f = imread('2.jpg');  
    I=rgb2gray(f);
    f = mat2gray(I);% 原代码中的[0 255] 可以去掉,因为f中最大最小值等于0, 255
    
    v = 10;  
    g_1 = log2(1 + v*f)/log2(v+1);  
      
    v = 30;  
    g_2 = log2(1 + v*f)/log2(v+1);  
      
    v = 200;  
    g_3 = log2(1 + v*f)/log2(v+1);  
      
    figure(); %这里改成了四个子图,会更加直观  
    subplot(2,2,1);  
    imshow(f,[0 1]);  
    xlabel('a).Original Image');  
    subplot(2,2,2);  
    imshow(g_1,[0 1]);  
    xlabel('b).Log Transformations v=10');  
      
    subplot(2,2,3);  
    imshow(g_2,[0 1]);  
    xlabel('c).Log Transformations v=100');  
      
    subplot(2,2,4);  
    imshow(g_3,[0 1]);  
    xlabel('d).Log Transformations v=200');  

    figure:


    再次感谢 这篇文章在学习这部分内容时提供的帮助。https://blog.csdn.net/zhoufan900428/article/details/12709361



    展开全文
  • 采用对数变换法增强灰度图像对比度,已用Matlab编译出结果。但是要求在CCS中用C语言完成任务,如今读取图像部分和直方图均衡化部分已经完成,如何才能把对数增强的Matlab语言转换成C语言呢?
  • 如有帮助欢迎支持 图形图像处理课程 大作业 姓名 班级 学号 1 如有帮助欢迎支持 目录 界面编程实现图像灰度变换1 摘 要2 正 文3 1.MATLAB界面编程简介3 2.图像灰度变换简介3 3.采用MATLAB Guide设计界面4 3.1 问题...
  • 在Windows操作系统下的MATLAB2019b应用程序中编写程序,待程序调试完成后,通过选取相同尺寸、不同质量的三幅图像分别利用变换函数(线性函数、对数函数)和直方图均衡化方法进行灰度变换来探究基于灰度变换图像...

    图像灰度变换的计算机实现

    灰度变换是指根据某种目标条件按一定变换关系逐点改变源图像中每一个像素灰度值的方法。目的是为了改善画质,使图像的显示效果更加清晰。 图像的灰度变换处理是图像增强处理技术中的一种非常基础、直接的空间域图像处理方法,也是图像数字化软件和图像显示软件的一个重要组成部分。

    Part.0Part.0 实验目的^{仅限于学习交流}

    1. 熟悉图像灰度变换的理论;
    2. 掌握空域法进行数字图像灰度变换的原理;
    3. 学习VC++ 6.0/matlab的编程方法;
    4. 验证直方图均衡化处理理论;

    Part.1Part.1 实验内容^{仅限于学习交流}

    1. 掌握高级语言编程技术;
    2. 选取相同尺寸、 不同质量的多幅图像(至少两幅)利用变换函数(可根据情况采用指数函数、 对数或线性函数等)和直方图均衡化方法进行灰度变换;
    3. 分析处理结果。

    Part.2Part.2 实验源代码^{仅限于学习交流}

    *代码调试不易。转载请标明出处,谢谢!

    % 日期 20201218% 主题 实验二:图像灰度变换
    % 要求 
    %       1)掌握高级语言编程技术;
    %       2)选取相同尺寸、不同质量的多幅图像(至少两幅)
    %          利用变换函数(可据情况采用指数函数、对数或线性函数等)和
    %          直方图均衡化方法进行灰度变换;
    %       3)分析处理结果。
    
    % Matlab相关语句语法:
    % J = imadjust(I);         % 调整图像强度值或颜色映射
    % J = imadjust(I,[low_in; high_in],[low_out; high_out]);
    % J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma);
    % 
    % IM2 = imcomplement(IM);  % 补码图像
    % % 如果im是double类的灰度或rgb图像,则可以使用表达式1-im代替此函数。
    % % 如果im是二进制图像,则可以使用表达式~im代替此函数。
    % 
    % I2 = im2uint8(I);  % 将图像转换为8位无符号整数
    % 
    % % 将矩阵转换为灰度图像
    % I = mat2gray(A, [amin amax]);  
    % % amin和amax是a中与i中的0.01.0相对应的值。
    % % 小于amin的值变为0.0,大于amax的值变为1.0% I = mat2gray(A);  
    % % 将amin和amax的值设置为a中的最小值和最大值。
    
    clear;clc;close all
    
    %% NO.1 小男孩
    T = imread('pout.tif');
    try
        T=rgb2gray(T);    % 如果是RGB图像,转成灰度图
    catch
        % 否则,不做变换
    end
    T_imadjust = imadjust(T);
    % imadjust通过将输入强度图像的值映射到新值来增加图像的对比度,
    % 默认情况下,1%的数据在输入数据的低强度和高强度下饱和。
    % T_imadjust1 = imadjust(T,[0 1],[0.5 0.75]);   % 调整图像颜色映射 = Black-white
    % T_imadjust2 = imadjust(T,[0; 1],[0.5; 1],5);  % 调整图像强度值或颜色映射
    T_imadjust3 = imcomplement(T);  % 补码图像
    T_imadjust4 = im2uint8(mat2gray(log(1+double(T)))); % 灰度对数变换
    T_histeq = histeq(T);
    % histeq执行直方图均衡化。它通过变换亮度图像中的值来增强图像的对比度,
    % 使输出图像的直方图与指定的直方图近似匹配(默认为均匀分布)。
    % T_adapthisteq = adapthisteq(T);
    % AdapterHisEQ执行对比度受限的自适应直方图均衡化。
    % 与histeq不同,它对小数据区域(tiles)而不是整个图像进行操作。
    % 每个直方图的均匀分布与每个直方图的对比度大致匹配。为了避免放大图像中可能存在的噪声,可以限制对比度增强。
    figure,set(gcf,'outerposition',get(0,'screensize')); % figure窗口最大化
    subplot(3,4,1),imshow(T),title('[原始图像]');  
    subplot(3,4,2),imhist(T),title('[对应直方图]');
    subplot(3,4,5),imshow(T_imadjust3),title('[补码图像]');  
    subplot(3,4,6),imhist(T_imadjust3),title('[对应直方图]');
    subplot(3,4,9),imshow(T_imadjust),title('[线性灰度变换]');  
    subplot(3,4,10),imhist(T_imadjust),title('[对应直方图]');
    
    subplot(3,4,3),imshow(T),title('[原始图像]');  
    subplot(3,4,4),imhist(T),title('[对应直方图]');
    subplot(3,4,7),imshow(T_imadjust4),title('[对数灰度变换]');  
    subplot(3,4,8),imhist(T_imadjust4),title('[对应直方图]');
    subplot(3,4,11),imshow(T_histeq),title('[直方图均衡化]');  
    subplot(3,4,12),imhist(T_histeq),title('[对应直方图]');
    
    %% NO.2 轮胎
    T = imread('tire.tif');
    try
        T=rgb2gray(T);    % 如果是RGB图像,转成灰度图
    catch
        % 否则,不做变换
    end
    T_imadjust = imadjust(T); % 线性灰度变换
    T_imadjust3 = imcomplement(T);  % 补码图像
    T_imadjust4 = im2uint8(mat2gray(log(1+double(T)))); % 对数变换
    T_histeq = histeq(T); % histeq执行直方图均衡化
    
    figure,set(gcf,'outerposition',get(0,'screensize')); % figure窗口最大化
    subplot(3,4,1),imshow(T),title('[原始图像]');  
    subplot(3,4,2),imhist(T),title('[对应直方图]');
    subplot(3,4,5),imshow(T_imadjust3),title('[补码图像]');  
    subplot(3,4,6),imhist(T_imadjust3),title('[对应直方图]');
    subplot(3,4,9),imshow(T_imadjust),title('[线性灰度变换]');  
    subplot(3,4,10),imhist(T_imadjust),title('[对应直方图]');
    
    subplot(3,4,3),imshow(T),title('[原始图像]');  
    subplot(3,4,4),imhist(T),title('[对应直方图]');
    subplot(3,4,7),imshow(T_imadjust4),title('[对数灰度变换]');  
    subplot(3,4,8),imhist(T_imadjust4),title('[对应直方图]');
    subplot(3,4,11),imshow(T_histeq),title('[直方图均衡化]');  
    subplot(3,4,12),imhist(T_histeq),title('[对应直方图]');
    
    %% NO.3 
    I = imread('car_3.jpg');
    try
        T=rgb2gray(I);    % 如果是RGB图像,转成灰度图
    catch
        T = I; % 否则,不做变换
    end
    T_imadjust = imadjust(T); % 线性灰度变换
    T_imadjust3 = imcomplement(T);  % 补码图像
    T_imadjust4 = im2uint8(mat2gray(log(1+double(T)))); % 对数变换
    T_histeq = histeq(T); % histeq执行直方图均衡化
    
    figure,set(gcf,'outerposition',get(0,'screensize')); % figure窗口最大化
    subplot(3,4,1),imshow(T),title('[原始图像]');  
    subplot(3,4,2),imhist(T),title('[对应直方图]');
    subplot(3,4,5),imshow(T_imadjust3),title('[补码图像]');  
    subplot(3,4,6),imhist(T_imadjust3),title('[对应直方图]');
    subplot(3,4,9),imshow(T_imadjust),title('[线性灰度变换]');  
    subplot(3,4,10),imhist(T_imadjust),title('[对应直方图]');
    
    subplot(3,4,3),imshow(T),title('[原始图像]');  
    subplot(3,4,4),imhist(T),title('[对应直方图]');
    subplot(3,4,7),imshow(T_imadjust4),title('[对数灰度变换]');  
    subplot(3,4,8),imhist(T_imadjust4),title('[对应直方图]');
    subplot(3,4,11),imshow(T_histeq),title('[直方图均衡化]');  
    subplot(3,4,12),imhist(T_histeq),title('[对应直方图]');
    
    
    
    

    Part.3Part.3 实验结果及分析^{仅限于学习交流}

    由于噪声、光照等外界环境或设备本身的原因,通常我们所获取的原始数字图像质量不是很高,因此在对图像进行后续分析处理之前,一般都需要对原始数字图像进行增强处理。通过图像灰度变换,一方面可以改善图像的视觉效果,另一方面也能突出图像的特征,便于计算机更有效地对图像进行识别和分析。图像增强按所用方法可分成频率域法和空间域法。前者把图像看成一种二维信号,对其进行基于二维傅里叶变换的信号增强。采用低通滤波(即只让低频信号通过)法,可去掉图中的噪声;采用高通滤波法,则可增强边缘等高频信号,使模糊的图片变得清晰。具有代表性的空间域算法有局部求平均值法和中值滤波(取局部邻域中的中间像素值)法等,它们可用于去除或减弱噪声。
    基于空域的算法分为点运算算法和邻域去噪算法。点运算算法即灰度级校正、灰度变换和直方图修正等,目的或使图像成像均匀,或扩大图像动态范围,扩展对比度。邻域增强算法分为图像平滑和锐化两种。平滑一般用于消除图像噪声,但是也容易引起边缘的模糊。常用算法有均值滤波、中值滤波。锐化的目的在于突出物体的边缘轮廓,便于目标识别。常用算法有梯度法、算子、高通滤波、掩模匹配法、统计差值法等。
    亮度的最大值与最小值之比称为对比度,通过提高图像的视觉效果可以达到增强图像的目的。有些图像的对比度很差,例如X光照片或卫星多光谱图像。因此,需要对图像中的每一个像素的灰度进行灰度标尺变化,扩大图像的灰度范围,达到增强的目的。这是对图像视觉效果改善行之有效且相对简单的方法。实验二在Windows操作系统下的MATLAB2019b应用程序中编写程序,待程序调试完成后,通过选取相同尺寸、不同质量的三幅图像分别利用变换函数(线性函数、对数函数)和直方图均衡化方法进行灰度变换来探究基于灰度变换的图像增强效果及其相应的直方图变换情况。程序运行结果如下图所示:

    图1-1 “boy”图像的灰度变换及其直方图均衡化

    图1-1 “boy”图像的灰度变换及其直方图均衡化

    图1-2 “轮胎”图像的灰度变换及其直方图均衡化

    图1-2 “轮胎”图像的灰度变换及其直方图均衡化

    图1-3 “车库”图像的灰度变换及其直方图均衡化

    图1-3 “车库”图像的灰度变换及其直方图均衡化

    当图像由于成像时曝光不足或过度,由于成像设备的非线性或图像记录设备动态范围太窄等因素,都会产生对比度不足从而使图像中的细节分辨不清。这时如将图像灰度线性变换、对数缩放或直方图均衡化,常能显著改善图像的主观质量。图2-1中原始图像灰度范围太窄,通过灰度等级调整使得图像的视觉效果更佳,更清晰。图2-2、2-3中图像灰度失衡,通过调整后图像的细节更加突显。视觉效果好了很多, 更适合人的视觉特性。
    因此图像灰度变换是通过对原图像素值重新分配实现,目的是使图像中表现较暗(或较亮)的像素值,通过灰度变换函数映射的方法使较暗(或较亮)的像素值增大(减小),这样图像的对比度就提高了细节等特征更加突显。由以上三幅图像可以看出:图像灰度变换函数(线性函数、对数函数)和直方图均衡化等方法的处理结果并非总是令人满意,只有对特定图像尝试不同方法才能得到最佳处理效果;此外图像灰度变换处理并不能使原始图像信息增加,其结果只能增强对某种信息的辨别能力,相反这种处理有可能损失一些其他信息。

    Part.4Part.4 友情链接^{所需相关资源可留言反馈获取}

    1. MATLAB学习索引
    2. GraphPad Prism绘图分析学习记录

    *代码调试不易。转载请标明出处,谢谢!
    如果感觉本文对您有帮助,请留下您的赞,您的支持是我坚持写作分享的最大动力,谢谢!

    References
    [1]阮秋琦.数字图像处理学[M].北京:电子工业出版社, 2001.
    [2]医学影像处理与分析[M]. 电子工业出版社 , 田捷等编著, 2003
    [3]基于MATLAB的系统分析与设计[M]. 西安电子科技大学出版社 , 王晓丹,吴崇明编著, 2000
    [4]朱秀昌, 刘峰, 胡栋.数字图像处理与图像通信[M].北京:北京邮电大学出版社, 2002.
    [5]贾永红.计算机图像处理与分析[M].武昌:武汉大学出版社, 2001.
    [6]何斌, 马天予, 王运坚, 等.Visual c++数字图像处理[M].北京:人民邮电出版社, 2002.
    [7]Venkatesan Rajinikanth,E Priya,Hong Lin,Fuhua Lin. Hybrid Image Processing Methods for Medical Image Examination[M].CRC Press:2020-12-17.
    [8]Ranjan Parekh. Fundamentals of Image, Audio, and Video Processing Using MATLAB®:With Applications to Pattern Recognition[M].CRC Press:2020-12-17.
    [9]Comparison of Edge Detector Performance through Use in an Object Recognition Task[J] . Min C Shin,Dmitry B Goldgof,Kevin W Bowyer. Computer Vision and Image Understanding . 2001 (1)
    [10]A novel zero-crossing edge detectionmethod based on multi-scale space theory. Mengmeng Zhang,Xia Li,Zhihui Yang,Yang Yan g. M Signal Processing (ICS P),2010IEEE10th International Conference . 2010
    [11]医学图像分割算法研究及其在骨分割中的应用[D]. 黄琴波.西安电子科技大学 2011
    [12]刘付桂兰.基于MATLAB图像处理技术及应用[J].科学技术创新,2020(35):64-67.
    [13]一阶边缘检测算法的研究[J]. 朱振伟,刘广瑞,刘巧红. 现代电子技术. 2009(24)
    [14]孙道辉.基于信息融合的图像边缘检测算法实现[J].电子测试,2018(13):53-54.
    [15]李晶晶,王迪,常玲. 基于图像边缘检测算法的应用研究与实现[A]. 中共沈阳市委、沈阳市人民政府、中国农学会.第十三届沈阳科学学术年会论文集(理工农医)[C].中共沈阳市委、沈阳市人民政府、中国农学会:沈阳市科学技术协会,2016:5.
    [16]张慧,冯驰.图像边缘检测算法研究及其MATLAB实现[J].佳木斯职业学院学报,2015(09):330.

    *可以肯定的是学海无涯,这篇文章也会随着对MATLAB的深入学习而持续更新,
    欢迎各位在评论区留言进行探讨交流。

    展开全文
  • 图像灰度变换

    2019-05-07 20:52:13
    MATLAB编写的图像灰度变换,其中所包含的灰度变换由线性变换、对数变换、反转变换、指数变换4中,并由相应的实验结果图片
  • 这是一个小的gui代码。 其中用户可以加载任何灰度图像并使用对数变换增加其亮度并且可以通过使用功率变换来降低亮度。 它还允许用户对任何给定图像进行块(8*8)DCT 变换。
  • 数字图像处理——Matlab GUI与灰度变换函数简介Matlab具有强大的函数运算功能,利用这一点可以进行像素级的计算,也就是图像处理。...对数变换​ 使用方法不允许修改空图片,必须打开一张图片后才能获得修改图片

    数字图像处理——Matlab GUI与灰度变换函数

    简介

    Matlab具有强大的函数运算功能,利用这一点可以进行像素级的计算,也就是图像处理。这款软件基于Matlab平台,用户可以在软件界面中打开需要修改的图片,选择想要变换的效果,通过拖动滑动条可以动态显示修改后的图片效果。

    涉及到的图像处理包括以下三种灰度变换:

    • 二值化

    • 伽马变换

    • 对数变换

    使用方法

    不允许修改空图片,必须打开一张图片后才能获得修改图片的权限。

    打开文件后,面板上显示两张图片,左边的是原图,右边的是原图副本,可以动态显示修改效果。如图:
    这里写图片描述

    其中PhotoProcess包含三个菜单项,分别是

    • BinaryImage:图像二值化处理
    • Gamma Trans:伽马变换
    • Log Trans:对数变换

    下面分别对这三种功能进行演示:

    图像二值化

    这里写图片描述

    其中在子窗口中出现的拖动条可以动态调整二值化阀值(Threshold),这里取值0到1,从而显示出不一样的效果。

    *伽马变换*

    这里写图片描述
    类似二值化功能,这里也有一个拖动条,可以动态调整γ值,我们知道伽马变换的表达式:

    s=crγ

    其中c取1,不再接受变化。

    **对数变换

    这里写图片描述

    对数变换公式:

    s=clogv+1(1+vr)

    保存

    退出的时候如果还未保存将提示是否需要保存。 可选格式为bmp和jpg格式。如图为修改后的图片
    这里写图片描述

    参考资料

    [数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割

    《一个实例搞定matlab界面编程》 https://wenku.baidu.com/view/fdf6ad6925c52cc58bd6be8e.html

    附录:Matlab代码

    DIP.m

    function varargout = DIP(varargin)
    % DIP MATLAB code for DIP.fig
    %      DIP, by itself, creates a new DIP or raises the existing
    %      singleton*.
    %
    %      H = DIP returns the handle to a new DIP or the handle to
    %      the existing singleton*.
    %
    %      DIP('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in DIP.M with the given input arguments.
    %
    %      DIP('Property','Value',...) creates a new DIP or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before DIP_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to DIP_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help DIP
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 16:55:51
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @DIP_OpeningFcn, ...
                       'gui_OutputFcn',  @DIP_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
    
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
    
    
    % --- Executes just before DIP is made visible.
    function DIP_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to DIP (see VARARGIN)
    
    % Choose default command line output for DIP
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    
    % UIWAIT makes DIP wait for user response (see UIRESUME)
    % uiwait(handles.figure_DIP);
    setappdata(handles.figure_DIP,'img_src',0);
    set(handles.photoprocess,'Enable','off');
    setappdata(handles.figure_DIP,'bSave',false);
    setappdata(handles.figure_DIP,'bChanged',false);
    setappdata(handles.figure_DIP,'fstSave',true);
    setappdata(handles.figure_DIP,'fstPath',0);
    set(handles.toolSave,'Enable','off');
    set(handles.save,'Enable','off');
    set(handles.axes1,'visible','off');
    set(handles.axes2,'visible','off');
    % --- Outputs from this function are returned to the command line.
    function varargout = DIP_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Get default command line output from handles structure
    varargout{1} = handles.output;
    
    
    % --------------------------------------------------------------------
    function file_Callback(hObject, eventdata, handles)
    % hObject    handle to file (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function photoprocess_Callback(hObject, eventdata, handles)
    % hObject    handle to photoprocess (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function Untitled_8_Callback(hObject, eventdata, handles)
    % hObject    handle to Untitled_8 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function help_Callback(hObject, eventdata, handles)
    % hObject    handle to help (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function toBinary_Callback(hObject, eventdata, handles)
    % hObject    handle to toBinary (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    %axes(handles.axes2);
    %img_src = getappdata(handles.figure_DIP,'img_src');
    %imshow(img_src);
    h = toBW;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    % --------------------------------------------------------------------
    function gammatrans_Callback(hObject, eventdata, handles)
    % hObject    handle to gammatrans (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    h = toGamma;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    
    % --------------------------------------------------------------------
    function contrast_Callback(~, eventdata, handles)
    % hObject    handle to contrast (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function brightness_Callback(hObject, eventdata, handles)
    % hObject    handle to brightness (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    
    % --------------------------------------------------------------------
    function open_Callback(hObject, eventdata, handles)
    % hObject    handle to open (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    [filename, pathname] = uigetfile({'*.bmp;*.jpg;*.png;*.jpeg', 'Image Files (*.bmp, *.jpg, *.png,*.jpeg)'; '*.*', 'All Files (*.*)'}, 'Pick an image');
    if isequal(filename,0) || isequal(pathname,0),
        return;
    end
    axes(handles.axes1);%用axes命令设定当前操作的坐标轴是axes1
    fpath=[pathname filename];%将文件名和目录名组合成一个完整的路径
    img_src = imread(fpath);
    imshow(img_src);
    axes(handles.axes2);
    imshow(img_src);
    setappdata(handles.figure_DIP,'img_src',img_src);
    set(handles.photoprocess,'Enable','on');
    set(handles.axes1,'visible','on');
    % --------------------------------------------------------------------
    function save_Callback(hObject, eventdata, handles)
    % hObject    handle to save (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    fstSave=getappdata(handles.figure_DIP,'fstSave');
    if(fstSave==true)
        [filename, pathname] = uiputfile({'*.bmp','BMP files';'*.jpg;','JPG files'}, 'Pick an Image');
        if isequal(filename,0) || isequal(pathname,0)
            return;%如果点了“取消”
        else
            fpath=fullfile(pathname, filename);%获得全路径的另一种方法
        end    
        img_dst=getimage(handles.axes2);
        imwrite(img_dst,fpath);%保存图片
        setappdata(handles.figure_DIP,'fstPath',fpath);
        setappdata(handles.figure_DIP,'bSave',true);
        setappdata(handles.figure_DIP,'fstSave',false);
    else
        img_dst=getimage(handles.axes2);
        fpath=getappdata(handles.figure_DIP,'fstPath');
        imwrite(img_dst,fpath);
    end
    % --------------------------------------------------------------------
    function exit_Callback(hObject, eventdata, handles)
    % hObject    handle to exit (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    bChanged=getappdata(handles.figure_DIP,'bChanged');%获得是否更改
    bSave=getappdata(handles.figure_DIP,'bSave');%获得是否保存
    if bChanged==true && bSave==false,%更改了,而没保存时
        btnName=questdlg('Not Saved Yet','Warning','save','leave','save');%用提问对话框
        switch btnName,
          case 'save', %执行axes_dst_menu_save_Callback的功能
            feval(@save_Callback,handles.save,eventdata,handles);
          case 'leave',%什么也不做
        end
    end
    h=findobj('Tag','figure_toBW');%查找是否打开设置图像二值化参数窗口
    hh=findobj('Tag','figure_toLogTrans');
    hhh=findobj('Tag','figure_toGamma');
    if ~isempty(h),%找到的话,则关闭
      close(h);
      close(hh);
      close(hhh);
    end
    close(findobj('Tag','figure_DIP'));%关闭主窗口
    
    
    % --------------------------------------------------------------------
    function toolOpen_ClickedCallback(hObject, eventdata, handles)
    % hObject    handle to toolOpen (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    feval(@open_Callback,handles.open,eventdata,handles);
    
    
    % --------------------------------------------------------------------
    function toolSave_ClickedCallback(hObject, eventdata, handles)
    % hObject    handle to toolSave (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    feval(@save_Callback,handles.save,eventdata,handles);
    
    
    % --- Executes during object creation, after setting all properties.
    function axes1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to axes1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    set(hObject,'xTick',[]);
    set(hObject,'ytick',[]);
    set(hObject,'box','on');
    % Hint: place code in OpeningFcn to populate axes1
    
    
    % --- Executes during object creation, after setting all properties.
    function axes2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to axes2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    set(hObject,'xTick',[]);
    set(hObject,'ytick',[]);
    set(hObject,'box','on');
    % Hint: place code in OpeningFcn to populate axes2
    
    
    % --------------------------------------------------------------------
    function logtrans_Callback(hObject, eventdata, handles)
    % hObject    handle to logtrans (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    %axes(handles.axes2);
    %img_src = getappdata(handles.figure_DIP,'img_src');
    %imshow(img_src);
    h = toLogTrans;
    setappdata(handles.figure_DIP,'bChanged',true);
    set(handles.toolSave,'Enable','on');
    set(handles.save,'Enable','on');
    set(handles.axes2,'visible','on');
    

    toBW.m

    function varargout = toBW(varargin)
    % TOBW MATLAB code for toBW.fig
    %      TOBW, by itself, creates a new TOBW or raises the existing
    %      singleton*.
    %
    %      H = TOBW returns the handle to a new TOBW or the handle to
    %      the existing singleton*.
    %
    %      TOBW('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOBW.M with the given input arguments.
    %
    %      TOBW('Property','Value',...) creates a new TOBW or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toBW_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toBW_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toBW
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 00:49:18
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toBW_OpeningFcn, ...
                       'gui_OutputFcn',  @toBW_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
    
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
    
    
    % --- Executes just before toBW is made visible.
    function toBW_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to toBW (see VARARGIN)
    
    % Choose default command line output for toBW
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toBW,'DIP',DIP)
    % UIWAIT makes toBW wait for user response (see UIRESUME)
    % uiwait(handles.figure_toBW);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toBW_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Get default command line output from handles structure
    varargout{1} = handles.output;
    
    
    % --- Executes on slider movement.
    function slider1_Callback(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val = get(hObject,'Value');
    set(handles.text_bw,'String',num2str(val));
    DIP = getappdata(handles.figure_toBW,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    bw = im2bw(img_src,val);
    imshow(bw);
    
    
    % --- Executes during object creation, after setting all properties.
    function slider1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    LogTrans.m

    function   [g] = LogTrans(f,c,v)
    %此处显示详细说明
        h = mat2gray(f,[0,255]);
        g = c*log2(1+v*h)/log2(v+1);
    end
    

    toLogTrans.m

    function varargout = toLogTrans(varargin)
    % TOLOGTRANS MATLAB code for toLogTrans.fig
    %      TOLOGTRANS, by itself, creates a new TOLOGTRANS or raises the existing
    %      singleton*.
    %
    %      H = TOLOGTRANS returns the handle to a new TOLOGTRANS or the handle to
    %      the existing singleton*.
    %
    %      TOLOGTRANS('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOLOGTRANS.M with the given input arguments.
    %
    %      TOLOGTRANS('Property','Value',...) creates a new TOLOGTRANS or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toLogTrans_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toLogTrans_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toLogTrans
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 16:41:28
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toLogTrans_OpeningFcn, ...
                       'gui_OutputFcn',  @toLogTrans_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
    
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
    
    
    % --- Executes just before toLogTrans is made visible.
    function toLogTrans_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to toLogTrans (see VARARGIN)
    
    % Choose default command line output for toLogTrans
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toLogTrans,'DIP',DIP)
    setappdata(handles.figure_toLogTrans,'val_C',0);
    setappdata(handles.figure_toLogTrans,'val_V',0);
    % UIWAIT makes toLogTrans wait for user response (see UIRESUME)
    % uiwait(handles.figure_toLogTrans);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toLogTrans_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Get default command line output from handles structure
    varargout{1} = handles.output;
    
    
    % --- Executes on slider movement.
    function slider1_Callback(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val_C = get(hObject,'Value');
    set(handles.text2,'String',num2str(val_C));
    setappdata(handles.figure_toLogTrans,'val_C',val_C);
    val_V = getappdata(handles.figure_toLogTrans,'val_V');
    DIP = getappdata(handles.figure_toLogTrans,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    bw = LogTrans(img_src,val_C,val_V);
    imshow(bw);
    
    % --- Executes during object creation, after setting all properties.
    function slider1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    
    
    % --- Executes on slider movement.
    function slider2_Callback(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    val_V = get(hObject,'Value');
    set(handles.text4,'String',num2str(val_V));
    setappdata(handles.figure_toLogTrans,'val_V',val_V);
    val_C = getappdata(handles.figure_toLogTrans,'val_C');
    DIP = getappdata(handles.figure_toLogTrans,'DIP');
    axes(DIP.axes2);
    %img_src = getimage(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    %bw = val_C*log2(1+val_V*img_src)/log2(val_V+1);
    bw = LogTrans(img_src,val_C,val_V);
    imshow(bw);
    % --- Executes during object creation, after setting all properties.
    function slider2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    toGamma.m

    function varargout = toGamma(varargin)
    % TOGAMMA MATLAB code for toGamma.fig
    %      TOGAMMA, by itself, creates a new TOGAMMA or raises the existing
    %      singleton*.
    %
    %      H = TOGAMMA returns the handle to a new TOGAMMA or the handle to
    %      the existing singleton*.
    %
    %      TOGAMMA('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in TOGAMMA.M with the given input arguments.
    %
    %      TOGAMMA('Property','Value',...) creates a new TOGAMMA or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before toGamma_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to toGamma_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    
    % Edit the above text to modify the response to help toGamma
    
    % Last Modified by GUIDE v2.5 10-Apr-2017 21:32:21
    
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @toGamma_OpeningFcn, ...
                       'gui_OutputFcn',  @toGamma_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
    
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
    
    
    % --- Executes just before toGamma is made visible.
    function toGamma_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to toGamma (see VARARGIN)
    
    % Choose default command line output for toGamma
    handles.output = hObject;
    
    % Update handles structure
    guidata(hObject, handles);
    %找到原始界面的句柄
    HH = findobj('Tag','figure_DIP');
    DIP = guihandles(HH);
    setappdata(handles.figure_toGamma,'DIP',DIP)
    % UIWAIT makes toGamma wait for user response (see UIRESUME)
    % uiwait(handles.figure_toGamma);
    
    
    % --- Outputs from this function are returned to the command line.
    function varargout = toGamma_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    
    % Get default command line output from handles structure
    varargout{1} = handles.output;
    
    
    % --- Executes on slider movement.
    function slider2_Callback(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    val = get(hObject,'Value');
    set(handles.text2,'String',num2str(val));
    DIP = getappdata(handles.figure_toGamma,'DIP');
    axes(DIP.axes2);
    img_src = getappdata(DIP.figure_DIP,'img_src');
    c = 1;
    bw = GammaTrans(img_src,c,val);
    imshow(bw);
    
    % Hints: get(hObject,'Value') returns position of slider
    %        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    
    
    % --- Executes during object creation, after setting all properties.
    function slider2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to slider2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    
    % Hint: slider controls usually have a light gray background.
    if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor',[.9 .9 .9]);
    end
    

    GammaTrans.m

    function  [g]=GammaTrans(f,c,gamma)
    %   此处显示详细说明
        h = mat2gray(f,[0,255]);
        g = c*(h.^gamma);
    end
    
    
    展开全文
  • Matlab图像处理之灰度变换函数

    万次阅读 2016-04-20 19:08:51
    1,灰度:对于通常所谓的黑白图像,把黑色和白色之间按对数关系分为若干等级称为灰度灰度分为256阶,用灰度表示的图像称作灰度图.在图像中用0~255表示,0是全黑,255是全白 2.对比度:对比度值一幅图像中敏感区域...
  • 图像数字化为二维矩阵后,每个点的值都代表一个像素点的灰度值。 灰度灰度值的表示范围,灰度级时,称图片为k比特图片。当然灰度级越高,图片的细节则越清晰,因为有更多的灰度值来描述图片。但是灰度级越大...
  • [数字图像处理]灰度变换——反转,对数变换,伽马变换,灰度拉伸,灰度切割,位图切割 【From】http://blog.csdn.net/zhoufan900428/article/details/12709361 数字图像处理灰度变换灰度拉伸MATLAB...
  •   图像灰度的非线性变换主要有对数变换、指数变换、幂次变换等。本文主要讨论对数变换。   对数变换的基本形式如下: y=log⁡(1+x)b y=\frac{\log{(1+x)}}{b} y=blog(1+x)​ 其中,bbb为正常数,用以控制...
  • 实验内容 一、自选一幅背景较复杂、前景目标较多的交通图像,编程实现如下内容,并写出实验...2、已知某灰度图像数据如下,请用Gml和SML两种映射规则对其进行直方图规定化,对比变换后的直方图。 1.1线性变换代码...
  • 图形图像处理课程 大作业 姓名: 班级: 学号: 界面编程实现图像灰度变换 摘要 正文 1.MATLAB界面编程简介: 2. 图像灰度变换简介 3. 采用 MATLAB Guide 设计界面 3.1 问题... 对数变换的算法设计与实现 5.1 问题分析:
  • 图形图像处理课程 大作业 姓名: 班级 : 学号: 目录 界面编程实现图像灰度变换 摘要 正文 1.MATLAB 界面编程简介 : 2. 图像灰度变换简介 3. 采用 MATLAB Guide 设计界面 3.1 问题分析: 3.2 ... 对数变换的算法设计与实
  • Word可编辑 图形图像处理课程 大作业 姓名: 班级: 学号: 目录 界面编程实现图像灰度变换 摘要 正文 1.MATLAB 界面编程简介: 2. 图像灰度变换简介 3. 采用 MATLAB Guide 设计界面 3.1 问题... 对数变换的算法设计与实
  • 上一篇:MATLAB安装与简单的图像操作 上一篇文章忘记介绍灰度直方图了,灰度直方图就是将RGB图像转成灰度图后,统计灰度图...继续学习图像灰度变换之:灰度对数变换 t = c log(s + 1) 这种变换可
  • 灰度图像执行直方图均衡化 输出如下图所示。 强度转换 执行以下步骤: 拍摄了RGB照片 说成是灰度图像 图像I的计算和绘制直方图 在I上应用否定变换 负图像的计算和绘制直方图 接受用户输入的阈值,例如A = 127 强度...
  • 数字图像的基本灰度变换函数

    千次阅读 2016-03-24 23:58:35
    图像反转,底片效果反转灰度范围[0,L-1]的图像需要使用L-1减去图像灰度值,公式: s = L-1-rmatlab代码>> gyy = imread('gyy.jpg');... 对数变换,增强灰度低区/高区对比度对数变换使灰度较低的区域
  • 给定一个灰度图像,找到并显示傅立叶光谱的大小,然后对其进行对数变换和幂定律变换。 给定灰度图像,对其进行直方图均衡化增强 教程-2 在给定的输入图像上实现Marr-Hildreth边缘检测器和Canny边缘检测器。 仅使用两...
  • 亮度变换函数2.1函数imadjust2.2对数和对比度拉伸变换 一.背景知识 空间域技术则是直接对图像的像素进行操作。有表达式: g(x,y)=T[f(x,y)]g(x,y)=T[f(x,y)]g(x,y)=T[f(x,y)] 其中f是输入,g是输出。 还有点(x,y)的...
  • 基本灰度变换函数 1 对数变换 s=c∗log(1+v⋅r) ...MATLAB 对数变换函数效果代码: f = 0:0.01:1; v1 = 1; y1 = log2(1 + v1*f)/log2(v1+1); v2 = 10; y2 = log2(1 + v2*f)/log2(v2+1); v3 = 50; y3
  • 灰度处理:反色、直方图均衡、阈值变换、阈值变换、分段线性变换对数非线性变换、指数非线性变换图像增强:噪声(高斯、椒盐),平滑(均值法、邻域平均法、中值滤波法、巴特沃氏低通滤波); 锐化:梯度锐化、...
  • 1.灰度线性变换 1.1图像增强的点运算 1.1.1全域线性变换 (1)一般全域线性变换 (2)反向变换 1.1.2分段线性变换 ...1.1.3 对数变换 1.1.4指数变换 (1)一般指数变换 (2)伽玛变换 1.1.5直方图均衡化 ...
  • 空域点处理中的图像反转、线性变换、对数变换、幂函数变换、均衡化增强; 空域滤波中的均值滤波、中值滤波、加权滤波、Robert算子、Sobel算子、Laplace算子; 频域滤波中的低通滤波和高通滤波; 傅里叶变换中正...
  • matlab图像均衡化代码图像处理技术 基本图像处理操作 该存储库包含以MATLAB langugae编码的基本图像处理技术。 其中包括以下技术: 1]灰度切片2]直方图均衡3]直方图匹配4]逆变换5]对数变换6]幂定律变换7]基本阈值
  • Matlab幂律变换及直方图均衡化

    千次阅读 2020-09-27 12:46:35
    一、目标: 1、实现幂律变换,可以尝试调整gamma数值,观察图像变换。分析Lena图像灰度)在不同gamma数值下,图像灰度变换的特点。...与对数变换相同,幂次变换将部分灰度区域映射到更宽的区域中。当...
  • ch2_3_5:灰度图像的动画显示(§2.3.2) ch2_3_6:纹理映射(§2.3.3) ch2_3_7:一个图形窗口中同时显示2幅图像(§2.3.4) ch3_1_1:嵌套使用图像代数函数(§3.1.1) ch3_1_2:两幅图像相加(§3.1.2) ch3_1_...
  • 为了恢复其最原始的创意,可以应用诸如线性变换(例如负变换,对数变换或幂定律变换)之类的图像变换方法来提高图像质量。 通过数学方程式,可以描述为 s = T(r)或g(x,y)= T [f(x,y)] 其中“ s”或“ g(x,...

空空如也

空空如也

1 2 3
收藏数 46
精华内容 18
关键字:

matlab灰度图像对数变换

matlab 订阅