function varargout = Fourier(varargin)
% FOURIER MATLAB code for Fourier.fig
% FOURIER, by itself, creates a new FOURIER or raises the existing
% singleton*.
%
% H = FOURIER returns the handle to a new FOURIER or the handle to
% the existing singleton*.
%
% FOURIER('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FOURIER.M with the given input arguments.
%
% FOURIER('Property','Value',...) creates a new FOURIER or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Fourier_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Fourier_OpeningFcn via varargin.
%
% *See GUI Options 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 Fourier
% Last Modified by GUIDE v2.5 25-Dec-2016 19:16:39
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Fourier_OpeningFcn, ...
'gui_OutputFcn', @Fourier_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Fourier is made visible.
function Fourier_OpeningFcn(hObject, eventdata, handles, varargin)
% 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 GUIDATA)
% varargin command line arguments to Fourier (see VARARGIN)
set(handles.axes1,'Visible','off');
set(handles.axes3,'Visible','off');
set(handles.axes2,'Visible','off');
set(handles.axes4,'Visible','off');
set(handles.editBiaoji,'Visible','off');
% Choose default command line output for Fourier
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Fourier wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Fourier_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 with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in btnDaizu.
function btnDaizu_Callback(hObject, eventdata, handles)
% hObject handle to btnDaizu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = Daizu(handles);
% --- Executes on button press in btnDaitong.
function btnDaitong_Callback(hObject, eventdata, handles)
% hObject handle to btnDaitong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = DaiTong(handles);
% --- Executes on button press in btnGaotong.
function btnGaotong_Callback(hObject, eventdata, handles)
% hObject handle to btnGaotong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = GaoTong(handles);
% --- Executes on button press in btnDitong.
function btnDitong_Callback(hObject, eventdata, handles)
% hObject handle to btnDitong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = DiTong(handles);
% --- Executes on button press in btnInput.
function btnInput_Callback(hObject, eventdata, handles)
% hObject handle to btnInput (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global FFT Output
%图像读取
%调用系统文件管理选择图像存储位置及文件
[FileName,PathName,FilterIndex] = uigetfile('*.*');%弹出对话框得到打开的路径
%防止用户取消保存时报错
if FilterIndex == 0%判断用户是否取消保存
Input=0;
else
Input=imread(strcat(PathName,FileName));%打开得到的路径下的文件
end
try
Input = rgb2gray(Input);
catch
end
set(handles.axes1,'Visible','on');
set(handles.axes2,'Visible','on');
axes(handles.axes1);
imshow(Input);
FFT=fftshift(fft2(Input));% 进行傅里叶变换
% 显示图像
Output=abs(FFT)/255;
Output=uint8(Output);
axes(handles.axes2);
imshow(Output);
% 修改标记
set(handles.editBiaoji,'string','0');
function editGaotong_Callback(hObject, eventdata, handles)
% hObject handle to editGaotong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = GaoTong(handles);
% Hints: get(hObject,'String') returns contents of editGaotong as text
% str2double(get(hObject,'String')) returns contents of editGaotong as a double
% --- Executes during object creation, after setting all properties.
function editGaotong_CreateFcn(hObject, eventdata, handles)
% hObject handle to editGaotong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editDitong_Callback(hObject, eventdata, handles)
% hObject handle to editDitong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = DiTong(handles);
% Hints: get(hObject,'String') returns contents of editDitong as text
% str2double(get(hObject,'String')) returns contents of editDitong as a double
% --- Executes during object creation, after setting all properties.
function editDitong_CreateFcn(hObject, eventdata, handles)
% hObject handle to editDitong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editDaitongS_Callback(hObject, eventdata, handles)
% hObject handle to editDaitongS (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = DaiTong(handles);
% Hints: get(hObject,'String') returns contents of editDaitongS as text
% str2double(get(hObject,'String')) returns contents of editDaitongS as a double
% --- Executes during object creation, after setting all properties.
function editDaitongS_CreateFcn(hObject, eventdata, handles)
% hObject handle to editDaitongS (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolB