zoukankan      html  css  js  c++  java
  • dyn_threshold

    //采用系统自带图片

    read_image (Image, 'particle')
    *获取图像

    dev_display (Image)
    *显示图像

    threshold (Image, Large, 110, 255)
    *灰度阈值分割图像

    dilation_circle (Large, LargeDilation, 7.5)
    *圆角膨胀

    dev_display (Image)
    dev_set_draw ('margin')
    dev_set_line_width (3)
    dev_set_color ('red')
    dev_display (LargeDilation)
    dev_set_draw ('fill')
    *显示图像

    complement (LargeDilation, NotLarge)
    *返回补充图像,即获得去除大斑点后的图像NotLarge

    reduce_domain (Image, NotLarge, ParticlesRed)
    *减去除了NotLarge图像,即去除大斑点后的图像,减少运算

    mean_image (ParticlesRed, Mean, 31, 31)
    *平滑处理图像

    dyn_threshold (ParticlesRed, Mean, SmallRaw, 3, 'light')
    *选择灰度阈值;网友详解:当前背景之间差异明显时,可以设定全局阈值进行threshold,但很多情况下由于背景不均一,
    *目标体经常表现为比背景局部亮一些或暗一些,无法确定全局阈值操作,需要通过其邻域找到一个合适的阈值进
    *行分割。ThresholdImage是参考图像,通过与OrigImage对比找到领域确定阈值,一般采用平滑滤波算子
    *(如mean_image)获取参考图像。offset设定邻域比较的区间范围,灰度值变化在offset范围内均是可以接受的。

    opening_circle (SmallRaw, Small, 2.5)
    *消除小区域(小于圆形结构元素)和光滑的边界地区

    connection (Small, SmallConnection)
    *显示联通区域

    dev_display (Image)
    *这句不加窗口显示效果会有雪花

    dev_set_colored (12)
    dev_display (SmallConnection)
    *显示结果图像

    手册里面的particle例子,例子的任务是分析颗粒在液体中。在这个应用程序的主要困难:存在两种类型的对象:大明亮物体和较低的小物体的对比。此外噪音使分割的存在困难;无法使用全局灰度阈值threshold进行分割;所以采用先将大块不需要检测的部分去除掉,再通过灰度动态阈值dyn_threshold分割图像得到想要的内容。

    参考:https://www.pianshen.com/article/93601894439/

  • 相关阅读:
    Entity SQL 初入
    ObjectQuery查询及方法
    Entity Framework 的事务 DbTransaction
    Construct Binary Tree from Preorder and Inorder Traversal
    Reverse Linked List
    Best Time to Buy and Sell Stock
    Remove Duplicates from Sorted Array II
    Reverse Integer
    Implement Stack using Queues
    C++中const限定符的应用
  • 原文地址:https://www.cnblogs.com/wdfrog/p/15121996.html
Copyright © 2011-2022 走看看