行确定阈值。
BW = EDGE(I,'log');BW = EDGE(I,'log',THRESH);BW = EDGE(I,'log',THRESH,SIGMA);
采用 Marr 算子进行边缘提取。THRESH 是提取边缘的阈值,SIGMA 是标准差,缺省值为 2,滤波
器尺寸为 N=CEIL(SIGMA*3)*2+1。
BW = EDGE(I,'zerocross',TH,H);采用用户给定的滤波器 H 进行边缘增强后根据过零点提取边
缘。
BW = EDGE(I,'canny'); BW = EDGE(I,'canny',TH);BW = EDGE(I,'canny',TH,SIGMA);
Canny 方法提取边缘。参数定义同 Marr 算子。
2.7 二维滤波
生成特定的二维数字滤波器:fspecial
h = fspecial(type);
h = fspecial(type,parameters);
滤波器类型 type 可以是:
'sobel' for a Sobel horizontal edge-emphasizing filter
'prewitt' for a Prewitt horizontal edge-emphasizing filter
'gaussian' for a Gaussian lowpass filter
'laplacian'for a filter approximating the two-dimensional Laplacian operator
'log' for a Laplacian of Gaussian filter
'average' for an averaging filter
'unsharp' for an unsharp contrast enhancement filter
对于后边五种类型的滤波器,可以设置相应的滤波器参数 parameter,若省略则取各自的缺省值。
采用频率抽样法生成二维数字滤波器:fsamp2
h = fsamp2(Hd);
fsamp2 designs two-dimensional FIR filters based on a desired two-dimensional frequency response
sampled at points on the Cartesian plane.
h = fsamp2(Hd) designs a two-dimensional FIR filter with frequency response Hd, and returns the
filter coefficients in matrix h. (fsamp2 returns h as a computational molecule, which is the appropriate form
to use with filter2.)
二维滤波:filter2
B = filter2(h,A);对图像 A 作二维滤波,滤波器由上述方法产生。
中值滤波:medfilt2
B = medfilt2(A,[m n]);对图像 A 作中值滤波,邻域大小由[m n]决定,缺省为[3 3]。
2.8 图像变换
fft2 ifft2 dct2 idct2
2.9 邻域及块操作
blkproc nlfilter
3. 类型转换
rgb2gray
4. Matlab 集成环境及自定义 Matlab 函数
4.1 Matlab 集成环境
Matlab 集成环境的主体是它的“Command Window”,可在其中输入并执行各种 matlab 操作。比
如输入 matlab 命令 path 并回车,则返回 matlab 当前默认的工作路径;