📄 guicompare.m
字号:
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
%Closing the Degrade GUI & Opening the Restore GUI
assignin('base', 'algo', 1);
delete(gcf);
GUIRestore;
% ----------------------
function RestoreWiener_Callback(hObject, eventdata, handles)% hObject handle to RestoreWiener (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
%Closing the Degrade GUI & Opening the Restore GUI
assignin('base', 'algo', 2);
delete(gcf);
GUIRestore;
% ----------------------
function RestoreLucyRichardson_Callback(hObject, eventdata, handles)% hObject handle to RestoreLucyRichardson (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%Closing the Degrade GUI & Opening the Restore GUI
assignin('base', 'algo', 3);
delete(gcf);
GUIRestore;
% ----------------------
function RestoreCompare_Callback(hObject, eventdata, handles)
% hObject handle to RestoreCompare (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% ----------------------
function Help_Callback(hObject, eventdata, handles)% hObject handle to Help (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% ----------------------
function HelpHelp_Callback(hObject, eventdata, handles)% hObject handle to HelpHelp (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.lblstatus, 'Foregroundcolor', 'Red');
set(handles.lblstatus, 'String', 'Status: Busy');
set(gcf,'pointer','watch');
web ([cd '\Help\Home.html'], '-browser');
set(gcf,'pointer','arrow');
set(handles.lblstatus, 'String', 'Status: Ready', 'Foregroundcolor', 'Black');
% ----------------------
function HelpAboutUs_Callback(hObject, eventdata, handles)% hObject handle to HelpAboutUs (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)set(handles.lblstatus, 'Foregroundcolor', 'Red');
set(handles.lblstatus, 'String', 'Status: Busy');
set(gcf,'pointer','watch');
web ([cd '\Help\About Us.html'], '-browser');
set(gcf,'pointer','arrow');
set(handles.lblstatus, 'String', 'Status: Ready', 'Foregroundcolor', 'Black');
% ----------------------- End of GUICompare --------------------------
% --- Executes during object creation, after setting all properties.function sldlength_CreateFcn(hObject, eventdata, handles)% hObject handle to sldlength (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function sldlength_Callback(hObject, eventdata, handles)% hObject handle to sldlength (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of sliderstr = sprintf('%.0f', get(handles.sldlength, 'Value'));
set(handles.txtlength, 'String', str);
% --- Executes during object creation, after setting all properties.function sldtheta_CreateFcn(hObject, eventdata, handles)% hObject handle to sldtheta (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background, change% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function sldtheta_Callback(hObject, eventdata, handles)% hObject handle to sldtheta (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'Value') returns position of slider% get(hObject,'Min') and get(hObject,'Max') to determine range of sliderstr = sprintf('%.0f', get(handles.sldtheta, 'Value'));
set(handles.txttheta, 'String', str);
% --- Executes during object creation, after setting all properties.function txtlength_CreateFcn(hObject, eventdata, handles)% hObject handle to txtlength (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction txtlength_Callback(hObject, eventdata, handles)% hObject handle to txtlength (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of txtlength as text% str2double(get(hObject,'String')) returns contents of txtlength as a doublestr = str2num(get(handles.txtlength,'String'));
if str<1 || str>100
uiwait(errordlg('Please enter blur length in the range 1 to 100.', 'Invalid Length', 'modal'));
%Resetting length
str = sprintf('%.0f', get(handles.sldlength, 'Value'));
set(handles.txtlength, 'String', str);
else
set(handles.sldlength,'Value', str);
end
% --- Executes during object creation, after setting all properties.function txttheta_CreateFcn(hObject, eventdata, handles)% hObject handle to txttheta (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction txttheta_Callback(hObject, eventdata, handles)% hObject handle to txttheta (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of txttheta as text% str2double(get(hObject,'String')) returns contents of txttheta as a doublestr = str2num(get(handles.txttheta,'String'));
if str<0 || str>180
uiwait(errordlg('Please enter blur angle in the range 0 to 180.', 'Invalid Theta', 'modal'));
%Resetting theta
str = sprintf('%.0f', get(handles.sldtheta, 'Value'));
set(handles.txttheta, 'String', str);
else
set(handles.sldtheta,'Value', str);
end
% --- Executes on button press in chknoise.
function chknoise_Callback(hObject, eventdata, handles)
% hObject handle to chknoise (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of chknoise
if get(handles.chknoise, 'Value')
%Enabling the popup menu for noise type
set(handles.popnoisetype, 'Enable', 'on');
popnoisetype_Callback(hObject, eventdata, handles);
else
%Disabling popup menu for noise type
set(handles.popnoisetype, 'Enable', 'off');
%Disabling all the sliders
set(handles.sldnoisedensity, 'Enable', 'off');
set(handles.sldmean, 'Enable', 'off');
set(handles.sldvariance, 'Enable', 'off');
%Resetting all the labels
set(handles.lblnoisedensityval, 'String', 0);
set(handles.lblmeanval, 'String', 0);
set(handles.lblvarianceval, 'String', 0);
end
% --- Executes during object creation, after setting all properties.
function popnoisetype_CreateFcn(hObject, eventdata, handles)
% hObject handle to popnoisetype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on selection change in popnoisetype.
function popnoisetype_Callback(hObject, eventdata, handles)
% hObject handle to popnoisetype (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popnoisetype contents as cell array
% contents{get(hObject,'Value')} returns selected item from popnoisetype
%Disabling all the sliders
set(handles.sldnoisedensity, 'Enable', 'off');
set(handles.sldmean, 'Enable', 'off');
set(handles.sldvariance, 'Enable', 'off');
%Resetting all the labels
set(handles.lblnoisedensityval, 'String', 0);
set(handles.lblmeanval, 'String', 0);
set(handles.lblvarianceval, 'String', 0);
% 1: salt & pepper
% 2: gaussian
% 3: poisson
% 4: speckle
switch get(handles.popnoisetype, 'Value')
case 1,
set(handles.sldnoisedensity, 'Enable', 'on', 'Value', 0.05);
set(handles.lblnoisedensityval, 'String', 0.05);
case 2,
set(handles.sldmean, 'Enable', 'on', 'Value', 0);
set(handles.lblmeanval, 'String', 0);
set(handles.sldvariance, 'Enable', 'on', 'Value', 0.01);
set(handles.lblvarianceval, 'String', 0.01);
case 4,
set(handles.sldvariance, 'Enable', 'on', 'Value', 0.04);
set(handles.lblvarianceval, 'String', 0.04);
end
% --- Executes during object creation, after setting all properties.
function sldmean_CreateFcn(hObject, eventdata, handles)
% hObject handle to sldmean (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on slider movement.
function sldmean_Callback(hObject, eventdata, handles)
% hObject handle to sldmean (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
value = sprintf('%.2f', get(handles.sldmean, 'Value'));
set(handles.lblmeanval, 'String', value);
% --- Executes during object creation, after setting all properties.
function sldvariance_CreateFcn(hObject, eventdata, handles)
% hObject handle to sldvariance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on slider movement.
function sldvariance_Callback(hObject, eventdata, handles)
% hObject handle to sldvariance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
value = sprintf('%.2f', get(handles.sldvariance, 'Value'));
set(handles.lblvarianceval, 'String', value);
% --- Executes during object creation, after setting all properties.
function sldnoisedensity_CreateFcn(hObject, eventdata, handles)
% hObject handle to sldnoisedensity (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -