1、GUI allows only one% instance to run (singleton).% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help imageprocessinggui% Last Modified by GUIDE v2.5 21-May-2012 20:51:04% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfil
2、ename, . gui_Singleton, gui_Singleton, .gui_OpeningFcn, imageprocessinggui_OpeningFcn, .gui_OutputFcn, imageprocessinggui_OutputFcn, .gui_LayoutFcn, , .gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State,
3、 varargin:);else gui_mainfcn(gui_State, varargin:% End initialization code - DO NOT EDIT% - Executes just before imageprocessinggui is made visible.function imageprocessinggui_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figur
4、e% 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 imageprocessinggui (see VARARGIN)% Choose default command line output for imageprocessingguihandles.output = hObject;% Update handles st
5、ructureguidata(hObject, handles);% UIWAIT makes imageprocessinggui wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = imageprocessinggui_OutputFcn(hObject, eventdata, handles) % varargout cell array for
6、returning output args (see VARARGOUT);% Get default command line output from handles structurevarargout1 = handles.output;% javaFrame = get(gcf,JavaFrame);% set(javaFrame,Maximized,1);% -function Untitled_1_Callback(hObject, eventdata, handles)% hObject handle to Untitled_1 (see GCBO)function Untitl
7、ed_5_Callback(hObject, eventdata, handles)% hObject handle to Untitled_5 (see GCBO)function Untitled_15_Callback(hObject, eventdata, handles)% hObject handle to Untitled_15 (see GCBO)function Untitled_25_Callback(hObject, eventdata, handles)% hObject handle to Untitled_25 (see GCBO)function Gradient
8、image_Callback(hObject, eventdata, handles)% hObject handle to Gradientimage (see GCBO)global imaxes(handles.axes1);cla reset;axes(handles.axes2);axes(handles.axes3);axes(handles.axes4);P=im;d=size(P);if(d(3)1) P=rgb2gray(P);imshow(P);title(灰度图像P=double(P);Px,Py=gradient(P);G=sqrt(Px.*Px+Py.*Py);P=G
9、;P=uint8(P);梯度图像1tou=input(input threshold tou=bh=input(input a constant intensity nearer to white bh=P1=P;k=find(G=tou);P1(k)=bh;imshow(P1);梯度图像2bl=input(input a constant intensity nearer to black bl=P2=P;h=find(GP2(h)=bh;l=find(G=tou) P3(i,j)=bh; else P3(i,j)=bl; endP3=uint8(P3);imshow(P3);梯度图像4fu
10、nction Untitled_27_Callback(hObject, eventdata, handles)% hObject handle to Untitled_27 (see GCBO)function Untitled_16_Callback(hObject, eventdata, handles)% hObject handle to Untitled_16 (see GCBO)function Untitled_21_Callback(hObject, eventdata, handles)% hObject handle to Untitled_21 (see GCBO)fu
11、nction Untitled_6_Callback(hObject, eventdata, handles)% hObject handle to Untitled_6 (see GCBO)function Untitled_12_Callback(hObject, eventdata, handles)% hObject handle to Untitled_12 (see GCBO)function Untitled_2_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2 (see GCBO)global
12、 Sfilename,pathname=uigetfile(*.jpg;*.bmp*.gif*.tif*.png*jpeg,选择图片if isequal(filename,0) disp(User selected canceledstr=pathname filename;% global S %设置一个全局变量S,保存初始图像路径,以便之后的还原操作S=str;im=imread(str);imshow(im);原图像handles.img=im;guidata(hObject,handles);function save_Callback(hObject, eventdata, hand
13、les)% hObject handle to save (see GCBO)newfig1=figure;new_h1=copyobj(handles.axes1,newfig1);set(new_h1,UnitsdefaultPosition hp=getframe(new_h1); filename1,pathname1 = uiputfile(Bitmap(*.bmp).JPEG(*.jpg)GIF(*.gif)*.*, All Files (*.*),.Save Picture1Picture1_1 if filename1=0 close(newfig1); return imwr
14、ite(hp.cdata,fullfile(pathname1,filename1);function quit_Callback(hObject, eventdata, handles)% hObject handle to quit (see GCBO)clc;close all;close(gcf);clear;function linearTran_Callback(hObject, eventdata, handles)% hObject handle to linearTran (see GCBO)m n=size(P);g=zeros(m,n);% B=input(input the storage of each pixel:B=8;bmin=min(min(P);bmax=max(max(P);mng(i,j)=(2.B-1)*(P(i,j)-bmin)/(bmax-bmin);g=uint8(g);imshow(g);经线性变换后的图像function limitlintran_Callback(hObject, eventdata, handles)% hObject handle to limitlintran (see GCBO)axes(han
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1