资源简介
该代码实现了图像的滤波处理,这段代码给出了三种滤波矩阵,包括图像平滑(低通滤波器)、图像边缘提取(高通滤波器)等。用户下载后可以根据自己需要修改滤波矩阵和参数值,以便实现特殊的功能。为了形象的说明滤波效果,代码执行后可以看到滤波前后滤波后的对比图像。
代码片段和文件信息
clc;
clear all;
close all;
FLAG=input(‘\nWhich filter do you prefer?\n1 1/9*[111;111;111]\n2 1/24*[1-21;-212-2;1-21]\n3 1/24*[-1-2-1;-212-2;-1-2-1]\n(Please input 1 or 2 or 3)\n‘);
%%%%%%%%%%%%%%%%%%%%%%%
%%% Image Reading %%%
%%%%%%%%%%%%%%%%%%%%%%%
%F indicate filter matrixchange F can get varaious filtered images
if FLAG==1
F=1/9*[111;111;111];
end
if FLAG==2
F=1/24*[1-21;-212-2;1-21];
end
if FLAG==3
F=1/24*[-1-2-1;-212-2;-1-2-1];
end
I0=imread(‘yourimage.jpg‘);
I=rgb2gray(I0); %Convert rgb image I0 to 8-bit grayscale image and I indicate the gray image
J0=double(I);
J=J0; %J indicate filtered image
%%%%%%%%%%%%%%%%%%%%%%%
%%% Prearrangement %%%
%%%%%%%%%%%%%%%%%%%%%%%
[IheightIwidth]=size(I); %Size of the gray image
[FheightFwidth]=size(F); %Size of the filter matrix
remheight=mod(Fheight2);
remwidth=mod(Fwidth2);
if remheight==0
Fhalfheight=(Fheight/2)-1; %i.e. if Fheight=4 then Fhalfheight=1
Fheight_mark=Iheight-Fhalfheight-1; %This is the maximun of m if the filter center is (mn)
Hfilter_mark=Fhalfheight+1; %This is the maximun increment of m when implementing the filtering
else
Fhalfheight=(Fheight-1)/2; %i.e. if Fheight=3 then Fhalfheight=1
Fheight_mark=Iheight-Fhalfheight; %This is the maximun of m if the filter center is (mn)
Hfilter_mark=Fhalfheight; %This is the maximun increment of m when implementing the filtering
end
if remwidt
- 上一篇:微电网光伏并网过程进行仿真microgrid
- 下一篇:Matlab图像识别
相关资源
- 基于matlab的图像处理源程序
- 引导图像滤波器 Matlab实现
- 图像小波变换MatLab源代码
- 冈萨雷斯数字图像处理matlab版(第三
- 基于区域生长的图像分割MATLAB
- 基于matlab 的图像处理100实例
- 8领域边界跟踪 图像处理 matlab
- 细胞图像分割matlab代码
- 图像的二进小波分解matlab源码(保证
- Matlab图像二值化和逆向二值化
- matlab-图像处理算法
- p文件,MATLAB的
- matlab 数字图像对比度拉伸算法
- MATLAB实现混沌图像加密仿真程序
- 数字图像处理radon matlab变换算法代码
- 图像匹配matlab源程序sift算法
- 图像降噪Matlab代码
- Matlab图像分割边缘提取算法
- 基于MATLAB的图像特征点匹配和筛选
- 传统关联成像、计算鬼成像matlab
- 医学图像重建作业matlab源码
- 高光谱图像pca分析特征提取
- MATLAB7.x图像处理
- SPECT图像重建与结果分析
- 图像的饱和度,亮度,色调的matlab代
- 系数绝对值最大 图像融合MATLAB算法
- MATLAB多聚焦图像融合将两张到六张不
- matlab实现对两幅图像的叠加
- 世上最牛的23个图像跟踪算法MATLAB程序
- 图像信息熵 matlab M文件
评论
共有 条评论