function varargout = main1

function varargout = main1(varargin)
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …

‘gui_Singleton’, gui_Singleton, …

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

‘gui_OpeningFcn’, @main1_OpeningFcn, … ‘gui_OutputFcn’, @main1_OutputFcn, …

‘gui_LayoutFcn’, , …

‘gui_Callback’, );
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
endif nargout varargout{1:nargout} = gui_mainfcn(gui_State, varargin{:});
else gui_mainfcn(gui_State, varargin{:});
endfunction main1_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 main1 (see VARARGIN)
handles.output = hObject;
i=imread(‘test4.jpg’);
%figure(‘Name’,’Original image’);
axes(handles.axes1)
imshow(i);
%seperate red green and blue frames of the image
red=i(:,:,1);
green=i(:,:,2);
blue=i(:,:,3);
figure();
subplot(3,3,1);
imshow(red);
title(‘Red plane’)
subplot(3,3,4);
imshow(green);
title(‘green plane’)
subplot(3,3,7);
imshow(blue);
title(‘blue pane’)
j=histeq(red);
k=histeq(green);
l=histeq(blue);
subplot(3,3,2);
imshow(j);
title(‘Enhanced red plane’)
subplot(3,3,5);
imshow(k);
title(‘Enhanced green plane’)
subplot(3,3,8);
imshow(l);
title(‘Enhanced blue plane’)
%size() retures a row vector whose element contain the length of
corresponding dimentionr,c=size(red);
red_cmp=255-red;
green_cmp=255-green;
blue_cmp=255-blue;
subplot(3,3,3);
imshow(red_cmp);
title(‘complement of red plane’)
subplot(3,3,6);
imshow(green_cmp);
title(‘complement of green plane’)
subplot(3,3,9);
imshow(blue_cmp);
title(‘complement of blue plane’)
%enhancing the complement of planes
r,c=size(red_cmp);
for x=1:r;
for y=1:c
if red_cmp(x,y)<180
red_cmp(x,y)=red_cmp(x,y)-90;
else red_cmp(x,y)=red_cmp(x,y)+90;
end endendfigure();
imshow(red_cmp);
r,c=size(green_cmp);
for x=1:r;
for y=1:c
if green_cmp(x,y)<180
green_cmp(x,y)=green_cmp(x,y)-90;
else green_cmp(x,y)=green_cmp(x,y)+90;
end endendfigure();
imshow(green_cmp);
r,c=size(blue_cmp);
for x=1:r;
for y=1:c
if blue_cmp(x,y)<180
blue_cmp(x,y)=blue_cmp(x,y)-120;
else blue_cmp(x,y)=blue_cmp(x,y)+120;
end endendfigure();
imshow(blue_cmp);
rgb=cat(3,red_cmp,green_cmp,blue_cmp);
figure(‘Name’,’RGB image after dehazing and complementing’);
imshow(rgb);
avg=imsubtract(i,rgb);
figure();
imshow(avg);
avg=avg/2;
figure(‘Name’,’Histogram enhanced red plane’);
imhist(red_cmp);
figure(‘Name’,’blue’);
imhist(blue_cmp);
figure();
imhist(green_cmp);
figure();
%converts the true color image RGB to grayscale intensity image.

edg=rgb2gray(rgb);
imshow(edg);
BW1 = edge(edg,’prewitt’);
BW2 = edge(edg,’canny’)
BW = im2bw(edg, graythresh(edg));
figure();
imshow(BW);
%returns a label matrix L
B,L = bwboundaries(BW);
imshow(label2rgb(L, @jet, .5 .5 .5))
hold on
for k = 1:length(B)
%obtain(x,y) boundry coordinates corresponding to label k
boundary = B{k};
endaxes(handles.axes3)
%output with prewittimshow(BW1);
axes(handles.axes2)
imshow(BW2);
%title(‘Output with canny’)
guidata(hObject, handles
function varargout = main1_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns call
function axes2_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
function axes3_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes3 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called