文件名称:数字图像处理 冈萨雷斯 英文版
文件大小:4.3MB
文件格式:PDF
更新时间:2012-05-04 03:15:28
第三章
主要介绍图像的复原技术 以下是其中的一小部分代码 function g = intrans(f, varargin) %INTRANS Performs intensity (gray-level) transformations. % G = INTRANS(F, 'neg') computes the negative of input image F. % % G = INTRANS(F, 'log', C, CLASS) computes C*log(1 + F) and % multiplies the result by (positive) constant C. If the last two % parameters are omitted, C defaults to 1. Because the log is used % frequently to display Fourier spectra, parameter CLASS offers the % option to specify the class of the output as 'uint8' or % 'uint16'. If parameter CLASS is omitted, the output is of the % same class as the input. % % G = INTRANS(F, 'gamma', GAM) performs a gamma transformation on % the input image using parameter GAM (a required input). % % G = INTRANS(F, 'stretch', M, E) computes a contrast-stretching % transformation using the expression 1./(1 + (M./(F + % eps)).^E). Parameter M must be in the range [0, 1]. The default % value for M is mean2(im2double(F)), and the default value for E % is 4. % % For the 'neg', 'gamma', and 'stretch' transformations, double % input images whose maximum value is greater than 1 are scaled % first using MAT2GRAY. Other images are converted to double first % using IM2DOUBLE. For the 'log' transformation, double images are % transformed without being scaled; other images are converted to % double first using IM2DOUBLE. % % The output is of the same class as the input, except if a % different class is specified for the 'log' option. % Verify the correct number of inputs. error(nargchk(2, 4, nargin)) % Store the class of the input for use later. classin = class(f); intrans