function varargout = fna3(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fna3_OpeningFcn, ...
'gui_OutputFcn', @fna3_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
function fna3_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = fna3_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% --- Executes on button press in resmi_getir.
function resmi_getir_Callback(hObject, eventdata, handles)
% hObject handle to resmi_getir (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
[filename,pathname] = uigetfile();
if filename==0
msgbox(sprintf('L�tfen bir resim se�iniz'),'Hata','error')
end
axes(handles.image)
image=imread(filename);
imshow(image);
% --- Executes on button press in hazir_threshold.
function hazir_threshold_Callback(hObject, eventdata, handles)
% hObject handle to hazir_threshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
axes(handles.image_processing)
level = graythresh(image);
thresh = im2bw(image, level);
imshow(thresh)
% --- Executes on button press in histogram.
function histogram_Callback(hObject, eventdata, handles)
% hObject handle to histogram (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
axes(handles.axes3)
x = (0:1:255);
freq = zeros(256,1);
for i=1:size(image,1)
for j = 1:size(image,2)
value = image(i,j);
freq(value+1) = freq(value+1)+1;
end
end
bar(x,freq);
axis([0 256 0 30000]);
% --- Executes on button press in otsu.
function otsu_Callback(hObject, eventdata, handles)
% hObject handle to otsu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
axes(handles.image_processing)
img=rgb2gray(image);
imshow(img>110);
% --- Executes on button press in sobel.
function sobel_Callback(hObject, eventdata, handles)
% hObject handle to sobel (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
axes(handles.image_processing)
B = rgb2gray(image);
C = double(B);
for i=1:size(C,1)-2
for j=1:size(C,2)-2%Sobel mask for x-direction:
Gx=((2*C(i+2,j+1)+C(i+2,j)+C(i+2,j+2))-(2*C(i,j+1)+C(i,j)+C(i,j+2)));%Sobel mask for y-direction:
Gy=((2*C(i+1,j+2)+C(i,j+2)+C(i+2,j+2))-(2*C(i+1,j)+C(i,j)+C(i+2,j)));%The gradient of the image
%B(i,j)=abs(Gx)+abs(Gy);
B(i,j)=sqrt(Gx.^2+Gy.^2);
end
end
imshow(B)
% --- Executes on button press in prewitt.
function prewitt_Callback(hObject, eventdata, handles)
% hObject handle to prewitt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global image
axes(handles.image_processing)
B = rgb2gray(image);
C = double(B);
for i=1:size(C,1)-2
for j=1:size(C,2)-2%Sobel mask for x-direction:
Gx=((C(i+2,j+1)+C(i+2,j)+C(i+2,j+2))-(C(i,j+1)+C(i,j)+C(i,j+2)));%Sobel mask for y-direction:
Gy=((C(i+1,j+2)+C(i,j+2)+C(i+2,j+2))-(C(i+1,j)+C(i,j)+C(i+2,j)));%The gradient of the image
%B(i,j)=abs(Gx)+abs(Gy);
B(i,j)=sqrt(Gx.^2+Gy.^2);
end
end
imshow(B)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
segmentation.rar (2个子文件)
segmentation
segmentation_gui.fig 58KB
segmentation_gui.m 4KB
共 2 条
- 1
资源评论
寒泊
- 粉丝: 85
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功