一、图像分割简介

理论知识参考:【基础教程】基于matlab图像处理图像分割【含Matlab源码 191期】

二、部分源代码

function varargout = CellCount(varargin)
% CELLCOUNT M-file for CellCount.fig
%      CELLCOUNT, by itself, creates a new CELLCOUNT or raises the existing
%      singleton*.
%
%      H = CELLCOUNT returns the handl e to a new CELLCOUNT or the handle to
%      the existing singleton*.
%
%      CELLCOUNT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CELLCOUNT.M with the given input arguments.
%
%      CELLCOUNT('Property','Value',...) creates a new CELLCOUNT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before CellCount_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to CellCount_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 CellCount% Last Modified by GUIDE v2.5 01-May-2015 19:43:57% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @CellCount_OpeningFcn, ...'gui_OutputFcn',  @CellCount_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{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before CellCount is made visible.
function CellCount_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 CellCount (see VARARGIN)% Choose default command line output for CellCount
handles.output = hObject;% Update handles structure
guidata(hObject, handles);% UIWAIT makes CellCount wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = CellCount_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 edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit 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');
endfunction edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit 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');
endfunction edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit 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');
endfunction edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit 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');
endfunction edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit 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% --- 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)% --- 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)% --- 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)% --- 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)% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function file_Callback(hObject, eventdata, handles)
% hObject    handle to file (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function open_Callback(hObject, eventdata, handles)
% hObject    handle to open (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global im;
[filename,pathname]=uigetfile({'*.jpg';'*bmp';'*.gif'},'选择图片');
%合成图片路径+文件名
str=[pathname filename];
%读取图片
im=imread(str);
%使用第一个axes
axes(handles.axes0);
imshow(im);% --------------------------------------------------------------------
function save_Callback(hObject, eventdata, handles)
% hObject    handle to save (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 pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close(gcf) %关闭当前figure句柄% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global im
global I
global C
%%%%%%%%%%%%%%%%%%
I=im;
R=I(:,:,1);
G=I(:,:,2);
B=I(:,:,3);
K=rgb2hsv(I);
H=K(:,:,1);
S=K(:,:,2);
V=K(:,:,3);
[cenwhite,copywhite]=Kmeans(H,3);
cenwhite;
A=copywhite;
[m,n]=size(A);
for i=1:m for j=1:n if A(i,j)==cenwhite(2) A(i,j)=1; else A(i,j)=0; end end

三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.
[2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013.
[3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013.
[4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.
[5]赵勇,方宗德,庞辉,王侃伟.基于量子粒子群优化算法的最小交叉熵多阈值图像分割[J].计算机应用研究. 2008,(04)

【细胞分割】基于matlab GUI分水岭算法细胞分割计数【含Matlab源码 637期】相关推荐

  1. 【图像处理】基于matlab GUI多功能图像处理系统【含Matlab源码 1876期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[图像处理]基于matlab GUI多功能图像处理系统[含Matlab源码 1876期] 点击上面蓝色字体,直接付费下载,即可. 获取代码 ...

  2. 【机械仿真】基于matlab GUI曲柄摇杆机构运动仿真【含Matlab源码 1608期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[机械仿真]基于matlab GUI曲柄摇杆机构运动仿真[含Matlab源码 1608期] 点击上面蓝色字体,直接付费下载,即可. 获取代码 ...

  3. 【光学】基于matlab GUI光栅条纹投影生成【含Matlab源码 2118期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[光学]基于matlab GUI光栅条纹投影生成[含Matlab源码 2118期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...

  4. 【机械仿真】基于matlab GUI直齿圆柱齿轮应力计算【含Matlab源码 2077期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[机械仿真]基于matlab GUI直齿圆柱齿轮应力计算[含Matlab源码 2077期] 点击上面蓝色字体,直接付费下载,即可. 获取代 ...

  5. 【天体学】基于matlab GUI太阳天顶角计算【含Matlab源码 2229期】

    一.⛄获取代码方式 获取代码方式1: 完整代码已上传我的资源:[天体学]基于matlab GUI太阳天顶角计算[含Matlab源码 2229期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...

  6. 【AFSA TSP】基于matlab人工鱼群算法求解旅行商问题【含Matlab源码 422期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab人工鱼群算法求解旅行商问题[含Matlab源码 422期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...

  7. 【病虫害识别】基于matlab GUI SVM病虫害识别系统【含Matlab源码 2429期】

    ⛄一.基于机器视觉的农作物病害识别技术 1 叶片图像采集 进行农作物病害自动检测与识别首先要对病害叶片的图像进行采集.自动识别的前提是获得数字图像, 数字图像质量的好坏决定着之后叶片病害的识别特征能否 ...

  8. 【身份证识别】基于matlab GUI BP神经网络身份证识别【含Matlab源码 2239期】

    ⛄一.身份证号码识别简介 1 引言 当今是一个信息高度发达的时代,对于每个公民而言身份证那一连串的数字体现了个人信息的唯一性,出于保障公民合法权益和社会治安的考虑,越来越多的行业都开始建立自己的安全保 ...

  9. 【语音去噪】基于matlab GUI IIR滤波器语音去噪【含Matlab源码 1864期】

    一.语音处理简介 语言是人们获得各类有效信息的主要途径, 而语音是语言的表现形式.语音在一定程度上可影响人们的生活, 因此, 语音信号的研究对科学领域和人们日常生活具有一定的研究价值和意义.噪声广泛存 ...

  10. 【数学建模】基于matlab GUI平行停车模拟仿真【含Matlab源码 1877期】

    一.平行停车模拟仿真简介 近年来, 随着我国经济的快速发展, 机动车保有量也迅速增长.截至2012年底, 全国机动车保有量已达2.4亿辆, 城市"停车难"的问题日趋严重.统计结果表 ...

最新文章

  1. java两个jre_为什么会有两个jre?060925(原创)
  2. 创建型模式--原型模式
  3. 强大的代码扫描工具SonarLint之安装使用
  4. MySQL 5.7临时表空间怎么玩才能不掉坑里
  5. 取出客户端卸载CKEditor中的内容,放入数据库中的方案
  6. Berkeley DB(六) -- DB Replication (HA)上部
  7. TitleWindow的CloseButtionSkin问题
  8. 7.携程架构实践 --- IaaS & PaaS
  9. Jquery中BlockUI的详解
  10. IIS管理器FTP站点中FTP防火墙支持页面
  11. DP动态规划--乡村邮局问题-Post Office(POJ-1160)
  12. 网络流量监测IP雷达 1.0
  13. 迅雷一些版本下载链接
  14. python求最小公倍数_Python 最小公倍数算法
  15. 天使投资人给创业者的一封信
  16. Unity网格变形插件的简单使用:以curve sculpt layered自由变换修改器为例
  17. 计算机网络码片序列计算问题
  18. 中大型网站架构演变之路
  19. Linux系统的结构是什么?主要包含哪几部分?
  20. 推荐 5 款数据库性能监控软件,附下载

热门文章

  1. dgvHelper,xmlHelper,inputbox(仿vba),Evaluate(vba中函数应用于C#)
  2. BEM —— 源自Yandex的CSS 命名方法论
  3. Golang包管理工具glide简介
  4. 接收流信息---字符串
  5. OpenCV4.5.1 | 使用一行代码将图像匹配性能提高14%
  6. Flexsim在固定资源类中没有分拣传送带?
  7. 20191128每日一句感恩节
  8. TTC - Building a Better Vocabulary
  9. 20190930每日一句
  10. unity投影和视频画面的调整