采用Sobel算子增强后进行边缘提取。TH是提取边缘的阈值,若不给定该参数,则函数自行确定阈值。DIR给定边缘提取的方向,可以是\'horizontal\'、\'vertical\' edges、或 \'both\' (the default)。
Ø BW = EDGE(I,\'prewitt\'); BW = EDGE(I,\'prewitt\',TH);BW = EDGE(I,\'prewitt\',TH,DIR)
采用Prewitt算子增强后进行边缘提取。TH是提取边缘的阈值,若不给定该参数,则函数自行确定阈值。DIR给定边缘提取的方向,可以是\'horizontal\'、\'vertical\' edges、或 \'both\' (the default)。
Ø BW = EDGE(I,\'roberts\') ; BW = EDGE(I,\'roberts\',THRESH)
采用Rroberts算子增强后进行边缘提取。THRESH是提取边缘的阈值,若不给定该参数,则函数自行确定阈值。
Ø 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二维滤波
l 生成特定的二维数字滤波器: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,若省略则取各自的缺省值。
l 采用频率抽样法生成二维数字滤波器: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.)
l 二维滤波:filter2
B = filter2(h,A);对图像A作二维滤波,滤波器由上述方法产生。
l 中值滤波: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当前?%B