7.图像分割

7.1峰谷阈值法

​
*阈值分割
*把Image中的灰度值在0-50之间的像素点提取出来放到Region中
threshold (Image16, Region, 0,50)
*灰度直方图确定灰度值最小值和最大值
threshold (Image16, Regions, 0, 127)

7.2提取蓝色目标

* 将三通道分解成单通道
decompose3 (Image, ImageR, ImageG, ImageB)
trans_from_rgb (ImageR, ImageG, ImageB, ImageH, ImageS, ImageV, 'hsv')
* threshold只能识别单通道的
threshold (ImageB, Region, 201, 255)
dev_display (Image)
*让选中的区域显示别的颜色
dev_set_color ('red')

7.3大津法

read_image (Image6, './image/图片6.png')
read_image (Image10, './image/图片10.png')
​
​
*转灰度图
rgb1_to_gray (Image6, GrayImage)
​
​
*大津法   UsedThreshold自动确定的阈值
* 'light' 提取( UsedThreshold-255)
* 'dark' 提取(0-UsedThreshold)
binary_threshold (GrayImage,\
                  Region,\
                  'max_separability',\
                  'light',\
                  UsedThreshold)

7.4动态阈值分割

​
*转灰度图
rgb1_to_gray (Image10, GrayImage)
*通过均值平滑一个图像
* 均值滤波的尺寸要稍微大于
mean_image (GrayImage, ImageMean, 150, 320)
* for Index := 1 to 100 by 1
*用for可以将图片灰度值找出来
*
    dyn_threshold (GrayImage, ImageMean, RegionDynThresh,9,\
                'dark')
* dev_clear_window ()
* dev_display (RegionDynThresh)
* stop ()
* endfor

7.5分水岭

图像分割是将图像中的每个像素分类为某个类的任务。

分水岭算法是一种经典的图像分割算法。它将图像中的像素值视为地形。像素值越大,表示地势越高。假如我们有多个盆地,如果我们用不同颜色的水填充不同的盆地,那么不同颜色的交点将为我们提供对象边界。

满足下列条件,两个盆地就合并:

for Index :=1 to 50 by 1   watersheds_threshold (Image16, Basins, Index) dev_clear_window () dev_display (Basins) stop () endfor

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值