资源简介
只要装有matlab就能跑通代码,采用的均值漂移(mean shift)方法进行图像分割。
代码片段和文件信息
function tu=keyprogram( )
rgb=imread(‘test.png‘);
rgb=im2double(rgb);
r=rgb(::1);
g=rgb(::2);
b=rgb(::3);
num=0.5*((r-g)+(r-b));
den=sqrt((r-g).^2+(r-b).*(g-b));
theta=acos(num./(den+eps));
H=theta;
H(b>g)=2*pi-H(b>g);
H=H/(2*pi);
num=min(min(rg)b);
den=r+g+b;
den(den==0)=eps;
S=1-3.*num./den;
H(S==0)=0;
I=(r+g+b)/3;
S=im2uint8(S);
H=im2uint8(H);
I=im2uint8(I);
S=double(S);H=double(H);I=double(I);
[mn]=size(S);
figure;imshow(uint8(S));figure;imshow(uint8(H));figure;imshow(uint8(I));
S1=S;
h1=H;i1=I;
for i=1:m
for j=1:n
if (S(ij)>=100)
S1(ij)=255;
else S1(ij)=0;
end
end
end
figure;imshow(uint8(S1));
for i=1:m
for j=1:n
if (S1(ij)==0)
H(ij)=0;
end
end
end
H1=meanshift(H);
figure;imshow(uint8(H1));
for i=1:m
for j=1:n
if (S1(ij)==255)
I(ij)=0;
end
end
end
I1=meanshift(I);
figure;imshow(uint8(I1));
for i=1:m
for j=1:n
if (S1(ij)==0)
H1(ij)=h1(ij);
end
end
end
for i=1:m
for j=1:n
if (S1(ij)==255)
I1(ij)=i1(ij);
end
end
end
hsi=cat(3H1S1I1);
figure;imshow(uint8(hsi));
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1281 2018-10-24 20:03 基于均值漂移(mean shift)算法的图像分割\keyprogram.m
文件 1239 2010-12-04 13:44 基于均值漂移(mean shift)算法的图像分割\meanshift.m
文件 251 2018-10-24 20:12 基于均值漂移(mean shift)算法的图像分割\readme.txt
文件 272694 2006-09-13 17:25 基于均值漂移(mean shift)算法的图像分割\tree.bmp
目录 0 2018-10-24 20:11 基于均值漂移(mean shift)算法的图像分割
----------- --------- ---------- ----- ----
275465 5
- 上一篇:数字信号处理实验刘舒帆版答案
- 下一篇:基于MATLAB的LDPC编译码仿真程序
相关资源
- 基于MATLAB的LDPC编译码仿真程序
- 基于水平集CV模型的图像分割Matlab代码
- 小波变换图像增强
- 298496基于Matlab的m序列发生器的设计与
- 基于matlab的Boost变换器的有源功率因数
- 昆明理工大学纠错编码原理及MATLAB实
- 神经网络激活函数matlab
- KPCA MATLAB程序,提供4种核函数,根据
- 频域特征值MATLAB程序
- 时域特征值MATLAB程序
- matlab环境下dubins路径的实现
- 变分法水平集matlab代码
- 布拉格光栅MATLAB反射谱仿真
- MATLAB基于蚁群算法的二维路径规划算
- dijkstra的matlab代码
- 二维码识别系统 MATLAB
- 电力电子和电力拖动控制系统的MATL
- Matlab code for Precision/Recall ROC Accuracy
- BBHE/DSIHE/MMBEBHE代码 matlab版
- 汉明码,格莱码,BCH码,RS码的编码译
- 基于matlab的gui显示动态卷积,圆周卷
- matlab_FR共轭梯度算法+BFGS拟牛顿算法
- boxmuller方法生成正态分布随机数
- 亲测绝对可用!matlab代码 RGB图片转
- 卡尔曼滤波-Matlab程序
- 小波模极大值边缘检测+膨胀+边缘跟踪
- 粒子群算法解决企业生产调度问题m
- MATLAB遗传算法源代码
- MATLAB2017a破解包crack
- 在Matlab中读取采集到的imu数据(txt格
评论
共有 条评论