一、图像分割简介

理论知识参考:【基础教程】基于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. 清华袁洋:智能医疗不是让AI替代医生,而是……
  2. 翻译介绍15个经典的MDX查询-02and03
  3. Android项目中使用激光推送时在模拟器上运行时报Fatal signal 11的解决
  4. 将DataTable中的数据导入到数据库中
  5. 微信接口开发之高级篇系列【网页授权详细说明【提供测试账号使用】】
  6. 关于 Qt 5,你所需要了解的基础知识
  7. 第 22 期:有序遍历语法
  8. mac下ssh报错:ssh_exchange_identification: read: Connection reset by peer
  9. sparkstreaming自定义kafka
  10. AngularJS 资源和开发教程
  11. Java 中的array数组总结之一
  12. 201671010128 2017-10-08《Java程序设计》之接口与内部类
  13. jxl 导入导出Excel(有模板)
  14. atmega328p引脚图_ATMEGA328P-AU 8位AVR微控制器
  15. ReviewBoard代码评审实践总结
  16. 笔记十三:python之类的继承实例(猜诗歌)
  17. 安装和使用Clouda
  18. 英式音标26字母(U-Z)
  19. 计算机考研真题解析---计算机网络
  20. opencv cpu指令集SSE/AVX

热门文章

  1. 程序员的职业素养---转载
  2. 在Netty中使用Apache common fileupload
  3. 如何判断数据库中是否已经存在某个临时表?
  4. 精业科技(天津)有限公司 Game Over
  5. Docker网络基础---Docker跨主机容器访问通信
  6. python opencv 打开相机检测圆点
  7. 检测相机视野中的物体运动并用Mask显示
  8. 在相近背景中找圆和直线
  9. 将类实现分开以及代码块
  10. 190509每日一句