迭代阈值图像分割matlab,Matlab 图像分割 (阈值处理)
使用移动平均的可变阈值处理,对很多对比度差的图像处理效果可以很好,但相应的程序代码的编写却很羞涩,难懂。
function g = movingthresh(f, n, K)
%MOVINGTHRESH Image segmentation using a moving average threshold.
% G = MOVINGTHRESH(F, n, K) segments image F by thresholding its
% intensities based on the moving average of the intensities along
% individual rows of the image. The average at pixel k is formed
% by averaging the intensities of that pixel and its n − 1
% preceding neighbors. To reduce shading bias, the scanning is
% done in a zig-zag manner, treating the pixels as if they were a
% 1-D, continuous stream. If the value of the image at a point
% exceeds K percent of the value of the running average at that
% point, a 1 is output in that location in G. Otherwise a 0 is
% output. At the end of the procedure, G is thus the thresholded
% (segmented) image. K must be a scalar in the range [0, 1].
% Preliminaries.
% || means or operator;rem(n,1) means the residual of n/1
f = tofloat(f);
[M, N] = size(f);
if (n < 1) || (rem(n, 1) ~= 0)
error('n must be an integer >= 1.')
end
if K < 0 || K > 1
error('K must be a fraction in the range [0, 1].')
end
% Flip every other row of f to produce the equivalent of a zig-zag scanning pattern. Convert image to a vector.
f(2:2:end, :) = fliplr(f(2:2:end, :)); %fliplr realize the overturn of the vector
f = f'; % Still a matrix.
f = f(:)'; % Convert to row vector for use in function filter.
% Compute the moving average.
maf = ones(1, n)/n; % The 1-D moving average filter.
ma = filter(maf, 1, f); % Computation of moving average.
% Perform thresholding.
g = (f > K * ma);
% Go back to image format (indexed subscripts).
g = reshape(g, N, M)';
% Flip alternate(交替的) rows back.
g(2:2:end, :) = fliplr(g(2:2:end, :));
如果有人看懂,麻烦讲解一下,有利于大家讨论学习。
迭代阈值图像分割matlab,Matlab 图像分割 (阈值处理)相关推荐
- MATLAB自编程实现阈值图像分割
文章目录 实现思路 实现效果 参考代码 实现思路 绘制原图像的灰度直方图,观察灰度直方图并估计两个峰值对应的灰度值范围 在两个峰值对应的灰度值范围内搜索谷底(最小值)对应的灰度值 将搜索到的谷底对应的 ...
- matlab函数im2bw_图像分割之阈值分割(matlab)(转载)
转载自:https://blog.csdn.net/weixin_39824223/article/details/112249214 matlab函数im2bw_图像分割之阈值分割(matlab) ...
- 【MATLAB教程案例23】基于MATLAB图像分割算法仿真——阈值分割法、Otsu阈值分割法、K均值聚类分割法等
FPGA教程目录 MATLAB教程目录 目录 1.软件版本 2.通过二值图实现图像分割 3.通过Otsu阈值分割实现图像分割
- 【图像分割】基于迭代阙值选择、最大类间差、区域生长多种算法实现图像分割含Matlab源码
1 简介 重点讨论了图像分割法中的阈值研究法,包括迭代阙值选择.最大类间差.区域生长进行了重点分析,用Matlab进行实现并给出了实验结果. 2 部分代码 function varargout = I ...
- 基于Matlab的图像分割----边缘检测
在一幅图像中,人们往往只对其中的某些目标感兴趣,而这些目标通常占据一定的区域,并且在某些特性上(如灰度,轮廓,颜色及纹理等)上和周围的图像有差别.这些差别可能很明显也可能很微小,随着计算机图像处理技术 ...
- 遗传算法实现图像分割(MATLAB)
本文是对于Omar Banimelhem and Yahya Ahmed Yahya 发表论文<Multi-Thresholding Image Segmentation Using Genet ...
- 基于MATLAB的图像分割系统
摘要:数字图像处理是利用计算机对图像信息进行各种变换处理的技术和方法.本文主要介绍了数字图像处理和图像中区域特征检测的原理,以及MATLAB在数字图像处理中的应用.本次设计主要研究了数字图像处理中图像 ...
- 基于MATLAB改进Otsu阈值分割的车道线检测
基于MATLAB改进Otsu阈值分割的车道线检测 摘要:在判断车道偏离以防止车辆碰撞等危害时,车道标线检测需要通过图像处理来进行,检测方法是否适用于各种背景环境条件以及检测的及时性至关重要传统的Ots ...
- 图像分形的matlab算法,基于MATLAB的图像分割算法研究
内容介绍 原文档由会员 花季永驻 发布 基于MATLAB的图像分割算法研究 全文54页 约28000字 论述翔实 摘 要 本文从原理和应用效果上对经典的图像分割方法如边缘检测.阈值分割技术和区域增长等 ...
- matlab人工选择阈值进行分割,基于MATLAB的图像阈值分割算法的研究
[摘要]:图像分割是一种重要的数字图像处理技术.本文首先介绍了图像分割技术,其次总结了目前图像分割技术中所用到的阈值.边缘检测.区域提取等方法以及分水岭算法.针对各种阈值分割算法,本文在最后做了详细的 ...
最新文章
- 批量插入/修改网页代码的asp脚本
- 数据中心运营之4P标准化运维规程
- 【推荐】一下令人惊艳的的网站,绝对会让你爱上历史
- ElementUI的el-table隐藏id列
- Earthquake
- 我的美丽天使(My Fair Angel)全剧情攻略
- vi/vim 基本使用方法
- Atitit q2016 q5 doc list on home ntpc.docx
- 解决eclipse反编译乱码
- 脱库站库分离渗透解决MySQL禁止外连
- 微波工程学习1-电磁理论
- 数据结构_树状数组 详解
- 银行对公业务和对私业务
- 【MySQL--03】表的操作
- DMP (Dynamic Movement Primitives) 动态运动基元
- 1400㎡,联诚发龙腾LED透明屏点燃五月天新加坡演唱会!
- 《集体智慧编程》读书笔记10
- cesium中实现鼠标拖动实体功能
- [转]辨别常见与不常见音乐文件格式的质量好坏!
- 10月27日Scalers签名书获奖结果