




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Digital Image ProcessingHistogram Equalization with GUI module Author:Andonghui_20090802310067The histogram equalization code:%對(duì)一幅圖像進(jìn)行直方圖均衡化A=rgb2gray(picture); %圖像的預(yù)處理,讀入彩色圖像將其灰度化m,n=size(A);B=zeros(size(A);l=m*n;r=zeros(1,256);y=zeros(1,256);A=double(A);for i=1:m for j=1:n r(A(i,j)+1)=r(A(i,j)+1)+
2、1; endendr=r./l;%得到原圖像各灰度級(jí)所占的比例for k=1:256 for j=1:k y(k)=y(k)+r(j); endend %直方圖累加 for k=1:256 y(k)=floor(255*y(k)+0.5); %確定映射關(guān)系endfor i=1:m for j=1:n B(i,j)=y(A(i,j)+1); endendA=uint8(A);%轉(zhuǎn)換為無(wú)符號(hào)整數(shù)B=uint8(B);imshow(B);%顯示均衡化后的圖像 The GUI Function interface:Function :Transform the image into gray and
3、add Gaussian noiseFunctin:show the histogram of the original gray imageFunction: show the result of using histogram equalizationFunction:show the histogram of the processed imageThe whole code(GUI):function varargout = c(varargin)% Copyright 2012 Andonghui% C M-file for c.fig% C, by itself, creates
4、a new C or raises the existing% singleton*.% H = C returns the handle to a new C or the handle to% the existing singleton*.% C('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in C.M with the given input arguments.% C('Property','Value',.) crea
5、tes a new C or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before c_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to c_OpeningFcn via varargin.% *See GUI O
6、ptions on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help c % Last Modified by GUIDE v2.5 29-Mar-2012 12:10:00% Begin initialization code - DO NOT EDITgui_Singleton
7、 = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', c_OpeningFcn, . 'gui_OutputFcn', c_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback =
8、str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before c is made visible.function c_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no outp
9、ut 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 GUIDATA)% varargin command line arguments to c (see VARARGIN)% Choose default command line output for chandles.output = hObject;% Upd
10、ate handles structureguidata(hObject, handles);% UIWAIT makes c wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = c_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output arg
11、s (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout1 = handles.output;% - Executes on button press in read.function
12、pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);clear handles.picture;filename,pathname=uigetfile('D:
13、圖片1/*.*','select image');picture=pathname,filename;axes(handles.axes3);picture=imread(picture);imshow(picture)handles.picture=picture;guidata(hObject, handles);% - Executes on button press in gray.function pushbutton4_Callback(hObject, eventdata, handles)% hObject handle to pushbutton4 (
14、see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);picture=handles.picture; B=rgb2gray(picture);axes(handles.axes4)imshow(B);% - Executes on button press in magnify.function pushbutton5_Call
15、back(hObject, eventdata, handles)% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);picture=handles.picture;G = imnoise(picture,'gaussian',0,0.05); a
16、xes(handles.axes2);imshow(G);% - Executes on button press in reduce.function pushbutton6_Callback(hObject, eventdata, handles)% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidat
17、a(hObject, handles);picture=handles.picture; average_filter_5x5 = fspecial('average', 5 5);filter_5x5 = imfilter (picture, average_filter_5x5);axes(handles.axes2);imshow(filter_5x5);% - Executes on button press in zhifangtu.function pushbutton7_Callback(hObject, eventdata, handles)% hObject
18、handle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);picture=handles.picture;C=rgb2gray(picture);r,c=size(C);axes(handles.axes2)imhist(C);% - Executes on button press in
19、 enhance.function pushbutton12_Callback(hObject, eventdata, handles)% hObject handle to pushbutton12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);picture=handles.picture;J=imadjust(pi
20、cture,0.4 0.6,0 1,1);axes(handles.axes2)imshow(J)% - Executes on button press in pushbutton14.function pushbutton14_Callback(hObject, eventdata, handles)% hObject handle to pushbutton14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and u
21、ser data (see GUIDATA)close% - Executes on button press in pushbutton15.function pushbutton15_Callback(hObject, eventdata, handles)% hObject handle to pushbutton15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)guidata(hObject, handles);picture=handles.picture; O=rgb2gray(picture);E=histeq(O);axes(handles.axes2);imhist(E);% - Executes on button
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 郵寄檢驗(yàn)服務(wù)部工作技巧與客戶反饋計(jì)劃
- 《貴州美升能源集團(tuán)有限公司六枝特區(qū)新興煤礦(變更)礦產(chǎn)資源綠色開發(fā)利用方案(三合一)》評(píng)審意見
- 膀胱部分切除后護(hù)理
- 高中地理 3.1 海水的溫度和鹽度教學(xué)實(shí)錄2 新人教版選修2
- 2025年三明道路運(yùn)輸從業(yè)人員從業(yè)資格考試
- 2025年貴州貨運(yùn)從業(yè)資格證模擬考試保過(guò)版
- 《人民幣兌換》(教學(xué)設(shè)計(jì))-2024-2025學(xué)年五年級(jí)上冊(cè)數(shù)學(xué)北師大版
- 部隊(duì)違規(guī)使用檢討書
- 社區(qū)七夕節(jié)活動(dòng)方案
- 四年級(jí)數(shù)學(xué)(四則混合運(yùn)算)計(jì)算題專項(xiàng)練習(xí)與答案
- 《DeepSeek入門寶典》第4冊(cè)·個(gè)人使用篇
- 2024年中考模擬試卷數(shù)學(xué)(新疆卷)
- 2025年蘇州農(nóng)業(yè)職業(yè)技術(shù)學(xué)院高職單招高職單招英語(yǔ)2016-2024歷年頻考點(diǎn)試題含答案解析
- 加油站的流程優(yōu)化
- 關(guān)于美國(guó)地理知識(shí)的講課
- 浙江2024年浙江省有色金屬地質(zhì)勘查院選調(diào)專業(yè)技術(shù)人員筆試歷年典型考點(diǎn)(頻考版試卷)附帶答案詳解
- 2024云南紅河州個(gè)舊市大紅屯糧食購(gòu)銷限公司招聘及人員易考易錯(cuò)模擬試題(共500題)試卷后附參考答案
- 開門見山的作文開頭和結(jié)尾摘抄
- 新人教版九年級(jí)數(shù)學(xué)第一輪總復(fù)習(xí)教案
- 2024年安徽省養(yǎng)老護(hù)理職業(yè)技能競(jìng)賽考試題庫(kù)(含答案)
- 醉酒后急救知識(shí)培訓(xùn)課件
評(píng)論
0/150
提交評(píng)論