简单数字图像处理系统(共9页).doc

上传人:飞****2 文档编号:14510174 上传时间:2022-05-05 格式:DOC 页数:9 大小:45KB
返回 下载 相关 举报
简单数字图像处理系统(共9页).doc_第1页
第1页 / 共9页
简单数字图像处理系统(共9页).doc_第2页
第2页 / 共9页
点击查看更多>>
资源描述

《简单数字图像处理系统(共9页).doc》由会员分享,可在线阅读,更多相关《简单数字图像处理系统(共9页).doc(9页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精选优质文档-倾情为你奉上数字图像课程设计 简单数字图像处理系统function varargout = untitled(varargin)% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningFcn, untitled_OpeningFcn, . gui_OutputFcn, untitled_OutputFcn, . gui_LayoutFcn, , . g

2、ui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before untitled is made visible.function

3、 untitled_OpeningFcn(hObject, eventdata, handles, varargin) %界面初始化函数setappdata(handles.figure1,I,0); % This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDA

4、TA)% varargin command line arguments to untitled (see VARARGIN) % Choose default command line output for untitledhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes untitled wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from thi

5、s function are returned to the command line.function varargout = untitled_OutputFcn(hObject, eventdata, handles) %界面输出函数% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure wit

6、h handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output; % -function m_file_Callback(hObject, eventdata, handles)% hObject handle to m_file (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structur

7、e with handles and user data (see GUIDATA) % -function my_file_open_Callback(hObject, eventdata, handles)global I;FileName,PathName = uigetfile(*.bmp;*.jpg;*.tiff;*.gif);%弹出对话框得到打开的路径I=imread(strcat(PathName,FileName);%打开得到的路径下的文件imshow(I)setappdata(handles.figure1,I,I);% handles structure with hand

8、les and user data (see GUIDATA) % -function my_file_save_Callback(hObject, eventdata, handles)global I;%这个是要保存的东西,一般是global的FileName,PathName = uiputfile(*.bmp;*.jpg;*.tiff;*.gif);%弹出对话框的到保存的路径imwrite(I,strcat(PathName,FileName);%存储到该路径下%uigetfile Open standard dialog box for retrieving files%saveas

9、(figure_handle,filename,fileformat)%saveas(gcf,picname,jpg) %if isequal(filename,0)|isequal(pathname,0) % return; %如果点了取消%else % fpath=fullfile(pathname,filename); %获取全路径的另一种方法%end %I=getappdata(handles.figure1,I);%imwrite(I,fpath); %保存图片 % -function my_file_exit_Callback(hObject, eventdata, handles

10、)close(handles.figure1); %退出% hObject handle to my_file_exit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function my_file_print_Callback(hObject, eventdata, handles)% hObject handle to my_file_print (see

11、GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)C:UsersswjDocumentsMATLABuntitled.fig % -function m_image_Callback(hObject, eventdata, handles)% hObject handle to m_image (see GCBO)% eventdata reserved - to be defined

12、 in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_image_2bw_Callback(hObject, eventdata, handles)% hObject handle to m_image_2bw (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and use

13、r data (see GUIDATA) % -function m_image_tongji_Callback(hObject, eventdata, handles)%图像直方图的统计与绘制 直方图反应灰度值与像素个数的关系%FileName,PathName = uigetfile(*.bmp;*.jpg;*.tiff;*.gif);%弹出对话框得到打开的路径%I=imread(strcat(PathName,FileName);%打开得到的路径下的文件global I;A = rgb2gray(I); %将真彩色图像转换为灰度图像%figure(Name, 显示灰度图像)subplot

14、(2,2,1);imshow(I);title(原图);%imshow(A);J,I = histeq(A);%imshow(J);subplot(2,2,2);imhist(A,64); %提取图像中的直方图信息title(直方图的统计);%BW= bwperim(A,8);%figure(name,周长)%imshow(BW); % -function m_image_mianji_Callback(hObject, eventdata, handles)global I;BW = bwperim(im2bw(I); %显示二值化后的图像 Area = bwarea(BW) labeled

15、,numobjects=bwlabel(BW,8); BW=regionprops(labeled, basic) BW = BW.Area; set(handles.mj,String,strcat(区域面积 = ,num2str(BW); % -function m_image_zhouchang_Callback(hObject, eventdata, handles)% hObject handle to m_image_zhouchang (see GCBO)% eventdata reserved - to be defined in a future version of MAT

16、LAB% handles structure with handles and user data (see GUIDATA) % -function juli_Callback(hObject, eventdata, handles)% hObject handle to juli (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_change

17、_Callback(hObject, eventdata, handles)% hObject handle to m_change (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_change_ft_Callback(hObject, eventdata, handles) %普通傅里叶变换与逆变换global I; %傅里叶变换是将时域信号

18、分解为不同频率的正弦和/余弦和的形式subplot(2,2,1); %其通过在时域和频域来回切换图像imshow(I); title(原图);f=rgb2gray(I);A=fftshift(fft2(f);%figure;subplot(2,2,2);imshow(log(abs(A),8,10);title(傅里叶变换图像); % -function m_change_fft_Callback(hObject, eventdata, handles) %快速普通傅里叶变换与逆变换global I;subplot(2,2,1),imshow(I);title(原图);f=rgb2gray(I

19、); %subplot(2,2,2),imshow(f); F=fft2(f); %二维傅里叶变换FS=fftshift(F); S=log(1+abs(FS); %频谱subplot(2,2,3);imshow(S,);title(快速傅里叶变换图像);fr=real(ifft2(ifftshift(FS); %二维傅里叶逆变换ret=im2uint8(mat2gray(fr);subplot(2,2,4),imshow(ret);title(快速傅里叶逆变换图像); % -function m_change_DCT_Callback(hObject, eventdata, handles)

20、 %离散余弦变换global I;subplot(2,2,1),imshow(I);title(原图); A= rgb2gray(I); %将其转为灰度 B = dct2(A); %=二维dct变换,即离散余弦变换 subplot(2,2,2),imshow(B);title(离散余弦变换图像) % -function m_change_xiaobo_Callback(hObject, eventdata, handles) %小波变换global I; %定义图片数据存储的全局变量subplot(2,2,1);imshow(I);title(原始图像);A=rgb2gray(I);subpl

21、ot(2,2,2);imshow(A);title(黑白图像);m,n=wavedec2(A,3,bior3.7);%多尺度二维小波分解B=appcoef2(m,n,bior3.7,2);%将低频取出进行二层的小波变换 subplot(2,2,3);imshow(B);title(二维离散小波变换2层);C=appcoef2(m,n,bior3.7,3);%将低频取出进行二层的小波变换 subplot(2,2,4);imshow(C);title(二维离散小波变换3层); function m_division_Callback(hObject, eventdata, handles)% hO

22、bject handle to m_division (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_division_line_Callback(hObject, eventdata, handles)%图像分割点 线global I; A= rgb2gray(I); %将彩色图转化成灰度图B=immultiply(A,1.5);subplo

23、t(2,2,1);imshow(I);title(原图);subplot(2,2,2);imshow(B);title(点分割图片); % -function m_division_edge_Callback(hObject, eventdata, handles) %图像边缘检测 提取图像高频分量global I; %定义图片数据存储的全局变量 A=rgb2gray(I); % 图片用的是灰度图像%x,y=size(A);%BW=edge(A);BW1=edge(A,Canny,0.4,0.5) %edge调用Canny为检测算子判别阈值为0.5BW2=edge(A,log,0.4,0.5)

24、; % 做阈值为0.07的高斯拉普拉斯(Log)算法 把subplot(2,2,1),imshow(A);title(原图);subplot(2,2,3),imshow(BW1);title(Canny算子边缘检测图像 阀值0.5);subplot(2,2,4),imshow(BW2);title(拉普拉斯算子边缘检测图像 阀值0.5); % -function m_zengqiang_Callback(hObject, eventdata, handles)% hObject handle to m_zengqiang (see GCBO)% eventdata reserved - to

25、be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function m_zengqiang_zhongzhi_Callback(hOguidebject, eventdata, handles) %中值滤波 使图像在某一部分 的频率信息通过,其他过低或过高都抑制global I; %滤除噪声 滤除噪声保持图像边缘J=rgb2gray(I); %将真彩色图像转换为灰度图像A= medfilt2(J); %对躁声进行中值滤波subplot(2

26、,2,1);imshow(I);title(原图);subplot(2,2,2);imshow(A);title(中值滤波后图像); % -function m_zengqiang_ditong_Callback(hObject, eventdata, handles) %低通滤波 让图像使高频分量抑制,低频分量通过global I; %定义图片数据存储的全局变量A=rgb2gray(I); %将真彩色图像转换为灰度图像subplot(2,2,1);imshow(I);title(原图);s=fftshift(fft2(A);a,b=size(s);a0=round(a/2);b0=round

27、(b/2);d=10;for i=1:a for j=1:b distance=sqrt(i-a0)2+(j-b0)2); if distance=d h=1; else h=0; end; s(i,j)=h*s(i,j); end;end;s=uint8(real(ifft2(ifftshift(s);subplot(2,2,2);imshow(s);title(低通滤波后图像); % -function m_zengqiang_gaotong_Callback(hObject, eventdata, handles) %高通滤波 让图像使低频分量抑制,高频分量通过global I; %定义

28、图片数据存储的全局变量subplot(2,2,1);imshow(I);title(原图);A=rgb2gray(I); %将真彩色图像转换为灰度图像s=fftshift(fft2(A);a,b=size(s);a0=round(a/2);b0=round(b/2);d=10;p=0.2;q=0.5;for i=1:a for j=1:b distance=sqrt(i-a0)2+(j-b0)2); if distance=d h=0; else h=1; end; s(i,j)=h*s(i,j); end;end;s=uint8(real(ifft2(ifftshift(s);subplot

29、(2,2,2);imshow(s);title(高通滤波后图像); % -function m_zengqiang_junhenghua_Callback(hObject, eventdata, handles) %直方图均衡化 将原始图像的直方图变换为均匀分布的形式global I; %定义图片数据存储的全局变量subplot(2,2,1);imshow(I);title(原图);A=rgb2gray(I);%将真彩色图像转换为灰度图像B=histeq(A); %直方图均衡化缺省64subplot(2,2,2);imshow(B);title(直方图均衡化后图像);%subplot(2,2,3);imhist(B);title(直方图均衡化后图像);专心-专注-专业

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁