function varargout = project1(varargin)
% PROJECT1 MATLAB code for project1.fig
% PROJECT1, by itself, creates a new PROJECT1 or raises the existing
% singleton*.
%
% H = PROJECT1 returns the handle to a new PROJECT1 or the handle to
% the existing singleton*.
%
% PROJECT1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PROJECT1.M with the given input arguments.
%
% PROJECT1('Property','Value',...) creates a new PROJECT1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before project1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to project1_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 project1
% Last Modified by GUIDE v2.5 24-Oct-2017 21:16:08
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @project1_OpeningFcn, ...
'gui_OutputFcn', @project1_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 project1 is made visible.
function project1_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 project1 (see VARARGIN)
% Choose default command line output for project1
handles.output = hObject;
% axes(handles.axes1);
% imshow(handles.II);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes project1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = project1_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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
typeOFmodel1=get(handles.radiobutton1,'value');
typeOFmodel2=get(handles.radiobutton3,'value');
typeOFmodel3=get(handles.radiobutton2,'value');
typeOFmodel4=get(handles.radiobutton4,'value');
typeOFmodel5=get(handles.radiobutton5,'value');
r=handles.I1;
axes(handles.axes2)
if typeOFmodel1==1
a=8;
L=(2.^a)
s=L-1-r;
else if typeOFmodel2==1
c=str2num(get(handles.edit1,'string'));
% rr=r/255;
r=double(r);
s=c.*log(1+r);
% s=s*255;
else if typeOFmodel3==1
gama=str2num(get(handles.edit2,'string'));
c=str2num(get(handles.edit1,'string'));
r=im2double(r);
% r=round(r/255);
% c=1;
% g=0.4;
s=c.*(r.^gama);
% s=round(ss*255);
else if typeOFmodel4==1
a=str2num(get(handles.edit3,'string'));
b=str2num(get(handles.edit4,'string'));
r=im2double(r);
for i=1:size(r,1)
for j=1:size(r,2)
if r(i,j)>0&r(i,j)<a
s(i,j)=0;
else if r(i,j)>a&r(i,j)<b
s(i,j)=(r(i,j)-a)./(b-a);
else if r(i,j)>b&r(i,j)<1
s(i,j)=1;
end
end
end
end
end
else if typeOFmodel5==1
phandles=guidata(Piecewise);
phandles.I1=handles.I1;
% histeqhandles=guidata(project2);
% histeqhandles.r=handles.r;
guidata(Piecewise,phandles)
% close(project2)
guidata(hObject,handles)
end
end
end
end
end
imshow(s)
handles.s=s;
guidata(hObject,handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
axes(handles.axes1)
[FileName,PathName] = uigetfile({'*.jpg';'*.tif';'*.png';'*.*'},'Select a picture');
fullname=[PathName FileName];
I1=imread(fullname);
handles.I1=I1;
guidata(hObject,handles)
imshow(I1);
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
axes(handles.axes2)
[FileName,PathName] = uigetfile({'*.jpg';'*.tif';'*.png';'*.*'},'Select a picture');
fullname=[PathName FileName];
I2=imread(fullname);
handles.I2=I2;
guidata(hObject,handles)
imshow(I2);
% 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)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% thandles=guidata(DIP);
% % thandles.s=handles.s;
% guidata(hObject,handles)
% histeqhandles=guidata(project2);
% histeqhandles.I1=handles.I1;
% guidata(project2,histeqhandles)
%
%
% % histeqhandles=guidata(project2);
% % histeqhandles.r=handles.r;
% % guidata(project2,histeqhandles)
% % close(project2)
% guidata(hObject,handles)
close(project1)
% close(project2)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
close(project1)
% 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)
% --- Executes during object creation, after setting all properties.
function pushbutton4_CreateFcn(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end