function varargout = shuzituxiangchuli(varargin)
% SHUZITUXIANGCHULI MATLAB code for shuzituxiangchuli.fig
% SHUZITUXIANGCHULI, by itself, creates a new SHUZITUXIANGCHULI or raises the existing
% singleton*.
%
% H = SHUZITUXIANGCHULI returns the handle to a new SHUZITUXIANGCHULI or the handle to
% the existing singleton*.
%
% SHUZITUXIANGCHULI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SHUZITUXIANGCHULI.M with the given input arguments.
%
% SHUZITUXIANGCHULI('Property','Value',...) creates a new SHUZITUXIANGCHULI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before shuzituxiangchuli_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to shuzituxiangchuli_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 shuzituxiangchuli
% Last Modified by GUIDE v2.5 23-Dec-2023 10:11:31
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @shuzituxiangchuli_OpeningFcn, ...
'gui_OutputFcn', @shuzituxiangchuli_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 shuzituxiangchuli is made visible.
function shuzituxiangchuli_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 shuzituxiangchuli (see VARARGIN)
% Choose default command line output for shuzituxiangchuli
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes shuzituxiangchuli wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = shuzituxiangchuli_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;
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function pinghua_Callback(hObject, eventdata, handles)
% hObject handle to pinghua (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = handles.I;
IR=I(:,:,1);IG=I(:,:,2);IB=I(:,:,3);
Igray=rgb2gray(I);
f=IR;
f2=double(f);
[M,N]=size(f);
f3=zeros([M,N]);
for x=2:(M-1);
for y=2:(N-1);
f3(x,y)=(f2(x-1,y-1)+f2(x,y-1)+f2(x+1,y-1)+f2(x-1,y)+f2(x,y)+f2(x+1,y)+f2(x-1,y+1)+f2(x,y+1)+f2(x+1,y+1))/9;
end
end
f3=uint8(f3);
axes(handles.axes1);imshow(IR);
axes(handles.axes2);imshow(f3);
% --------------------------------------------------------------------
function ruihua_Callback(hObject, eventdata, handles)
% hObject handle to ruihua (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = handles.I;
IR=I(:,:,1);IG=I(:,:,2);IB=I(:,:,3);
Igray=rgb2gray(I);
f=IR;
[row,col]=size(f);
prompt={'Threshold(0~255):'};
name='Input for Gradient Sharping';
numlines=1;
defaultanswer={'10'};
anss=inputdlg(prompt,name,numlines,defaultanswer);
th=str2num(anss{1});
f1=double(f);
f2=zeros(row,col);
for x=2:(row-1)
for y=2:(col-1)
g=abs(f1(x,y)-f1(x+1,y))+abs(f1(x,y)-f1(x,y+1));
if g>=th
f2(x,y)=g;
else
f2(x,y)=f1(x,y);
end
end
end
f2=uint8(f2);
axes(handles.axes1);imshow(IR);
axes(handles.axes2);imshow(f2);
% --------------------------------------------------------------------
function weicaise_Callback(hObject, eventdata, handles)
% hObject handle to weicaise (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = handles.I;
IR=I(:,:,1);IG=I(:,:,2);IB=I(:,:,3);
Igray=rgb2gray(I);
f=IR;
[row,col]=size(f);
f2=double(f);
f3=zeros(row,col,3);
for x=1:row;
for y=1:col;
if f2(x,y)>160
f3(x,y,1)=f2(x,y)+1;
f3(x,y,2)=0;
f3(x,y,3)=0;
else
if f2(x,y)>80
f3(x,y,2)=f2(x,y)+1;
f3(x,y,1)=0;
f3(x,y,3)=0;
else
f3(x,y,3)=f2(x,y)+1;
f3(x,y,1)=0;
f3(x,y,2)=0;
end
end
end
end
f3=uint8(f3);
axes(handles.axes1);imshow(IR);
axes(handles.axes2);imshow(f3);
% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function jiaoyan_Callback(hObject, eventdata, handles)
% hObject handle to jiaoyan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = handles.I;
IR=I(:,:,1);IG=I(:,:,2);IB=I(:,:,3);
Igray=rgb2gray(I);
f=IR;
[M,N]=size(f);
f1=imnoise(f,'salt & pepper',0.04);
extendx=double(zeros(256));
if (M<=256)&(N<=256)
W=256;
else
W=max(M,N);
end
for m=1:W
for n=1:W
if (m<=M)&(n<=N)
extendx(m,n)=f1(m,n);
else
extendx(m,n)=realmax;
end
end
end
axes(handles.axes2),imshow(extendx,[min(min(f1)),max(max(f1))]);
f1=uint8(f1);
axes(handles.axes1);imshow(IR);
axes(handles.axes2);imshow(f1);
% --------------------------------------------------------------------
function gaosi_Callback(hObject, eventdata, handles)
% hObject handle to gaosi (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I = handles.I;
IR=I(:,:,1);IG=I(:,:,2);IB=I(:,:,3);
Igray=rgb2gray(I);
f=IR;
[M,N]=size(f);
f1=imnoise(f,'gaussian',0.04);
extendx=double(zeros(256));
if (M<=256)&(N<=256)
W=256;
else
W=max(M,N);
end
for m=1:W
for n=1:W
if (m<=M)&(n<=N)
extendx(m,n)=f1(m,n);
else
extendx(m,n)=realmax;
end
end
end
axes(handles.axes2),imshow(extendx,[min(min(f1)),max(max(f1))]);
handles.imdata=f1;
axes(handles.axes2),imshow(extendx,[min(min(f1)),max(max(f1))]);
f1=uint8(f1);
axes(handles.axes1);imshow(IR);
axes(handles.axes2);imshow(f1);
% --------------------------------------------------------------------
function Untitled_8_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_8 (see GCB