本文主要是介绍冈萨雷斯Matlab版第三章(亮度变换与空间滤波)M文件小结,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
intrans.m源码
function g = intrans(f, varargin)
% 亮度变换的M函数,实现负片变换、对数变换、gamma变换和对比度拉伸变换。
% 第三章 3.2.3
% G = INTRANS(F, 'neg') computes thr nrgative of input iamge F.
% 计算输入图像F的负数,即补图像
%
% G = INTRANS(F, 'log', C, CLASS) computes C * log(1 + F) and multiplies
% the result by (positive) constant C. CLASS : the class of output as
% 'unit8'/'uint16'.
% 实现对数转换
%
% G = INTERANS(F, 'gamma', GAM): a gamma transformation on the input iamge
% using parameter GAM.
% 实现gamma转换
%
% G = INTERANS(F, 'stretch', M, E): a contrast-stretching transformation
% using 1./(1 + (M ./(F+eps)).^E). Parameter M [0, 1],default
% M = mean2(im2double(F)), and E default to 4.
% 实现对比度拉伸% 检测输入参数是否合法
narginchk(2, 4)
% 存储输入图片的class
classin = class(f);
% 如果输入类别是double,并且不在[0, 1]范围内,并且具体变换不是‘log’,将输入转换到[0, 1]
if strcmp(class(f), 'double') & max(f(:)) &g
这篇关于冈萨雷斯Matlab版第三章(亮度变换与空间滤波)M文件小结的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!