function varargout = CT_image_FCM(varargin)
% CT_IMAGE_FCM MATLAB code for CT_image_FCM.fig
% CT_IMAGE_FCM, by itself, creates a new CT_IMAGE_FCM or raises the existing
% singleton*.
%
% H = CT_IMAGE_FCM returns the handle to a new CT_IMAGE_FCM or the handle to
% the existing singleton*.
%
% CT_IMAGE_FCM('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CT_IMAGE_FCM.M with the given input arguments.
%
% CT_IMAGE_FCM('Property','Value',...) creates a new CT_IMAGE_FCM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CT_image_FCM_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CT_image_FCM_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 CT_image_FCM
% Last Modified by GUIDE v2.5 17-Apr-2020 00:06:23
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CT_image_FCM_OpeningFcn, ...
'gui_OutputFcn', @CT_image_FCM_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 CT_image_FCM is made visible.
function CT_image_FCM_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 CT_image_FCM (see VARARGIN)
% Choose default command line output for CT_image_FCM
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CT_image_FCM wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = CT_image_FCM_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)
% 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)
global I
[filename, pathname]= ...
uigetfile({
'*.*';'*.bmp';'*.tif';'*.png';'*.jpg'},'select picture');
str= [pathname filename];
I= imread(str);
axes(handles.axes1);
imshow(I);
title('原图');
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% 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)
% 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)
global I I0 A
[I2,clusterResult] = FCM1(I, 4,[0 80 160 255],2,150,1e-5);
axes(handles.axes3);
imshow(I2)
I0=I2;
A=unique(I0);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% 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)
global I0 A
I0_2=zeros(size(I0,1),size(I0,2));
for i=1:size(I0,1)
for j=1:size(I0,2)
if I0(i,j)==A(2)
I0_2(i,j)=255;
else I0_2(i,j)=0;
end
end
end
I0_2=uint8(I0_2);
axes(handles.axes4);
imshow(I0_2);
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% 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)
global I0 A
I0_3=zeros(size(I0,1),size(I0,2));
for i=1:size(I0,1)
for j=1:size(I0,2)
if I0(i,j)==A(3)
I0_3(i,j)=255;
else I0_3(i,j)=0;
end
end
end
I0_3=uint8(I0_3);
axes(handles.axes5);
imshow(I0_3);
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I0 A
I0_4=zeros(size(I0,1),size(I0,2));
for i=1:size(I0,1)
for j=1:size(I0,2)
if I0(i,j)==A(4)
I0_4(i,j)=255;
else I0_4(i,j)=0;
end
end
end
I0_4=uint8(I0_4);
axes(handles.axes6);
imshow(I0_4);
function varargout = CT_image_GFCM(varargin)
% CT_IMAGE_GFCM MATLAB code for CT_image_GFCM.fig
% CT_IMAGE_GFCM, by itself, creates a new CT_IMAGE_GFCM or raises the existing
% singleton*.
%
% H = CT_IMAGE_GFCM returns the handle to a new CT_IMAGE_GFCM or the handle to
% the existing singleton*.
%
% CT_IMAGE_GFCM('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CT_IMAGE_GFCM.M with the given input arguments.
%
% CT_IMAGE_GFCM('Property','Value',...) creates a new CT_IMAGE_GFCM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before CT_image_GFCM_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to CT_image_GFCM_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 CT_image_GFCM
% Last Modified by GUIDE v2.5 13-Apr-2020 21:47:11
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @CT_image_GFCM_OpeningFcn, ...
'gui_OutputFcn', @CT_image_GFCM_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 CT_image_GFCM is made visible.
function CT_image_GFCM_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 CT_image_GFCM (see VARARGIN)
% Choose default command line output for CT_image_GFCM
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes CT_image_GFCM wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = CT_image_GFCM_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)
% 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)
global I
[filename, pathname]= ...
uigetfile({
'*.*';'*.bmp';'*.tif';'*.png';'*.jpg'},'select picture');
str= [pathname filename];
I= imread(str);
axes(handles.axes1);
imshow(I);
title('原图');
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% 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)
global I
I=medfilt2(I,[3,3]);
axes(handles.axes2);
imshow(I)
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% 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)
global I r c U
[r,c] = size(I);
data = zeros(r*c,1);
for i = 1:r
for j = 1:c
data((i-1)*c+j,1) = double(I(i,j));
end
end
[center, U, obj_fcn] = GFCM(data,4,0.9);
for i = 1 : r
for j = 1 : c
temp = (double(I(i, j)) - center) .^ 2;
[fmin pos] = min(temp);
I(i, j) = uint8(pos * 255 / 4);
end
end
axes(handles.axes3);
imshow(I)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% 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)
global I r c U
I_seg2 = I*0;
for i = 1:r
for j = 1:c
if U(1,(i-1)*c+j)<U(2,(i-1)*c+j)
I_seg2(i,j) =0 ;
else
I_seg2(i,j) =255;
end
end
end
axes(handles.axes4);
imshow(I_seg2)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% 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)
global I r c U
I_seg3 = I*0;
for i = 1:r
for j = 1:c
if U(1,(i-1)*c+j)<U(3,(i-1)*c+j)
I_seg3(i,j) =0 ;
else
I_seg3(i,j) =255;
end
end
end
axes(handles.axes5);
imshow(I_seg3)
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global I r c U
I_seg4 = I*0;
for i = 1:r
for j = 1:c
if U(1,(i-1)*c+j)<U(4,(i-1)*c+j)
I_seg4(i,j) =0 ;
else
I_seg4(i,j) =255;
end
end
end
axes(handles.axes6);
imshow(I_seg4)
完整代码或者代写添加QQ912100926
往期回顾>>>>>>
【图像压缩】图像处理教程系列之图像压缩【Matlab 074期】
【图像分割】图像处理教程系列之图像分割(一)【Matlab 075期】
【图像分割】图像处理教程系列之图像分割(二)【Matlab 076期】
【模式识别】银行卡号之识别【Matlab 077期】
【模式识别】指纹识别【Matlab 078期】
【图像处理】基于GUI界面之DWT+DCT+PBFO改进图像水印隐藏提取【Matlab 079期】
【图像融合】CBF算法之图像融合【Matlab 080期】
【图像去噪】自适应形态学之图像去噪【Matlab 081期】
【图像增强】DEHAZENET和HWD之水下去散射图像增强【Matlab 082期】
【图像增强】PSO寻优ACE之图像增强【Matlab 083期】
【图像重建】ASTRA算法之图像重建【Matlab 084期】
【图像分割】四叉树之图像分割【Matlab 085期】
【图像分割】心脏中心线之提取【Matlab 086期】
【图像识别】SVM植物叶子之疾病检测和分类【Matlab 087期】
【图像识别】基于GUI界面之模板匹配手写数字识别系统【Matlab 088期】
【图像识别】基于GUI界面之不变矩的数字验证码识别【Matlab 089期】
【图像识别】条形码识别系统【Matlab 090期】
【图像识别】基于GUI界面RGB和BP神经网络之人民币识别系统【Matlab 091期】
【图像识别】CNN卷积神经网络之验证码识别【Matlab 092期】
【图像分类】极限学习分类器之对遥感图像分类【Matlab 093期】
【图像变换】DIBR-3D之图像变换【Matalb 094期】
【图像分割】模糊聚类算法之FCM图像分割【Matlab 095期】
【模式识别】银行监控系统之人脸识别【Matlab 096期】
【模式识别】基于GUI界面之疲劳检测系统【Matlab 097期】
【图像识别】国外车牌识别【Matlab 098期】
【图像分割】最大类间方差法(otsu)之图像分割【Matlab 099期】
【图像分割】直觉模糊C均值聚类之图像分割IFCM【Matlab 100期】
【图像分割】基于matlab形态学重建和过滤改进FCM算法(FRFCM)之图像分割【Matlab 101期】
【图像增强】局部对比度增强CLAHE算法之直方图增强【Matlab 102期】
【图像融合】Frequency Partition之图像融合【Matlab 103期】
【图像评价】SVM之图像无参考质量评价【Matlab 104期】
【图像边缘检测】最小二乘法用于椭圆边缘检测【Matlab 105期】
【图像加密】基于GUI界面之混沌系统图像加密解密【Matlab 106期】
【图像配准】SIFT算法之图像配准【Matlab 107期】
【图像分割】随机游走算法用于图像分割【Matlab 108期】
【图像分割】形态学重建和过滤改进FCM算法(FRFCM)用于图像分割【Matlab 109期】
【图像分割】图像分割IFCM之直觉模糊C均值聚类【Matlab 110期】
【图像增强】区域相似变换函数与蜻蜓算法之灰度图像增强【Matlab 111期】
【图像直线拟合】最小二乘法之图像直线拟合【Matlab 112期】
【图像去雾】暗通道之图像去雾【Matlab 113期】
【图像识别】基于matlab GUI界面之路面裂缝识别【Matlab 114期】
【图像识别】身份证号码之识别【Matlab 115期】