文章转自微信公众号:机器视觉那些事

**********************************************************
*********公众号:机器视觉那些事儿**********

* 1. 算法功能:Blob分析--粘连颗粒检测
* 2. 算法思路:
* (1)简单的阈值分割;
* (2)计算连通域connection;
* (3)基于距离变换的分水岭区域分割,使用算子distance_tansform,watersheds
* (4)盆地与原连通域求交集,分离粘连颗粒;

**********************************************************
*采集图像
dev_close_window ()
read_image (Image, 'pellets')

*计算图片大小,并以原图尺寸显示
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (Image)
stop ()

*01 简单的阈值分割
threshold (Image, Region, 105, 255)

*02 计算连通域
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 20, 99999)
dev_set_draw ('margin')
dev_display (Image)
dev_display (SelectedRegions)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()

*03 基于距离变换的分水岭区域分割,使用算子distance_tansform,watersheds
*距离变换
distance_transform (SelectedRegions, DistanceImage, 'octagonal', 'true', 380, 350)
*转换图像类型,将real类型转换为byte,因为分水岭迭代运算的图像为‘byte’类型
convert_image_type (DistanceImage, DistanceImageByte, 'byte')
*反转图像,使得高灰度值在边缘代表山脉,低灰度值在里面代表盆地
invert_image (DistanceImageByte, DistanceImageInv)
* 扩大图像灰度范围【0,255】,增加对比度
scale_image_max (DistanceImageInv, DistanceImageInvScaled)
watersheds_threshold (DistanceImageInv, Basins, 5)
dev_display (DistanceImageInvScaled)
dev_display (Basins)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 原图中显示分水岭
dev_display (Image)
dev_display (SelectedRegions)
dev_set_color ('blue')
dev_display (Basins)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()

*04 盆地与原连通域求交集,分离粘连颗粒
intersection (Basins, SelectedRegions, SegmentedPellets)

*结果显示
dev_display (Image)
dev_set_colored (12)
dev_display (SegmentedPellets)

Blob分析--粘连颗粒检测 基于距离变换的分水岭区域分割 盆地与原连通域求交集的更多相关文章

  1. opencv::基于距离变换与分水岭的图像分割

    什么是图像分割 图像分割(Image Segmentation)是图像处理最重要的处理手段之一 图像分割的目标是将图像中像素根据一定的规则分为若干(N)个cluster集合,每个集合包含一类像素. 根 ...

  2. OpenCV——距离变换与分水岭算法的(图像分割)

    C++: void distanceTransform(InputArray src, OutputArray dst, int distanceType, int maskSize) 参数详解: I ...

  3. [ZZ] 基于Matlab的标记分水岭分割算法

    基于Matlab的标记分水岭分割算法 http://blog.sina.com.cn/s/blog_725866260100rz7x.html 1 综述 Separating touching obj ...

  4. 基于Matlab的标记分水岭分割算法

    转自:http://blog.sina.com.cn/lyqmath 1 综述 Separating touching objects in an image is one of the more d ...

  5. 异常检测-基于孤立森林算法Isolation-based Anomaly Detection-1-论文学习

    论文http://202.119.32.195/cache/10/03/cs.nju.edu.cn/da2d9bef3c4fd7d2d8c33947231d9708/tkdd11.pdf 1. INT ...

  6. 常用机器视觉工具----图像分析工具(blob分析)

    http://blog.sina.com.cn/s/blog_67cc4eb70100ivnt.html Blob分析:Blob分析目的在于对图像中的2-D形状进行检测和分析,得到诸如目标位置.形状. ...

  7. opencv 在工业中的应用:blob分析

    在工业中经常要检测一副图像中物体的数量,位置,大小,面积等信息,这就要用到BLOB分析,我用OPENCV做了个BLOB分析的DEMO. (1)打开一幅图像 (2)进行参数设置,设定二值化阙值,并选择是 ...

  8. kaggle信用卡欺诈看异常检测算法——无监督的方法包括: 基于统计的技术,如BACON *离群检测 多变量异常值检测 基于聚类的技术;监督方法: 神经网络 SVM 逻辑回归

    使用google翻译自:https://software.seek.intel.com/dealing-with-outliers 数据分析中的一项具有挑战性但非常重要的任务是处理异常值.我们通常将异 ...

  9. Halcon blob分析基本处理步骤

    Halcon,blob分析 应用场景,二值化后的灰度图像对比度清晰 基本处理流程 1 读取图片 read_image(变量名,'路径') //halcon字符串使用单引号'' 2 预处理 2.1 RO ...

随机推荐

  1. 1.6 selenium3+firefox环境搭建

    1.6 selenium3+firefox环境搭建 有不少小伙伴在安装selenium环境后启动firefox报错,因为现在selenium升级到3.0了,跟2.0的版本还有有一点区别的.(备注:这里 ...

  2. ItelliJ idea tomcat 配置

    用ItelliJ idea 开发javaWeb. 1. Idea 安装Tomcat 打开Idea,选择设置,并在设置中左边框中选择 Application Servers 点击中间空白框上面的 ’+‘ ...

  3. System.IO.FileSystemWatcher

    这个类功能很强.可以实时监测文件系统的变化. https://msdn.microsoft.com/zh-cn/library/system.io.filesystemwatcher.aspx 事件 ...

  4. js补零方法

    方法如下: function getZero(num, index) { if((parseInt(num) != 0) && (typeof num == "undefin ...

  5. Linux 系统下使用dd命令备份还原MBR主引导记录

    https://en.wikipedia.org/wiki/Master_boot_recordhttps://www.cyberciti.biz/faq/howto-copy-mbr/https:/ ...

  6. Linux 文件类型笔记

    在UNIX中一切都是文件https://ph7spot.com/musings/in-unix-everything-is-a-file在UNIX中,一切都是字节流 ==== linux系统的文件类型 ...

  7. JSON的一些小结

    一.js中 1.json字符串转json对象 var json = $.parseJSON(" {'1':'hello'},{'2':'word'} "); for(var i i ...

  8. mongodb分片balance

    查看balance状态 mongos> sh.getBalancerState()true   通过balance锁查看balance活动 如果state是2,表示balance锁已经被获取 m ...

  9. Dynamics CRM Instances

    Dynamics CRM 的instances: 当我们打开Dynamics 365 admin portal 会看到我们instance是什么: 新 admin center界面: 当前的admin ...

  10. day51 django第二天 django初识

    一.模块渲染  jinja2 实现简单的字符串替换(动态页面) 1.下载 pip install jinja2 示例 : html文件中 <!DOCTYPE html> <html ...