区域生长(冈萨雷斯数字图像处理)
来源:互联网 发布:兰特报价软件 编辑:程序博客网 时间:2024/05/16 05:57
区域生长
regiongrow函数的使用,在使用之前先定义函数功能,http://book.51cto.com/art/201304/391313.htm,
- function [g, NR, SI, TI] = regiongrow(f, S, T)
- %REGIONGROW Perform segmentation by region growing.
- % [G, NR, SI, TI] = REGIONGROW(F, S, T). S can be an array (the
- % same size as F) with a 1 at the coordinates of every seed point
- % and 0s elsewhere. S can also be a single seed value. Similarly,
- % T can be an array (the same size as F) containing a threshold
- % value for each pixel in F. T can also be a scalar, in which case
- % it becomes a global threshold. All values in S and T must be in
- % the range [0, 1]
- %
- % G is the result of region growing, with each region labeled by a
- % different integer, NR is the number of regions, SI is the final
- % seed image used by the algorithm, and TI is the image consisting
- % of the pixels in F that satisfied the threshold test, but before
- % they were processed for connectivity.
- if = tofloat(f);
- % If S is a scalar, obtain the seed image.
- if numel(S) == 1
- SI = f == S;
- SS1 = S;
- else
- % S is an array. Eliminate duplicate, connected seed locations
- % to reduce the number of loop executions in the following
- % sections of code.
- SI = bwmorph(S, 'shrink', Inf);
- S1 = f(SI); % Array of seed values.
- end
- TI = false(size(f));
- for K = 1:length(S1)
- seedvalue = S1(K);
- S = abs(f ? seedvalue) <= T; % Re-use variable S.
- TITI = TI | S;
- end
- % Use function imreconstruct with SI as the marker image to
- % obtain the regions corresponding to each seed in S. Function
- % bwlabel assigns a different integer to each connected region.
- [g, NR] = bwlabel(imreconstruct(SI, TI));
i=imread('X-ray.png');
I1 = rgb2gray(i);
figure(1);imshow(I1);
% i=doulbe(i);
[m,n]=size(I1);
S=1;
T=0.26;
[g, NR, SI, TI ]=regiongrow(I1,S,T);
figure(2);imshow(g);title('区域增长');
figure(3);imshow(SI);
figure(4);imshow(TI);
然后对定义regiongrow里的tofloat,https://zhidao.baidu.com/question/499990534173948084.html,就可以运行程序了。
阅读全文
0 0
- 区域生长(冈萨雷斯数字图像处理)
- 数字图像处理----区域生长
- 数字图像处理的区域生长算法
- 数字图像处理—图像分割—串行区域(区域生长)(分裂合并)
- 区域生长法的编程实现——程序员数字图像处理第一步
- 图像分割(区域生长)
- 图像处理算法—区域生长
- 区域生长
- 区域生长(用鼠标选择一个点进行生长)
- 图像处理(五):八邻域边缘跟踪与区域生长算法
- 《数字图像处理》--冈萨雷斯(第一章)
- 图像处理算法1——区域生长法
- 图像处理算法1——区域生长法
- 区域生长(基于区域的图像分割)
- 区域生长代码
- 区域生长算法:
- 区域生长算法代码
- 区域生长算法
- JDK1.8新特性值Optional
- php 运行方式 cgi,fastcgi,php-fpm的区别与联系
- LightOJ
- Windows系统命令行设置环境变量
- C++PrimerPlus第三章处理数据学习随笔
- 区域生长(冈萨雷斯数字图像处理)
- C语言题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。
- LeetCode(Array)---------Two Sum
- 游戏中的设计模式七(建造者模式)
- Spring整合Jedis2.9(集群带密码版)
- Java/Android 获取网络重定向文件的真实URL
- 指纹识别传感器技术演变历程
- 数据库视频第十一至十三章
- Linux下安装Go及环境配置